Created
January 8, 2020 22:50
-
-
Save Ricky-Wilson/74b44dbe16c2ab18d1518d7ae619989d to your computer and use it in GitHub Desktop.
Find and exploit netgear routers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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