Skip to content

Instantly share code, notes, and snippets.

@deadbits
Created February 25, 2012 03:14
Show Gist options
  • Save deadbits/1905613 to your computer and use it in GitHub Desktop.
Save deadbits/1905613 to your computer and use it in GitHub Desktop.
new get local IP and range
#!/usr/bin/python
from scapy.all import *
localIP = [x[4] for x in scapy.all.conf.route.routes if x[2] != '0.0.0.0'][0]
splitIP = localIP.split('.')
splitIP[3:] = (['0/24'])
IPRange = ".".join(splitIP)
print IPRange
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment