Skip to content

Commit 856af36

Browse files
authored
Update proxyCannon.py
Added stability for rotating IP's
1 parent 264df86 commit 856af36

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

proxyCannon.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ def cleanup(signal, frame):
7777
print "\n"
7878
success("Roger that! Shutting down...")
7979

80+
if args.v:
81+
print 'In debug mode. Press enter to continue.'
82+
null = raw_input()
83+
8084
# Connect to EC2 and return list of reservations
8185
try:
8286
success("Connecting to Amazon's EC2...")
@@ -444,6 +448,13 @@ def rotate_hosts():
444448
# Provision interface
445449
os.system("ifconfig tun%s 10.%s.254.2 netmask 255.255.255.252" % (address_to_tunnel[str(host)], address_to_tunnel[str(host)]))
446450
debug("Assinging interface tun" + address_to_tunnel[str(host)] + " ip of 10." + address_to_tunnel[str(host)] + ".254.2")
451+
time.sleep(2)
452+
453+
# Adding local route (shoudlnt be needed)
454+
debug("Adding static route 10." + address_to_tunnel[str(host)] + ".254.0/30 via dev tun" + address_to_tunnel[str(host)])
455+
route_cmd = 'ip route add 10.' + address_to_tunnel[str(host)] + '.254.0/30 via 0.0.0.0 dev tun' + address_to_tunnel[str(host)] + ' proto kernel scope link src 10.' + address_to_tunnel[str(host)] + '.254.2'
456+
debug('SHELL CMD: ' + route_cmd)
457+
os.system(route_cmd)
447458

448459
# Allow connections to our proxy servers themselves
449460
os.system("iptables -t nat -I POSTROUTING -d %s -j RETURN" % swapped_ip)
@@ -864,6 +875,14 @@ def get_default_gateway_linux():
864875
# Provision interface
865876
os.system("ifconfig tun%s 10.%s.254.2 netmask 255.255.255.252" % (interface, interface))
866877
debug("Assinging interface tun" + str(interface) + " ip of 10." + str(interface) + ".254.2")
878+
time.sleep(2)
879+
880+
# Adding local route (shoudlnt be needed)
881+
debug("Adding static route 10." + str(interface) + ".254.0/30 via dev tun" + str(interface))
882+
route_cmd = 'ip route add 10.' + str(interface) + '.254.0/30 via 0.0.0.0 dev tun' + str(interface) + ' proto kernel scope link src 10.' + str(interface) + '.254.2'
883+
debug('SHELL CMD: ' + route_cmd)
884+
os.system(route_cmd)
885+
867886
interface = interface +1
868887

869888
# add entry to table
@@ -913,8 +932,6 @@ def get_default_gateway_linux():
913932
os.system("ip route add 172.16.0.0/16 via %s dev %s > /dev/null 2>&1" % (defaultgateway, args.interface))
914933
os.system("ip route add 10.0.0.0/8 via %s dev %s > /dev/null 2>&1" % (defaultgateway, args.interface))
915934

916-
# Remove existing default route
917-
os.system("ip route del default")
918935
# Replace with our own new default route
919936
os.system("%s" % nexthopcmd)
920937
debug("SHELL CMD: " + nexthopcmd)

0 commit comments

Comments
 (0)