python中的数据包处理模块scapy调研笔记
生活随笔
收集整理的這篇文章主要介紹了
python中的数据包处理模块scapy调研笔记
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Scapy簡介
Scapy的是一個強大的交互式數(shù)據(jù)包處理程序(使用python編寫)。它能夠偽造或者解碼大量的網(wǎng)絡(luò)協(xié)議數(shù)據(jù)包,能夠發(fā)送、捕捉、匹配請求和回復(fù)包等等。它可以很容易地處理一些典型操作,比如端口掃描,tracerouting,探測,單元測試,攻擊或網(wǎng)絡(luò)發(fā)現(xiàn)(可替代hping,NMAP,arpspoof,ARP-SK,arping,tcpdump,tethereal,P0F等)。最重要的他還有很多更優(yōu)秀的特性——發(fā)送無效數(shù)據(jù)幀、注入修改的802.11數(shù)據(jù)幀、在WEP上解碼加密通道(VOIP)、ARP緩存攻擊(VLAN)等,這也是其他工具無法處理完成的。
Scapy is a Python program that enables the user to send, sniff and dissect and forge network packets. This capability allows construction of tools that can probe, scan or attack networks.
sniff 嗅探
dissect 解剖
forge ?偽造
fingerprinting ?指紋識別
安裝方法
模塊官網(wǎng)
https://pypi.python.org/pypi/scapy
目前最新版本號是2.3.2
wget 'https://pypi.python.org/packages/source/s/scapy/scapy-2.3.2.tar.gz#md5=b8ca06ca3b475bd01ba6cf5cdc5619af'
tar zxvf scapy-2.3.2.tar.gz
cd scapy-2.3.2
python setup.py install
然后在命令行確認(rèn)下:
import scapy
from scapy.all import *
conf
查看是否有錯誤,然后運行參考文獻[1]中的例子?
另外在ubuntu上需要額外安裝標(biāo)準(zhǔn)依賴包
sudo apt-get install tcpdump graphviz imagemagick python-gnuplot python-crypto python-pyx
/符號表示兩個鏈路層的組合
>>>> IP()/TCP()
>>>> IP()/TCP()/"GET /HTTP/1.0\r\n\r\n" ? ? 數(shù)據(jù)部分可以直接使用字符串?
Run Scapy with root priviledges.
In Scapy v2 use from scapy.all import * instead of from scapy import *.
in Python _ (underscore) is the latest result
The sendp() function will work at layer 2. It’s up to you to choose the right interface and the right link layer protocol.
正確的使用方法
sudo scapy
進入scapy交互環(huán)境,輸入quit()退出并返回shell命令行環(huán)境
查看某個函數(shù)的具體用法
help(sniff)
參考文獻
[1].http://www.cnblogs.com/xiaowuyi/p/3329795.html
[2].http://blog.csdn.net/wang_walfred/article/details/40044141 ?非常重要,對各函數(shù)的解釋非常詳細(xì)
[3].http://blog.csdn.net/wang_walfred/article/details/40072751 ? 非常精彩
[4].http://www.secdev.org/projects/scapy/doc/installation.html ? 官網(wǎng)安裝文檔
[5].http://www.secdev.org/projects/scapy/doc/usage.html ?詳見用法說明,非常詳細(xì)
Scapy的是一個強大的交互式數(shù)據(jù)包處理程序(使用python編寫)。它能夠偽造或者解碼大量的網(wǎng)絡(luò)協(xié)議數(shù)據(jù)包,能夠發(fā)送、捕捉、匹配請求和回復(fù)包等等。它可以很容易地處理一些典型操作,比如端口掃描,tracerouting,探測,單元測試,攻擊或網(wǎng)絡(luò)發(fā)現(xiàn)(可替代hping,NMAP,arpspoof,ARP-SK,arping,tcpdump,tethereal,P0F等)。最重要的他還有很多更優(yōu)秀的特性——發(fā)送無效數(shù)據(jù)幀、注入修改的802.11數(shù)據(jù)幀、在WEP上解碼加密通道(VOIP)、ARP緩存攻擊(VLAN)等,這也是其他工具無法處理完成的。
Scapy is a Python program that enables the user to send, sniff and dissect and forge network packets. This capability allows construction of tools that can probe, scan or attack networks.
sniff 嗅探
dissect 解剖
forge ?偽造
fingerprinting ?指紋識別
安裝方法
模塊官網(wǎng)
https://pypi.python.org/pypi/scapy
目前最新版本號是2.3.2
wget 'https://pypi.python.org/packages/source/s/scapy/scapy-2.3.2.tar.gz#md5=b8ca06ca3b475bd01ba6cf5cdc5619af'
tar zxvf scapy-2.3.2.tar.gz
cd scapy-2.3.2
python setup.py install
然后在命令行確認(rèn)下:
import scapy
from scapy.all import *
conf
查看是否有錯誤,然后運行參考文獻[1]中的例子?
另外在ubuntu上需要額外安裝標(biāo)準(zhǔn)依賴包
sudo apt-get install tcpdump graphviz imagemagick python-gnuplot python-crypto python-pyx
/符號表示兩個鏈路層的組合
>>>> IP()/TCP()
>>>> IP()/TCP()/"GET /HTTP/1.0\r\n\r\n" ? ? 數(shù)據(jù)部分可以直接使用字符串?
Run Scapy with root priviledges.
In Scapy v2 use from scapy.all import * instead of from scapy import *.
in Python _ (underscore) is the latest result
The sendp() function will work at layer 2. It’s up to you to choose the right interface and the right link layer protocol.
正確的使用方法
sudo scapy
進入scapy交互環(huán)境,輸入quit()退出并返回shell命令行環(huán)境
查看某個函數(shù)的具體用法
help(sniff)
參考文獻
[1].http://www.cnblogs.com/xiaowuyi/p/3329795.html
[2].http://blog.csdn.net/wang_walfred/article/details/40044141 ?非常重要,對各函數(shù)的解釋非常詳細(xì)
[3].http://blog.csdn.net/wang_walfred/article/details/40072751 ? 非常精彩
[4].http://www.secdev.org/projects/scapy/doc/installation.html ? 官網(wǎng)安裝文檔
[5].http://www.secdev.org/projects/scapy/doc/usage.html ?詳見用法說明,非常詳細(xì)
總結(jié)
以上是生活随笔為你收集整理的python中的数据包处理模块scapy调研笔记的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python中的random模块学习
- 下一篇: 在Ubuntu 14.04 64bit上