Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This function gets the MAC address of a specified interface.
- def getmac(iface):
- data = commands.getoutput("ifconfig " + iface)
- words = data.split()
- found = 0
- for x in words:
- #print x
- if found != 0:
- mac = x
- break
- if x == "HWaddr":
- found = 1
- if len(mac) == 0:
- mac = 'Mac not found'
- mac = mac[:17]
- print mac
- ##### FOR THE ARP SCANNER/SYN SCANNER #####
- # Function: Get Gateway
- def get_default_gateway_linux():
- """Read the default gateway directly from /proc."""
- with open("/proc/net/route") as fh: # Opens the /proc/net/route interface
- for line in fh:
- fields = line.strip().split() # splitting shit
- if fields[1] != '00000000' or not int(fields[3], 16) & 2: # checking data
- continue
- return socket.inet_ntoa(struct.pack("<L", int(fields[2], 16))) # spits out the gateway!
- # Function: makerange(), gets gateway, returns the range
- def makerange(gwaddr):
- SIP=gwaddr.split('.') # Splits the IP address of the gateway
- iprange = SIP[0] + '.' + SIP[1] + '.' + SIP[2] + '.0/24' # makes a new one that is the range
- return iprange
- # Defines variable scanrange for scanner
- scanrange = makerange(gwaddr)
- # Faster ARP scanner. outputs list of MAC:IP as per old scanner
- print(arping(scanrange))
- ##### GET MORE SYSTEMINFO #####
- # Gets meminfo and cpuinfo, outputs to files
- getsysteminfo():
- os.popen("cat /proc/cpuinfo > /tmp/cpuinfo.txt")
- os.popen("cat /proc/meminfo > /tmp/meminfo.txt")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement