Skip to content

Commit 16a4ece

Browse files
committed
fixed travis errors
1 parent ec731af commit 16a4ece

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

libnmap/process.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,8 @@ def __process_event(self, eventdata):
391391
xt = xmlnode.attributes
392392
taskname = xt['task'].value
393393
starttime = xt['time'].value
394-
xinfo=''
395-
if xt.has_key('extrainfo'):
394+
xinfo = ''
395+
if 'extrainfo' in xt.keys():
396396
xinfo = xt['extrainfo'].value
397397
newtask = NmapTask(taskname, starttime, xinfo)
398398
self.__nmap_tasks[newtask.name] = newtask
@@ -404,7 +404,7 @@ def __process_event(self, eventdata):
404404
tname = xt['task'].value
405405
xinfo = ''
406406
self.__nmap_tasks[tname].endtime = xt['time'].value
407-
if xt.has_key('extrainfo'):
407+
if 'extrainfo' in xt.keys():
408408
xinfo = xt['extrainfo'].value
409409
self.__nmap_tasks[tname].extrainfo = xinfo
410410
self.__nmap_tasks[tname].status = "ended"

libnmap/test/process-stressbox/proc_async.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77
nmap_proc = NmapProcess(targets="scanme.nmap.org", options="-sT")
88
nmap_proc.run_background()
99
while nmap_proc.is_alive():
10-
print "Nmap Scan running: ETC: {0} DONE: {1}%".format(nmap_proc.etc,
11-
nmap_proc.progress)
12-
sleep(2)
10+
nmaptask = nmap_proc.current_task
11+
if nmaptask:
12+
print "Task {0} ({1}): ETC: {2} DONE: {3}%".format(nmaptask.name,
13+
nmaptask.status,
14+
nmaptask.etc,
15+
nmaptask.progress)
16+
sleep(0.5)
1317

1418
print "rc: {0} output: {1}".format(nmap_proc.rc, nmap_proc.summary)
1519
print nmap_proc.stdout

0 commit comments

Comments
 (0)