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 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
Description: Support for python3
Update dhcpig source code to support Python3 syntax constraints
Author: Philippe THIERRY <phiou@debian.org>
Bug: https://bugs.debian.org/940604
--- a/pig.py
+++ b/pig.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
enhanced DHCP exhaustion attack.
@@ -156,9 +156,9 @@
"neighbors-attack-release", "neighbors-attack-garp",
"fuzz","ipv6","client-src=","color","v6-rapid-commit",
"verbosity=","threads=", "show-lease-confirm","request-options="])
- except getopt.GetoptError, err:
+ except getopt.GetoptError as err:
# print help information and exit:
- print str(err) # will print something like "option -a not recognized"
+ print(str(err)) # will print something like "option -a not recognized"
usage()
sys.exit(2)
for o,a in opts:
@@ -209,7 +209,7 @@
if len(x) == 2:
REQUEST_OPTS += range(int(x[0]),int(x[1]))
else:
- print "Error in option - request-options"
+ print("Error in option - request-options")
usage()
exit()
else:
@@ -227,7 +227,7 @@
sys.exit(2)
if conf.verb:
- print """---------------------[OPTIONS]-----------
+ print("""---------------------[OPTIONS]-----------
IPv6 %s
fuzz %s
@@ -252,7 +252,7 @@
-----------------------------------------
"""%(MODE_IPv6, MODE_FUZZ, SHOW_ARP, SHOW_ICMP, SHOW_DHCPOPTIONS, SHOW_LEASE_CONFIRM, repr(REQUEST_OPTS),
TIMEOUT['timer'], TIMEOUT['dos'], TIMEOUT['dhcpip'],
- DO_GARP, DO_RELEASE, DO_ARP, repr(MAC_LIST), DO_COLOR)
+ DO_GARP, DO_RELEASE, DO_ARP, repr(MAC_LIST), DO_COLOR))
def LOG(message=None, type=None):
@@ -310,21 +310,21 @@
def get_if_net(iff):
for net, msk, gw, iface, addr in read_routes():
- if (iff == iface and net != 0L):
+ if (iff == iface and net != 0):
return ltoa(net)
warning("No net address found for iface %s\n" % iff)
def get_if_msk(iff):
for net, msk, gw, iface, addr in read_routes():
- if (iff == iface and net != 0L):
+ if (iff == iface and net != 0):
return ltoa(msk)
warning("No net address found for iface %s\n" % iff)
def get_if_ip(iff):
for net, msk, gw, iface, addr in read_routes():
- if (iff == iface and net != 0L):
+ if (iff == iface and net != 0):
return addr
warning("No net address found for iface %s\n" % iff)
@@ -685,8 +685,8 @@
LOG(type="NOTICE", message= "[DONE] DHCP pool exhausted!")
def usage():
- print __doc__
+ print(__doc__)
if __name__ == '__main__':
main()
- print "\n"
+ print("\n")
|