L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h




Download 7,3 Mb.
Pdf ko'rish
bet80/125
Sana14.05.2024
Hajmi7,3 Mb.
#232858
1   ...   76   77   78   79   80   81   82   83   ...   125
Bog'liq
linuxbasicsforhackers

Managing Processes
Hackers often need to multiprocess, and an operating system like Kali is 
ideal for this. The hacker may have a port scanner running while running 
a vulnerability scanner and an exploit simultaneously. This requires that 
the hacker manage these processes efficiently to best use system resources 
and complete the task. In this section, I'll show you how to manage multiple 
processes.


Process Management
65
Changing Process Priority with nice
You don’t often hear the word nice used in the context of hackers, but here 
you will. The 
nice
command is used to influence the priority of a process to 
the kernel. As you saw when we ran the 
ps
command, numerous processes 
run on the system at once, and all of them are contending for the available 
resources. The kernel will have final say over the priority of a process, but 
you can use 
nice
to suggest that a process should be elevated in priority.
The idea behind the use of the term nice is that, when you use it, you’re 
determining how “nice” you’ll be to other users: if your process is using most 
of the system resources, you aren’t being very nice.
The values for 
nice
range from −20 to +19, with zero being the default 
value (see Figure 6­1). A high 
nice
value translates to a low priority, and a 
low 
nice
value translates to a high priority (when you’re not being so nice 
to other users and processes). When a process is started, it inherits the 
nice
value of its parent process. The owner of the process can lower the priority 
of the process but cannot increase its priority. Of course, the superuser or 
root user can arbitrarily set the 
nice
value to whatever they please.
0
−20
+19
Default
nice value
Least likely to
receive priority
Most likely to
receive priority
Figure 6-1: Niceness priority values
When you start a process, you can set the priority level with the 
nice
command and then alter the priority after the process has started run­
ning with the 
renice
command. The syntax for these two commands is 
slightly different and can be confusing. The 
nice
command requires that 
you increment the 
nice
value, whereas the 
renice
command wants an absolute 
value for niceness. Let’s look at an example to demonstrate this.

Download 7,3 Mb.
1   ...   76   77   78   79   80   81   82   83   ...   125




Download 7,3 Mb.
Pdf ko'rish

Bosh sahifa
Aloqalar

    Bosh sahifa



L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h

Download 7,3 Mb.
Pdf ko'rish