#!/usr/bin/env python
# -*- coding: utf-8 -*-
import commands
ip = '115.156.233.0-255'
mac = '40:8D:5C:E4:3A:E1'
results = commands.getoutput('sudo nmap -sP -n '+ip).split('\n')
for i, r in enumerate(results):
if mac in r:
dst = results[i-2].split(' ')[-1]
print "Found Machine"
with open('/home/duino/.ipaddress', 'w') as fid:
fid.write(dst)
print "Written to ~/.ipaddress"
Detect ip of mac using nmap
最新推荐文章于 2024-08-07 14:15:51 发布