forked from p15670423/monkey
fixed CR
This commit is contained in:
parent
f79629819e
commit
8994b0671f
|
@ -7,6 +7,8 @@ import struct
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
from six.moves import range
|
||||||
|
|
||||||
DEFAULT_TIMEOUT = 10
|
DEFAULT_TIMEOUT = 10
|
||||||
BANNER_READ = 1024
|
BANNER_READ = 1024
|
||||||
IP_ADDR_RE = r'[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
|
IP_ADDR_RE = r'[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
|
||||||
|
@ -240,8 +242,8 @@ def _traceroute_linux(target_ip, ttl):
|
||||||
proc_obj = subprocess.Popen(cli, stdout=subprocess.PIPE)
|
proc_obj = subprocess.Popen(cli, stdout=subprocess.PIPE)
|
||||||
stdout, stderr = proc_obj.communicate()
|
stdout, stderr = proc_obj.communicate()
|
||||||
ips = re.findall(IP_ADDR_RE, stdout)
|
ips = re.findall(IP_ADDR_RE, stdout)
|
||||||
if len(ips) < 2:
|
if len(ips) < 2: # Unexpected output. Fail the whole thing since it's not reliable.
|
||||||
raise Exception("Unexpected output")
|
return []
|
||||||
elif ips[-1] in trace_list: # Failed getting this hop
|
elif ips[-1] in trace_list: # Failed getting this hop
|
||||||
trace_list.append(None)
|
trace_list.append(None)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue