minor refactoring
This commit is contained in:
parent
5a323807eb
commit
74f88e6601
@ -39,7 +39,7 @@ import dns.resolver
|
||||
|
||||
__VERSION__ = 1.1
|
||||
__PROGNAME__ = os.path.basename(sys.argv[0])
|
||||
should_stop = False
|
||||
shutdown = False
|
||||
|
||||
|
||||
def usage():
|
||||
@ -63,7 +63,7 @@ usage: %s [-h] [-q] [-v] [-s server] [-p port] [-P port] [-S address] [-c count]
|
||||
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
global should_stop
|
||||
global shutdown
|
||||
if should_stop: # pressed twice, so exit immediately
|
||||
exit(0)
|
||||
should_stop = True # pressed once, exit gracefully
|
||||
@ -163,7 +163,7 @@ def main():
|
||||
print("%s DNS: %s:%d, hostname: %s, rdatatype: %s" % (__PROGNAME__, dnsserver, dst_port, hostname, dnsrecord))
|
||||
|
||||
for i in range(count):
|
||||
if should_stop:
|
||||
if shutdown:
|
||||
break
|
||||
try:
|
||||
stime = time.time()
|
||||
|
@ -71,7 +71,7 @@ class Colors(object):
|
||||
|
||||
|
||||
# Globarl Variables
|
||||
should_stop = False
|
||||
shutdown = False
|
||||
|
||||
|
||||
def whoisrecord(ip):
|
||||
@ -119,7 +119,7 @@ def usage():
|
||||
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
global should_stop
|
||||
global shutdown
|
||||
if should_stop: # pressed twice, so exit immediately
|
||||
exit(0)
|
||||
should_stop = True # pressed once, exit gracefully
|
||||
@ -270,7 +270,7 @@ def main():
|
||||
print("%s DNS: %s:%d, hostname: %s, rdatatype: %s" % (__PROGNAME__, dnsserver, dest_port, hostname, dnsrecord))
|
||||
|
||||
while True:
|
||||
if should_stop:
|
||||
if shutdown:
|
||||
break
|
||||
|
||||
# some platforms permit opening a DGRAM socket for ICMP without root permission
|
||||
@ -336,7 +336,7 @@ def main():
|
||||
if ASN and ASN.asn != "NA":
|
||||
as_name = "[%s %s] " % (ASN.asn, ASN.owner)
|
||||
except AttributeError:
|
||||
if should_stop:
|
||||
if shutdown:
|
||||
exit(0)
|
||||
pass
|
||||
|
||||
@ -361,7 +361,7 @@ def main():
|
||||
if (hops >= count) or (curr_addr == dnsserver) or reached:
|
||||
break
|
||||
|
||||
if expert_mode and not should_stop:
|
||||
if expert_mode and not shutdown:
|
||||
expert_report(trace_path, color_mode)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user