Skip to content

Commit 623ba6c

Browse files
committed
Update subprocess calls for python3, fix TypeError
1 parent bd297a3 commit 623ba6c

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Reconnoitre/lib/find_dns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def find_dns(target_hosts, output_directory, quiet):
2727

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

3333
for line in lines:

Reconnoitre/lib/hostname_scan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def hostname_scan(target_hosts, output_directory, quiet):
1818
else:
1919
SWEEP = "nbtscan -q %s" % (target_hosts)
2020

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

2424
for line in lines:

Reconnoitre/lib/ping_sweeper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ def ping_sweeper(target_hosts, output_directory, quiet):
2323
def call_nmap_sweep(target_hosts):
2424
SWEEP = "nmap -n -sP %s" % (target_hosts)
2525

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

3029

Reconnoitre/lib/service_scan.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def nmap_scan(
2020
QUICKSCAN = "nmap -sC -sV -Pn --disable-arp-ping %s -oA '%s/%s.quick'" % (
2121
ip_address, output_directory, ip_address)
2222
quickresults = subprocess.check_output(
23-
QUICKSCAN, shell=True).decode("utf-8")
23+
QUICKSCAN, shell=True,text=True)
2424

2525
write_recommendations(quickresults, ip_address, output_directory)
2626
print("[*] TCP quick scans completed for %s" % ip_address)
@@ -70,8 +70,8 @@ def nmap_scan(
7070
ip_address, output_directory, ip_address)
7171

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

7676
write_recommendations(tcpresults + udpresult, ip_address, output_directory)
7777
print("[*] TCP%s scans completed for %s" %

Reconnoitre/lib/snmp_walk.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def snmp_scans(ip_address, output_directory):
7676
subprocess.check_output(
7777
SCAN,
7878
stderr=subprocess.STDOUT,
79-
shell=True).decode("utf-8").decode('utf-8')
79+
shell=True,
80+
text=True)
8081
except Exception:
8182
print("[+] No Response from %s" % ip_address)
8283
except subprocess.CalledProcessError:

0 commit comments

Comments
 (0)