Säkerhet

Början på ett litet automatiserat mot-attack script

whatDoTheBadGuysHave.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import nmap
ip = '127.0.0.1'
tcpRange = '1-1024'
recon = nmap.PortScanner()
recon.scan(ip, tcpRange)
host = recon[ip]
 
if (host.state()=='up'):
    if host.has_key('tcp'):
        for port in host.all_tcp():
            print 'port '+str(port)+' found, state '+str(host['tcp'][port]['state'])
    else:
        print 'host appears to be up, but no open tcp ports'
else:
    print 'host appears to be down'
 
print 'whatDoTheBadGuysHave.py done'