File: proc_async.py

package info (click to toggle)
python-libnmap 0.7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,416 kB
  • sloc: xml: 5,572; python: 4,299; makefile: 149
file content (18 lines) | stat: -rw-r--r-- 449 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from time import sleep

from libnmap.process import NmapProcess

nmap_proc = NmapProcess(targets="scanme.nmap.org", options="-sT")
nmap_proc.run_background()
while nmap_proc.is_running():
    print(
        "Nmap Scan running: ETC: {0} DONE: {1}%".format(
            nmap_proc.etc, nmap_proc.progress
        )
    )
    sleep(2)

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