Skip to content

Instantly share code, notes, and snippets.

@Ricky-Wilson
Created January 8, 2020 22:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ricky-Wilson/74b44dbe16c2ab18d1518d7ae619989d to your computer and use it in GitHub Desktop.
Save Ricky-Wilson/74b44dbe16c2ab18d1518d7ae619989d to your computer and use it in GitHub Desktop.
Find and exploit netgear routers
import nmap
# initialize the port scanner
nmScan = nmap.PortScanner()
# scan localhost for ports in range 21-443
nmScan.scan('127.0.0.1', '21-443')
# run a loop to print all the found result about the ports
for host in nmScan.all_hosts():
print('Host : %s (%s)' % (host, nmScan[host].hostname()))
print('State : %s' % nmScan[host].state())
for proto in nmScan[host].all_protocols():
print('----------')
print('Protocol : %s' % proto)
lport = nmScan[host][proto].keys()
lport.sort()
for port in lport:
print ('port : %s\tstate : %s' % (port, nmScan[host][proto][port]['state'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment