scapy学习笔记(4)简单的sniffing 嗅探-阿里云开发者社区

开发者社区> 小五义> 正文

scapy学习笔记(4)简单的sniffing 嗅探

简介: 转载请注明:@小五义:http://www.cnblogs/xiaowuyi       利用sniff命令进行简单的嗅探,可以抓到一些简单的包。当不指定接口时,将对每一个接口进行嗅探,当指定接口时,仅对该接口进行。
+关注继续查看

转载请注明:@小五义:http://www.cnblogs/xiaowuyi

      利用sniff命令进行简单的嗅探,可以抓到一些简单的包。当不指定接口时,将对每一个接口进行嗅探,当指定接口时,仅对该接口进行。

如;

>>> sniff(filter="icmp and host 61.135.169.125",count=2)

 

结果:

<Sniffed: TCP:0 UDP:0 ICMP:0 Other:0>

再比如对ppp0端口的嗅探:

>>> sniff(iface="ppp0",prn=lambda x:x.summary())

 

此时浏览一下百度,结果如下:

IP / UDP 27.214.219.76:53144 > 122.225.83.67:http / Raw
IP / UDP / DNS Qry "suggestion.baidu.com."
IP / UDP / DNS Qry "suggestion.baidu.com."
IP / UDP / DNS Ans "suggestion.a.shifen.com."
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http S
IP / UDP / DNS Ans "suggestion.a.shifen.com."
IP / ICMP / IPerror / UDPerror / DNS Ans "suggestion.a.shifen.com."
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 SA
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http A
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http PA / Raw
IP / UDP 122.225.83.67:http > 27.214.219.76:53144 / Raw
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 A
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 PA / Raw
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http A
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 PA / Raw
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http A
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http PA / Raw
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 A
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 PA / Raw
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http A
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 PA / Raw
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http A
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http S
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 SA
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http PA / Raw
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 PA / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 A / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 61.135.169.125:http > 27.214.219.76:45639 PA / Raw
IP / TCP 27.214.219.76:45639 > 61.135.169.125:http A
IP / TCP 27.214.219.76:55193 > 60.55.35.47:http S
IP / UDP / DNS Qry "t11.baidu.com."
IP / UDP / DNS Qry "t12.baidu.com."
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http S
IP / UDP / DNS Ans "image.jomodns.com."
IP / TCP 27.214.219.76:49797 > 119.188.9.119:http S
IP / TCP 27.214.219.76:49798 > 119.188.9.119:http S
IP / TCP 27.214.219.76:49799 > 119.188.9.119:http S
IP / UDP / DNS Ans "image.jomodns.com."
IP / TCP 27.214.219.76:39103 > 119.188.9.118:http S
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 SA
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 119.188.9.119:http > 27.214.219.76:49797 SA
IP / TCP 27.214.219.76:49797 > 119.188.9.119:http A
IP / TCP 119.188.9.119:http > 27.214.219.76:49798 SA
IP / TCP 27.214.219.76:49798 > 119.188.9.119:http A
IP / TCP 119.188.9.119:http > 27.214.219.76:49799 SA
IP / TCP 27.214.219.76:49799 > 119.188.9.119:http A
IP / TCP 60.55.35.47:http > 27.214.219.76:55193 SA
IP / TCP 27.214.219.76:55193 > 60.55.35.47:http A
IP / TCP 27.214.219.76:55193 > 60.55.35.47:http PA / Raw
IP / TCP 119.188.9.118:http > 27.214.219.76:39103 SA
IP / TCP 27.214.219.76:39103 > 119.188.9.118:http A
IP / TCP 60.55.35.47:http > 27.214.219.76:55193 A
IP / TCP 60.55.35.47:http > 27.214.219.76:55193 PA / Raw
IP / TCP 27.214.219.76:55193 > 60.55.35.47:http A
IP / TCP 27.214.219.76:55193 > 60.55.35.47:http PA / Raw
IP / TCP 27.214.219.76:49797 > 119.188.9.119:http PA / Raw
IP / TCP 27.214.219.76:49798 > 119.188.9.119:http PA / Raw
IP / TCP 27.214.219.76:49799 > 119.188.9.119:http PA / Raw
IP / TCP 27.214.219.76:39103 > 119.188.9.118:http PA / Raw
IP / TCP 27.214.219.76:38864 > 61.135.169.105:http S
IP / UDP / DNS Qry "a.baidu.com."
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http PA / Raw
IP / TCP 27.214.219.76:59062 > 119.188.9.40:http S
IP / TCP 27.214.219.76:59063 > 119.188.9.40:http S
IP / TCP 119.188.9.119:http > 27.214.219.76:49797 A
IP / TCP 119.188.9.119:http > 27.214.219.76:49797 PA / Raw
IP / TCP 27.214.219.76:49797 > 119.188.9.119:http A
IP / TCP 27.214.219.76:38867 > 61.135.169.105:http S
IP / TCP 119.188.9.119:http > 27.214.219.76:49798 A
IP / TCP 119.188.9.119:http > 27.214.219.76:49798 PA / Raw
IP / TCP 27.214.219.76:49798 > 119.188.9.119:http A
IP / TCP 119.188.9.119:http > 27.214.219.76:49799 A
IP / TCP 119.188.9.119:http > 27.214.219.76:49799 PA / Raw
IP / TCP 27.214.219.76:49799 > 119.188.9.119:http A
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http PA / Raw
IP / TCP 27.214.219.76:50355 > 61.135.185.194:http S
IP / UDP / DNS Qry "api.share.baidu.com."
IP / TCP 119.188.9.118:http > 27.214.219.76:39103 A
IP / TCP 119.188.9.118:http > 27.214.219.76:39103 PA / Raw
IP / TCP 27.214.219.76:39103 > 119.188.9.118:http A
IP / UDP / DNS Ans "asp.e.shifen.com."
IP / TCP 60.55.35.47:http > 27.214.219.76:55193 PA / Raw
IP / TCP 27.214.219.76:53605 > 123.125.114.38:http S
IP / TCP 27.214.219.76:53606 > 123.125.114.38:http S
IP / TCP 27.214.219.76:55193 > 60.55.35.47:http FA
IP / TCP 61.135.169.105:http > 27.214.219.76:38864 SA
IP / TCP 27.214.219.76:38864 > 61.135.169.105:http A
IP / TCP 27.214.219.76:38864 > 61.135.169.105:http PA / Raw
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 PA / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http PA / Raw
IP / TCP 119.188.9.40:http > 27.214.219.76:59062 SA
IP / TCP 27.214.219.76:59062 > 119.188.9.40:http A
IP / TCP 119.188.9.40:http > 27.214.219.76:59063 SA
IP / TCP 27.214.219.76:59063 > 119.188.9.40:http A
IP / TCP 61.135.169.105:http > 27.214.219.76:38867 SA
IP / TCP 27.214.219.76:38867 > 61.135.169.105:http A
IP / UDP / DNS Ans "api.share.n.shifen.com."
IP / TCP 27.214.219.76:47655 > 61.135.162.115:http S
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 A
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 PA / Raw
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http A
IP / TCP 123.125.114.101:http > 27.214.219.76:37968 PA / Raw
IP / TCP 27.214.219.76:37968 > 123.125.114.101:http A
IP / TCP 61.135.185.194:http > 27.214.219.76:50355 SA
IP / TCP 27.214.219.76:50355 > 61.135.185.194:http A
IP / TCP 27.214.219.76:50355 > 61.135.185.194:http PA / Raw
IP / TCP 123.125.114.38:http > 27.214.219.76:53605 SA
IP / TCP 27.214.219.76:53605 > 123.125.114.38:http A
IP / TCP 27.214.219.76:53605 > 123.125.114.38:http PA / Raw
IP / TCP 123.125.114.38:http > 27.214.219.76:53606 SA
IP / TCP 27.214.219.76:53606 > 123.125.114.38:http A
IP / TCP 61.135.169.105:http > 27.214.219.76:38864 A
IP / TCP 61.135.169.105:http > 27.214.219.76:38864 PA / Raw
IP / TCP 27.214.219.76:38864 > 61.135.169.105:http A
IP / TCP 61.135.169.105:http > 27.214.219.76:38864 PA / Raw
IP / TCP 27.214.219.76:38864 > 61.135.169.105:http A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 PA / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 61.135.162.115:http > 27.214.219.76:47655 SA
IP / TCP 27.214.219.76:47655 > 61.135.162.115:http A
IP / TCP 27.214.219.76:47655 > 61.135.162.115:http PA / Raw
IP / TCP 60.55.35.47:http > 27.214.219.76:55193 FA
IP / TCP 27.214.219.76:55193 > 60.55.35.47:http A
IP / TCP 61.135.185.194:http > 27.214.219.76:50355 A
IP / TCP 61.135.185.194:http > 27.214.219.76:50355 PA / Raw
IP / TCP 27.214.219.76:50355 > 61.135.185.194:http A
IP / TCP 123.125.114.38:http > 27.214.219.76:53605 A
IP / TCP 123.125.114.38:http > 27.214.219.76:53605 PA / Raw
IP / TCP 27.214.219.76:53605 > 123.125.114.38:http A
IP / TCP 61.135.162.115:http > 27.214.219.76:47655 A
IP / TCP 61.135.162.115:http > 27.214.219.76:47655 PA / Raw
IP / TCP 27.214.219.76:47655 > 61.135.162.115:http A
IP / UDP / DNS Qry "sclick.baidu.com."
IP / UDP / DNS Qry "c.baidu.com."
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http PA / Raw
IP / UDP / DNS Ans "s.a.shifen.com."
IP / TCP 27.214.219.76:47154 > 123.125.115.95:http S
IP / UDP / DNS Ans "c.e.shifen.com."
IP / TCP 27.214.219.76:56976 > 123.125.114.64:http S
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A / Raw
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 PA / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
IP / TCP 27.214.219.76:56977 > 123.125.114.64:http S
IP / TCP 27.214.219.76:47157 > 123.125.115.95:http S
IP / TCP 123.125.115.95:http > 27.214.219.76:47154 SA
IP / TCP 27.214.219.76:47154 > 123.125.115.95:http A
IP / TCP 27.214.219.76:47154 > 123.125.115.95:http PA / Raw
IP / TCP 123.125.114.64:http > 27.214.219.76:56976 SA
IP / TCP 27.214.219.76:56976 > 123.125.114.64:http A
IP / TCP 27.214.219.76:56976 > 123.125.114.64:http PA / Raw
IP / TCP 123.125.114.64:http > 27.214.219.76:56977 SA
IP / TCP 27.214.219.76:56977 > 123.125.114.64:http A
IP / TCP 123.125.115.95:http > 27.214.219.76:47157 SA
IP / TCP 27.214.219.76:47157 > 123.125.115.95:http A
IP / TCP 123.125.115.95:http > 27.214.219.76:47154 A
IP / TCP 123.125.115.95:http > 27.214.219.76:47154 PA / Raw
IP / TCP 27.214.219.76:47154 > 123.125.115.95:http A
IP / TCP 123.125.115.95:http > 27.214.219.76:47154 FA
IP / TCP 27.214.219.76:47154 > 123.125.115.95:http FA
IP / TCP 123.125.114.64:http > 27.214.219.76:56976 A
IP / TCP 123.125.114.64:http > 27.214.219.76:56976 PA / Raw
IP / TCP 27.214.219.76:56976 > 123.125.114.64:http A
IP / TCP 123.125.114.64:http > 27.214.219.76:56976 FA
IP / TCP 27.214.219.76:56976 > 123.125.114.64:http FA
IP / UDP / DNS Qry "trust.baidu.com."
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http PA / Raw
IP / TCP 123.125.115.95:http > 27.214.219.76:47154 A
IP / UDP / DNS Ans "trust.e.shifen.com."
IP / TCP 123.125.114.64:http > 27.214.219.76:56976 A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 A
IP / TCP 119.188.9.40:http > 27.214.219.76:59056 PA / Raw
IP / TCP 27.214.219.76:59056 > 119.188.9.40:http A
^C<Sniffed: TCP:208 UDP:20 ICMP:1 Other:0>

也要以用show()来显示:

>>> sniff(iface="ppp0",prn=lambda x:x.show())

部分结果:

###[ IP ]###
  version= 4L
  ihl= 5L
  tos= 0x0
  len= 40
  id= 52068
  flags= DF
  frag= 0L
  ttl= 64
  proto= tcp
  chksum= 0x8151
  src= 27.214.219.76
  dst= 61.135.185.112
  \options\
###[ TCP ]###
     sport= 59617
     dport= http
     seq= 3932617191L
     ack= 411565738
     dataofs= 5L
     reserved= 0L
     flags= FA
     window= 182
     chksum= 0xee34
     urgptr= 0
     options= {}
^C<Sniffed: TCP:1 UDP:0 ICMP:0 Other:0>

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
阿里云服务器怎么设置密码?怎么停机?怎么重启服务器?
如果在创建实例时没有设置密码,或者密码丢失,您可以在控制台上重新设置实例的登录密码。本文仅描述如何在 ECS 管理控制台上修改实例登录密码。
10092 0
阿里云服务器如何登录?阿里云服务器的三种登录方法
购买阿里云ECS云服务器后如何登录?场景不同,大概有三种登录方式:
2962 0
阿里云服务器ECS远程登录用户名密码查询方法
阿里云服务器ECS远程连接登录输入用户名和密码,阿里云没有默认密码,如果购买时没设置需要先重置实例密码,Windows用户名是administrator,Linux账号是root,阿小云来详细说下阿里云服务器远程登录连接用户名和密码查询方法
11633 0
阿里云服务器端口号设置
阿里云服务器初级使用者可能面临的问题之一. 使用tomcat或者其他服务器软件设置端口号后,比如 一些不是默认的, mysql的 3306, mssql的1433,有时候打不开网页, 原因是没有在ecs安全组去设置这个端口号. 解决: 点击ecs下网络和安全下的安全组 在弹出的安全组中,如果没有就新建安全组,然后点击配置规则 最后如上图点击添加...或快速创建.   have fun!  将编程看作是一门艺术,而不单单是个技术。
10886 0
阿里云服务器如何登录?阿里云服务器的三种登录方法
购买阿里云ECS云服务器后如何登录?场景不同,阿里云优惠总结大概有三种登录方式: 登录到ECS云服务器控制台 在ECS云服务器控制台用户可以更改密码、更换系.
13893 0
如何设置阿里云服务器安全组?阿里云安全组规则详细解说
阿里云安全组设置详细图文教程(收藏起来) 阿里云服务器安全组设置规则分享,阿里云服务器安全组如何放行端口设置教程。阿里云会要求客户设置安全组,如果不设置,阿里云会指定默认的安全组。那么,这个安全组是什么呢?顾名思义,就是为了服务器安全设置的。安全组其实就是一个虚拟的防火墙,可以让用户从端口、IP的维度来筛选对应服务器的访问者,从而形成一个云上的安全域。
7503 0
阿里云服务器ECS登录用户名是什么?系统不同默认账号也不同
阿里云服务器Windows系统默认用户名administrator,Linux镜像服务器用户名root
4510 0
阿里云ECS云服务器初始化设置教程方法
阿里云ECS云服务器初始化是指将云服务器系统恢复到最初状态的过程,阿里云的服务器初始化是通过更换系统盘来实现的,是免费的,阿里云百科网分享服务器初始化教程: 服务器初始化教程方法 本文的服务器初始化是指将ECS云服务器系统恢复到最初状态,服务器中的数据也会被清空,所以初始化之前一定要先备份好。
7365 0
+关注
小五义
长年从事网络安全、智能硬件安全及开发等相关工作,曾在国内核心期刊、Freebuf网站发表文章二十余篇,在博客园的博客排名前1000名。
105
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
《2021云上架构与运维峰会演讲合集》
立即下载
《零基础CSS入门教程》
立即下载
《零基础HTML入门教程》
立即下载