Output to a file

If we are scanning multiple IP addresses, we probably want to save the output to a file for later reference. Although Nmap has many ways and formats in which to save the output, I prefer the output normal (-oN) switch.

Simply add the -oN switch at the end of the command with the name of the file you want to save the output to. Here, I have used a file named portscan.txt.

Type nmap -sS 192.168.10.70 -oN portscan:

When I run the command, I get the same output displayed in the preceding screenshot, but I also get that output saved to a file. I can view the contents of that file by using the cat, more, and less commands. Here I have used the cat command. Type cat portscan.txt:

As you can see, the output that always appears on the screen with an Nmap scan is now saved to a file for later reference and for the sake of record-keeping.

Next, we will demonstrate a lab using Metasploit. Now that we know how to scan a network using tools such as Nmap, we can use that information to send a payload to a victim. The following lab uses Kali Linux and Windows Server 2012 for this demonstration. We recommend running this lab using virtual machines if you wish to follow along.

Open your terminal (CTRL + ALT + T) and type msfvenom -h to view the available options for this Tool:

I think the information provided in this screenshot makes the use of msfvenom pretty clear.

In this lab, I want to create an exploit generated by msfvenom with a meterpreter payload, and I also want to encode it using the shikata_ga_nai encoder. To get to know the available options to set up this exploit, you can use --payload-options after you set up your payload:

Yep, there it is. We need to set up the LHOST and LPORT to make this exploit work. My IP address is 192.168.10.50, so I set the LHOST to that IP. I also want to set the LPORT to 8080 so that I will receive a connection from the victim on port 8080 if the exploit succeeds:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.192.79