• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

异度空间

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

使用Python扫描网络MAC地址对应的IP地址

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from scapy.all import srp,Ether,ARP,conf
ipscan='192.168.200.1/24'
try:
	    ans,unans = srp(Ether(dst="FF:FF:FF:FF:FF:FF")/ARP(pdst=ipscan),timeout=2,verbose=False)
except Exception,e:
	print str(e)
else:
	for snd,rcv in ans:
		#list_mac=rcv.sprintf("%Ether.src% - %ARP.psrc%")
		#print list_mac
		strmac = rcv.sprintf("%Ether.src%")
		if strmac == 'b8:27:eb:0e:ea:a5':
			strip = rcv.sprintf("%ARP.psrc%")
			print strip

  

posted on 2015-08-31 22:17  madlas  阅读(1255)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3