Study Record/Cybersecurity

[HTB Academy] Using the Metasploit Framework Notes (4)

Sungyeon Kim 2025. 2. 5. 23:10

1. Jobs

- We would use the jobs command to look at the currently active tasks running in the background and terminate the old ones to free up the port.

msf6 exploit(multi/handler) > jobs -h
Usage: jobs [options]

Active job manipulation and interaction.

OPTIONS:

    -K        Terminate all running jobs.
    -P        Persist all running jobs on restart.
    -S <opt>  Row search filter.
    -h        Help banner.
    -i <opt>  Lists detailed information about a running job.
    -k <opt>  Terminate jobs by job ID and/or range.
    -l        List all running jobs.
    -p <opt>  Add persistence to job by job ID
    -v        Print more detailed info.  Use with -i and -l

 

1) Running an Exploit as a Background Job

- When we run an exploit, we can run it as a job by typing exploit -j. 

msf6 exploit(multi/handler) > exploit -j
[*] Exploit running as background job 0.
[*] Exploit completed, but no session was created.

[*] Started reverse TCP handler on 10.10.14.34:4444

 

2) Listing Running Jobs

- To list all running jobs, we can use the jobs -l command.

- To kill a specific job, use the 'kill {index no.}' command.

- Use the 'jobs -k' command to kill all running jobs.

msf6 exploit(multi/handler) > jobs -l

Jobs
====

 Id  Name                    Payload                    Payload opts
 --  ----                    -------                    ------------
 0   Exploit: multi/handler  generic/shell_reverse_tcp  tcp://10.10.14.34:4444