Skip to content

Commit

Permalink
Merge pull request codingo#110 from tlavoie/master
Browse files Browse the repository at this point in the history
Update subprocess calls for python3, fix TypeError
  • Loading branch information
codingo authored Aug 19, 2019
2 parents bd297a3 + 623ba6c commit 5badb59
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Reconnoitre/lib/find_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def find_dns(target_hosts, output_directory, quiet):

print(" [>] Testing %s for DNS" % ip_address)
DNSSCAN = "nmap -n -sV -Pn -vv -p53 %s" % (ip_address)
results = subprocess.check_output(DNSSCAN, shell=True).decode("utf-8")
results = subprocess.check_output(DNSSCAN, shell=True, text=True)
lines = results.split("\n")

for line in lines:
Expand Down
2 changes: 1 addition & 1 deletion Reconnoitre/lib/hostname_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def hostname_scan(target_hosts, output_directory, quiet):
else:
SWEEP = "nbtscan -q %s" % (target_hosts)

results = subprocess.check_output(SWEEP, shell=True).decode("utf-8")
results = subprocess.check_output(SWEEP, shell=True,text=True)
lines = results.split("\n")

for line in lines:
Expand Down
3 changes: 1 addition & 2 deletions Reconnoitre/lib/ping_sweeper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def ping_sweeper(target_hosts, output_directory, quiet):
def call_nmap_sweep(target_hosts):
SWEEP = "nmap -n -sP %s" % (target_hosts)

results = subprocess.check_output(SWEEP, shell=True)
lines = str(results).encode("utf-8").split("\n")
results = subprocess.check_output(SWEEP, shell=True, text=True)
return lines


Expand Down
6 changes: 3 additions & 3 deletions Reconnoitre/lib/service_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def nmap_scan(
QUICKSCAN = "nmap -sC -sV -Pn --disable-arp-ping %s -oA '%s/%s.quick'" % (
ip_address, output_directory, ip_address)
quickresults = subprocess.check_output(
QUICKSCAN, shell=True).decode("utf-8")
QUICKSCAN, shell=True,text=True)

write_recommendations(quickresults, ip_address, output_directory)
print("[*] TCP quick scans completed for %s" % ip_address)
Expand Down Expand Up @@ -70,8 +70,8 @@ def nmap_scan(
ip_address, output_directory, ip_address)

udpresult = "" if no_udp_service_scan is True else subprocess.check_output(
UDPSCAN, shell=True).decode("utf-8")
tcpresults = subprocess.check_output(TCPSCAN, shell=True).decode("utf-8")
UDPSCAN, shell=True, text=True)
tcpresults = subprocess.check_output(TCPSCAN, shell=True, text=True)

write_recommendations(tcpresults + udpresult, ip_address, output_directory)
print("[*] TCP%s scans completed for %s" %
Expand Down
3 changes: 2 additions & 1 deletion Reconnoitre/lib/snmp_walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def snmp_scans(ip_address, output_directory):
subprocess.check_output(
SCAN,
stderr=subprocess.STDOUT,
shell=True).decode("utf-8").decode('utf-8')
shell=True,
text=True)
except Exception:
print("[+] No Response from %s" % ip_address)
except subprocess.CalledProcessError:
Expand Down

0 comments on commit 5badb59

Please sign in to comment.