Beim Versuch, ein Python-Skript für die Website-Überprüfung der Fehler TypeError auszuführen: Kann 'NoneType' -Objekt nicht konvertieren, um str implizit weiterhin das Python auftritt Code istTypeError: Kann 'NoneType' -Objekt nicht implizit in str konvertieren Fehler beim Ausführen von Python-Skript
main.py
from general import *
from domain_name import *
from ip_address import *
from robots_txt import *
from whois import *
from nmap import *
ROOT_DIR = 'Targets'
create_dir(ROOT_DIR)
def gather_info(name, url):
domain_name = get_domain_name(url)
ip_address = get_ip_address(url)
robots_txt = get_robots_txt(url)
whois = get_whois(domain_name)
nmap = get_nmap(input('Nmap Options:'), ip_address)
create_report(name, url, domain_name, robots_txt, whois, nmap)
def create_report(name, full_url, domain_name, robots_txt, whois, nmap):
project_dir = ROOT_DIR + '/' + name
create_dir(project_dir)
write_file(project_dir + '/full_url.txt', full_url)
write_file(project_dir + '/domain_name.txt', domain_name)
write_file(project_dir + '/robots_txt.txt', robots_txt)
write_file(project_dir + '/whois.txt', whois)
write_file(project_dir + '/nmap.txt', nmap)
gather_info(input('Target Name:'), input('Target Domain:'))
nmap.py
import os
def get_nmap(options, ip):
command = "nmap " + options + " " + ip
process = os.popen(command)
results = str(process.read())
return results
Wenn ich es laufen sie rrturns
python ./main.py
Target Name:test
Target Domain:https://www.google.ie
Nmap Options:-F
Traceback (most recent call last):
File "./main.py", line 31, in <module>
gather_info(input('Target Name:'), input('Target Domain:'))
File "./main.py", line 17, in gather_info
nmap = get_nmap(input('Nmap Options:'), ip_address)
File "/Projects/WebScanner/nmap.py", line 9, in get_nmap
command = "nmap " + options + " " + ip
TypeError: Can't convert 'NoneType' object to str implicitly
Ich habe andere ähnliche Fehler durchsucht, kann aber keine Lösung finden, um es zu reparieren. Jede Hilfe wäre großartig.
Nun, es klingt wie "Optionen" oder "IP" ist "None". Ohne 'get_ip_address' zu sehen, können wir nicht wirklich helfen. –
Ich vermute, es sollte 'get_ip_address (domain_name)' sein. – Barmar
die get_ip_address.py ist – Greybbit