forked from p15670423/monkey
Merge pull request #130 from cclauss/long-was-removed-in-Python3
long was removed in Python 3
This commit is contained in:
commit
2bc87794b7
|
@ -405,7 +405,7 @@ def get_interface_to_target(dst):
|
||||||
for d, m, gw, i, a in routes:
|
for d, m, gw, i, a in routes:
|
||||||
aa = atol(a)
|
aa = atol(a)
|
||||||
if aa == dst:
|
if aa == dst:
|
||||||
pathes.append((0xffffffffL, ("lo", a, "0.0.0.0")))
|
pathes.append((0xffffffff, ("lo", a, "0.0.0.0")))
|
||||||
if (dst & m) == (d & m):
|
if (dst & m) == (d & m):
|
||||||
pathes.append((m, (i, a, gw)))
|
pathes.append((m, (i, a, gw)))
|
||||||
if not pathes:
|
if not pathes:
|
||||||
|
|
|
@ -10,6 +10,11 @@ from subprocess import check_output
|
||||||
from random import randint
|
from random import randint
|
||||||
from common.network.network_range import CidrRange
|
from common.network.network_range import CidrRange
|
||||||
|
|
||||||
|
try:
|
||||||
|
long # Python 2
|
||||||
|
except NameError:
|
||||||
|
long = int # Python 3
|
||||||
|
|
||||||
|
|
||||||
def get_host_subnets():
|
def get_host_subnets():
|
||||||
"""
|
"""
|
||||||
|
@ -93,8 +98,8 @@ else:
|
||||||
ifaddr = socket.inet_ntoa(ifreq[20:24])
|
ifaddr = socket.inet_ntoa(ifreq[20:24])
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
routes.append((socket.htonl(long(dst, 16)) & 0xffffffffL,
|
routes.append((socket.htonl(long(dst, 16)) & 0xffffffff,
|
||||||
socket.htonl(long(msk, 16)) & 0xffffffffL,
|
socket.htonl(long(msk, 16)) & 0xffffffff,
|
||||||
socket.inet_ntoa(struct.pack("I", long(gw, 16))),
|
socket.inet_ntoa(struct.pack("I", long(gw, 16))),
|
||||||
iff, ifaddr))
|
iff, ifaddr))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue