Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

Organizing Nmap files

aw-junaidcff6a2786f89
diff --git a/Nmap/Nmap Commands/10 most important command of nmap.md b/Nmap/Nmap Commands/10 most important command of nmap.md
new file mode 100644
index 0000000..517ecd1
--- /dev/null
+++ b/Nmap/Nmap Commands/10 most important command of nmap.md
@@ -0,0 +1,31 @@
+Here are the 10 most important commands of Nmap, along with a full explanation for each:
+
+1. Scan a single host: `nmap <host>`
+ This command will perform a scan on a single host, specified by its IP address or hostname. By default, Nmap will perform a basic scan of the 1000 most common ports.
+
+2. Scan a range of IP addresses: `nmap <start IP>-<end IP>`
+ This command will perform a scan on a range of IP addresses, specified by the starting and ending IP addresses. For example, `nmap 192.168.1.1-10` will scan IP addresses from 192.168.1.1 to 192.168.1.10.
+
+3. Scan a subnet: `nmap <subnet>`
+ This command will perform a scan on a whole subnet, specified by the IP address and subnet mask. For example, `nmap 192.168.1.0/24` will scan all IP addresses on the 192.168.1.0 subnet.
+
+4. Scan a list of hosts: `nmap -iL <list>`
+ This command will perform a scan on a list of hosts, specified by a text file containing one IP address or hostname per line. For example, `nmap -iL targets.txt` will scan all hosts listed in the file `targets.txt`.
+
+5. Perform a fast scan: `nmap -F <host>`
+ This command will perform a fast scan on a host, scanning only the 100 most common ports. This can be useful for quickly identifying open ports and potential vulnerabilities.
+
+6. Perform a more thorough scan: `nmap -sS <host>`
+ This command will perform a more thorough scan on a host, using the TCP SYN scan technique. This technique is faster and less detectable than the default TCP connect scan.
+
+7. Perform a TCP SYN scan: `nmap -sS <host>`
+ This command will perform a scan using the TCP SYN technique, which sends a SYN packet to each port and waits for a response. This can be useful for stealthy scanning and can often bypass firewalls and intrusion detection systems.
+
+8. Perform a UDP scan: `nmap -sU <host>`
+ This command will perform a scan using the UDP protocol, which is commonly used for services such as DNS and DHCP. UDP scans can be slower and less reliable than TCP scans, but can often uncover additional open ports.
+
+9. Scan for specific ports: `nmap -p <port(s)> <host>`
+ This command will perform a scan on specific ports, specified by a comma-separated list of port numbers or ranges. For example, `nmap -p 80,443,8080 192.168.1.1` will scan for open ports 80, 443, and 8080 on the host 192.168.1.1.
+
+10. Scan all ports: `nmap -p- <host>`
+ This command will perform a scan on all ports (1-65535) of a host. This can take a long time to complete, but can be useful for discovering hidden or lesser-known services.
diff --git a/Nmap/Nmap Commands/how to use nmap.md b/Nmap/Nmap Commands/how to use nmap.md
new file mode 100644
index 0000000..58ca0db
--- /dev/null
+++ b/Nmap/Nmap Commands/how to use nmap.md
@@ -0,0 +1,25 @@
+
+
+Nmap (Network Mapper) is a powerful tool for network exploration and security auditing. Here are some basic steps to use Nmap:
+
+1. Install Nmap: Nmap is usually pre-installed on many Linux distributions, but if you are on Windows or macOS, you need to download and install it from the official website.
+
+2. Determine your target: You need to specify the target IP address or range of IP addresses that you want to scan. For example, you could use a single IP address (e.g., 192.168.1.1) or a range of IP addresses (e.g., 192.168.1.1-100).
+
+3. Run a basic scan: To perform a basic scan, use the following command:
+
+ ```
+ nmap <target>
+ ```
+
+ For example, if your target is 192.168.1.1, you would run the following command:
+
+ ```
+ nmap 192.168.1.1
+ ```
+
+4. Analyze the results: Once the scan is complete, Nmap will provide a list of open ports, operating systems, and other information about the target. This information can be used to identify potential vulnerabilities in the target.
+
+5. Use additional options: Nmap offers a wide range of options to customize your scan. For example, you can specify the type of scan (e.g., TCP or UDP), the port range, and the timing of the scan. You can find more information on the available options in the Nmap documentation.
+
+6. Practice good security hygiene: It's important to remember that Nmap is a powerful tool that can be used for both good and bad purposes. Always obtain permission from the owner of the network before scanning and use Nmap only for legitimate security purposes.
diff --git a/Nmap/Nmap Commands/what is nmap.md b/Nmap/Nmap Commands/what is nmap.md
new file mode 100644
index 0000000..30a51c4
--- /dev/null
+++ b/Nmap/Nmap Commands/what is nmap.md
@@ -0,0 +1,8 @@
+
+
+
+Nmap (Network Mapper) is a free and open-source network exploration and security auditing tool. It is used to discover hosts and services on a computer network, thus creating a "map" of the network. Nmap is designed to be a versatile tool that can be used for a variety of tasks, including network inventory, monitoring, and vulnerability assessment.
+
+Nmap uses a variety of scanning techniques to identify hosts and services, such as ping scans, port scans, and version detection. It can also be used to fingerprint operating systems and detect software vulnerabilities. Nmap can be used from a command line interface or through a graphical user interface (GUI) such as Zenmap.
+
+Nmap is widely used by security professionals, system administrators, and network engineers to secure and maintain their computer networks. Its flexibility and extensive feature set make it a powerful tool for network exploration and vulnerability assessment.
diff --git a/Nmap/Python Scripts/NmapScanner.py b/Nmap/Python Scripts/NmapScanner.py
new file mode 100644
index 0000000..01cc394
--- /dev/null
+++ b/Nmap/Python Scripts/NmapScanner.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python3
+
+import optparse
+import nmap
+
+class NmapScanner:
+
+ def __init__(self):
+ self.portScanner = nmap.PortScanner()
+
+ def nmapScan(self, ip_address, port):
+ self.portScanner.scan(ip_address, port)
+ self.state = self.portScanner[ip_address]['tcp'][int(port)]['state']
+ print(" [+] Executing command: ", self.portScanner.command_line())
+ print(" [+] "+ ip_address + " tcp/" + port + " " + self.state)
+
+def main():
+ parser = optparse.OptionParser("usage%prog " + "--ip_address <target ip address> --ports <target port>")
+ parser.add_option('--ip_address', dest = 'ip_address', type = 'string', help = 'Please, specify the target ip address.')
+ parser.add_option('--ports', dest = 'ports', type = 'string', help = 'Please, specify the target port(s) separated by comma.')
+ (options, args) = parser.parse_args()
+ if (options.ip_address == None) | (options.ports == None):
+ print('[-] You must specify a target ip_address and a target port(s).')
+ exit(0)
+ ip_address = options.ip_address
+ ports = options.ports.split(',')
+
+ for port in ports:
+ NmapScanner().nmapScan(ip_address, port)
+
+if __name__ == "__main__":
+ main()
diff --git a/Nmap/Python Scripts/NmapScannerAsync.py b/Nmap/Python Scripts/NmapScannerAsync.py
new file mode 100644
index 0000000..cd640a8
--- /dev/null
+++ b/Nmap/Python Scripts/NmapScannerAsync.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python3
+
+import nmap
+import argparse
+
+def callbackResult(host, scan_result):
+ #print(host, scan_result)
+ port_state = scan_result['scan'][host]['tcp']
+ print("Command line:"+ scan_result['nmap']['command_line'])
+ for key, value in port_state.items():
+ print('Port {0} --> {1}'.format(key, value))
+
+class NmapScannerAsync:
+ def __init__(self):
+ self.portScannerAsync = nmap.PortScannerAsync()
+
+ def scanning(self):
+ while self.portScannerAsync.still_scanning():
+ print("Scanning >>>")
+ self.portScannerAsync.wait(5)
+
+ def nmapScanAsync(self, hostname, port):
+ try:
+ print("Checking port "+ port +" ..........")
+ self.portScannerAsync.scan(hostname, arguments="-A -sV -p"+port ,callback=callbackResult)
+ self.scanning()
+ except Exception as exception:
+ print("Error to connect with " + hostname + " for port scanning",str(exception))
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description='Asynchronous Nmap scanner')
+ parser.add_argument("--host", dest="host", help="target IP / domain", required=True)
+ parser.add_argument("-ports", dest="ports", help="Please, specify the target port(s) separated by comma[80,8080 by default]", default="80,8080")
+ parsed_args = parser.parse_args()
+ port_list = parsed_args.ports.split(',')
+ host = parsed_args.host
+ for port in port_list:
+ NmapScannerAsync().nmapScanAsync(host, port)
diff --git a/Nmap/Python Scripts/NmapScannerAsyncFTP.py b/Nmap/Python Scripts/NmapScannerAsyncFTP.py
new file mode 100644
index 0000000..b61d550
--- /dev/null
+++ b/Nmap/Python Scripts/NmapScannerAsyncFTP.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python3
+
+import nmap
+import argparse
+
+def callbackFTP(host, result):
+ try:
+ script = result['scan'][host]['tcp'][21]['script']
+ print("Command line"+ result['nmap']['command_line'])
+ for key, value in script.items():
+ print('Script {0} --> {1}'.format(key, value))
+ except KeyError:
+ pass
+
+
+class NmapScannerAsyncFTP:
+ def __init__(self):
+ self.portScanner = nmap.PortScanner()
+ self.portScannerAsync = nmap.PortScannerAsync()
+
+ def scanning(self):
+ while self.portScannerAsync.still_scanning():
+ print("Scanning >>>")
+ self.portScannerAsync.wait(10)
+
+ def nmapScanAsync(self, hostname, port):
+ try:
+ print("Checking port "+ port +" ..........")
+ self.portScanner.scan(hostname, port)
+ self.state = self.portScanner[hostname]['tcp'][int(port)]['state']
+ print(" [+] "+ hostname + " tcp/" + port + " " + self.state)
+ #checking FTP service
+ if (port=='21') and self.portScanner[hostname]['tcp'][int(port)]['state']=='open':
+ print('Checking ftp port with nmap scripts......')
+ print('Checking ftp-anon.nse .....')
+ self.portScannerAsync.scan(hostname,arguments="-A -sV -p21 --script ftp-anon.nse",callback=callbackFTP)
+ self.scanning()
+ print('Checking ftp-bounce.nse .....')
+ self.portScannerAsync.scan(hostname,arguments="-A -sV -p21 --script ftp-bounce.nse",callback=callbackFTP)
+ self.scanning()
+ print('Checking ftp-libopie.nse .....')
+ self.portScannerAsync.scan(hostname,arguments="-A -sV -p21 --script ftp-libopie.nse",callback=callbackFTP)
+ self.scanning()
+ print('Checking ftp-proftpd-backdoor.nse .....')
+ self.portScannerAsync.scan(hostname,arguments="-A -sV -p21 --script ftp-proftpd-backdoor.nse",callback=callbackFTP)
+ self.scanning()
+ print('Checking ftp-vsftpd-backdoor.nse .....')
+ self.portScannerAsync.scan(hostname,arguments="-A -sV -p21 --script ftp-vsftpd-backdoor.nse",callback=callbackFTP)
+ self.scanning()
+
+ except Exception as exception:
+ print("Error to connect with " + hostname + " for port scanning",str(exception))
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description='Nmap scanner async')
+ parser.add_argument("--host", dest="host", help="target IP / domain", required=True)
+ parser.add_argument("--ports", dest="ports", help="Please, specify the target port(s) separated by comma[80,8080 by default]", default="21")
+ parsed_args = parser.parse_args()
+ port_list = parsed_args.ports.split(',')
+ ip_address = parsed_args.host
+ for port in port_list:
+ NmapScannerAsyncFTP().nmapScanAsync(ip_address, port)
+
diff --git a/Nmap/Python Scripts/NmapScannerCSV.py b/Nmap/Python Scripts/NmapScannerCSV.py
new file mode 100644
index 0000000..679cf9f
--- /dev/null
+++ b/Nmap/Python Scripts/NmapScannerCSV.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+
+import optparse
+import nmap
+import csv
+
+class NmapScannerCSV:
+
+ def __init__(self):
+ self.portScanner = nmap.PortScanner()
+
+ def nmapScanCSV(self, host, ports):
+ try:
+ print("Checking ports "+ str(ports) +" ..........")
+ self.portScanner.scan(host, arguments='-n -p'+ports)
+
+ print("[*] Executing command: %s" % self.portScanner.command_line())
+
+ print(self.portScanner.csv())
+
+ print("Summary for host",host)
+
+ with open('csv_file.csv', mode='w') as csv_file:
+ csv_writer = csv.writer(csv_file, delimiter=',')
+ csv_writer.writerow(['Host', 'Protocol', 'Port', 'State'])
+
+ for x in self.portScanner.csv().split("\n")[1:-1]:
+ splited_line = x.split(";")
+ host = splited_line[0]
+ protocol = splited_line[5]
+ port = splited_line[4]
+ state = splited_line[6]
+ print("Protocol:",protocol,"Port:",port,"State:",state)
+ csv_writer.writerow([host, protocol, port, state])
+
+ except Exception as exception:
+ print("Error to connect with " + host + " for port scanning" ,exception)
+
+def main():
+ parser = optparse.OptionParser("usage%prog " + "--host <target host> --ports <target port>")
+ parser.add_option('--host', dest = 'host', type = 'string', help = 'Please, specify the target host.')
+ parser.add_option('--ports', dest = 'ports', type = 'string', help = 'Please, specify the target port(s) separated by comma.')
+ (options, args) = parser.parse_args()
+ if (options.host == None) | (options.ports == None):
+ print('[-] You must specify a target host and a target port(s).')
+ exit(0)
+ host = options.host
+ ports = options.ports
+
+ NmapScannerCSV().nmapScanCSV(host,ports)
+
+if __name__ == "__main__":
+ main()
diff --git a/Nmap/Python Scripts/Nmap_port_scanner.py b/Nmap/Python Scripts/Nmap_port_scanner.py
new file mode 100644
index 0000000..7ad333d
--- /dev/null
+++ b/Nmap/Python Scripts/Nmap_port_scanner.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import nmap
+
+portScanner = nmap.PortScanner()
+
+host_scan = input('Host scan: ')
+
+portlist="21,22,23,25,80"
+portScanner.scan(hosts=host_scan, arguments='-n -p'+portlist)
+
+print(portScanner.command_line())
+
+hosts_list = [(x, portScanner[x]['status']['state']) for x in portScanner.all_hosts()]
+for host, status in hosts_list:
+ print(host, status)
+
+for protocol in portScanner[host].all_protocols():
+ print('Protocol : %s' % protocol)
+ listport = portScanner[host]['tcp'].keys()
+ for port in listport:
+ print('Port : %s State : %s' % (port,portScanner[host][protocol][port]['state']))
+
diff --git a/Nmap/Python Scripts/PortScannerAsync.py b/Nmap/Python Scripts/PortScannerAsync.py
new file mode 100644
index 0000000..e1c0153
--- /dev/null
+++ b/Nmap/Python Scripts/PortScannerAsync.py
@@ -0,0 +1,15 @@
+import nmap
+
+portScannerAsync = nmap.PortScannerAsync()
+
+def callback_result(host, scan_result):
+ print(host, scan_result)
+
+portScannerAsync.scan(hosts='scanme.nmap.org', arguments='-p 21', callback=callback_result)
+portScannerAsync.scan(hosts='scanme.nmap.org', arguments='-p 22', callback=callback_result)
+portScannerAsync.scan(hosts='scanme.nmap.org', arguments='-p 23', callback=callback_result)
+portScannerAsync.scan(hosts='scanme.nmap.org', arguments='-p 80', callback=callback_result)
+
+while portScannerAsync.still_scanning():
+ print("Scanning >>>")
+ portScannerAsync.wait(5)
diff --git a/Nmap/Python Scripts/csv_file.csv b/Nmap/Python Scripts/csv_file.csv
new file mode 100644
index 0000000..7cf1ce8
--- /dev/null
+++ b/Nmap/Python Scripts/csv_file.csv
@@ -0,0 +1,6 @@
+Host,Protocol,Port,State
+45.33.32.156,ftp,21,closed
+45.33.32.156,ssh,22,open
+45.33.32.156,telnet,23,closed
+45.33.32.156,smtp,25,closed
+45.33.32.156,http,80,open
diff --git a/Nmap/Python Scripts/nmap_operating_system.py b/Nmap/Python Scripts/nmap_operating_system.py
new file mode 100644
index 0000000..5c28426
--- /dev/null
+++ b/Nmap/Python Scripts/nmap_operating_system.py
@@ -0,0 +1,30 @@
+
+import nmap, sys
+
+command="OS_detection.py <hostname/IP address>"
+
+if len(sys.argv) == 1:
+ print(command)
+ sys.exit()
+
+host = sys.argv[1]
+
+portScanner = nmap.PortScanner()
+open_ports_dict = portScanner.scan(host, arguments="-O -v")
+
+if open_ports_dict is not None:
+ open_ports_dict = open_ports_dict.get("scan").get(host).get("tcp")
+
+ print("Open ports Description")
+ port_list = open_ports_dict.keys()
+ for port in port_list:
+ print(port, "---\t-->",open_ports_dict.get(port)['name'])
+
+ print("\n--------------OS details---------------------\n")
+ #print(portScanner[host])
+ print("Details about the scanned host are: \t", portScanner[host]['osmatch'][0]['osclass'][0]['cpe'])
+ print("Operating system family is: \t\t", portScanner[host]['osmatch'][0]['osclass'][0]['osfamily'])
+ print("Type of OS is: \t\t\t\t", portScanner[host]['osmatch'][0]['osclass'][0]['type'])
+ print("Generation of Operating System :\t", portScanner[host]['osmatch'][0]['osclass'][0]['osgen'])
+ print("Operating System Vendor is:\t\t", portScanner[host]['osmatch'][0]['osclass'][0]['vendor'])
+ print("Accuracy of detection is:\t\t", portScanner[host]['osmatch'][0]['osclass'][0]['accuracy'])
diff --git a/Nmap/Python Scripts/nmap_os.py b/Nmap/Python Scripts/nmap_os.py
new file mode 100644
index 0000000..431147b
--- /dev/null
+++ b/Nmap/Python Scripts/nmap_os.py
@@ -0,0 +1,5 @@
+import os
+
+nmap_command="nmap -sT 127.0.0.1"
+
+os.system(nmap_command)
diff --git a/Nmap/Python Scripts/nmap_subprocess.py b/Nmap/Python Scripts/nmap_subprocess.py
new file mode 100644
index 0000000..fa4b829
--- /dev/null
+++ b/Nmap/Python Scripts/nmap_subprocess.py
@@ -0,0 +1,5 @@
+from subprocess import Popen, PIPE
+
+process = Popen(['nmap','-O','127.0.0.1'], stdout=PIPE, stderr=PIPE)
+stdout, stderr = process.communicate()
+print(stdout.decode())