Created
May 24, 2013 11:04
-
-
Save ffr4nz/5642744 to your computer and use it in GitHub Desktop.
List all Martian IPs, included the current broadcast address.
This file contains 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
#!/usr/bin/env python | |
from commands import * | |
import iptools | |
#Get broadcast IP (must choose the correct interface) | |
com="ifconfig eth0 | grep 'inet '| grep -v '127.0.0.1' | cut -d: -f3 | awk '{ print $1}'" | |
Bcast = getoutput(com) | |
#Declare IPTools objects | |
SRC_MARTIAN_IPS = iptools.IpRangeList( | |
'127. 0.0. 0/8', | |
'0. 0.0. 0', | |
'255. 255.255. 255', | |
('224. 0.0. 0','239. 255.255. 255'), | |
Bcast, | |
) | |
DST_MARTIAN_IPS = iptools.IpRangeList( | |
'127. 0.0 .0/8', | |
'0. 0.0. 0', | |
('224 .0.0. 0','239. 255.255. 255'), | |
) | |
for ip in SRC_MARTIAN_IPS: # Use each IP in scapy functions | |
print ip | |
for ip in DST_MARTIAN_IPS: # Use each IP in scapy functions | |
print ip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment