get the mac address from ip address work only in linux system
1 2 3 4 5 6 7 8 | import os,re
file=open('/root/info.txt','w+')
r=raw_input('ip\n\r')
os.system('ping -c 1 '+r+' > /root/info.txt')
os.system("arp -a "+r+" | awk '{print $4}' > /root/info.txt")
data=file.read()
print data
|
How is this Python recipe?
You are using three different programs and Python just to read their output, while you should have used bash or else.
@zetah
It's an example of how to execute system commands in a Python script. This is useful for Python beginners, like myself. As they say, there is more than 1 way to skin a cat.
Code to extract MAC address frm raw text.(works on windows)