我的程序是一个基于Python的网络爬虫,它通过Linux发行版(使用ubuntu14)上的终端命令获取数据。 现在,自从我为它实现了GT3+GUI之后,我得到了以下错误:
/usr/bin/python3.4 /home/dipeshwar/Documents/WebsiteScanner/main.py Traceback (most recent call last): File
"/home/dipeshwar/Documents/WebsiteScanner/main.py", line 81, in button_clicked gather_info(self.name, self.url) File "/home/dipeshwar/Documents/WebsiteScanner/main.py", line 44, in gather_info domain = get_domain_name(url) File "/home/dipeshwar/Documents/WebsiteScanner/domain.py", line 16, in get_domain_name domain = get_tld(url) File "/usr/local/lib/python3.4/dist-packages/tld/utils.py", line 161, in get_tld url = url.lower() AttributeError: 'Entry' object has no attribute 'lower' Here is my code. Could you tell me why its giving me that error? In the get_doman_name function Im just using 'tld' module in Python to get the Top Level Domain.
敬礼
from gi.repository import Gtk
# import statement for GUI
from general import *
from whois import *
from domain import *
from ipadd import *
from nmap import *
from robots_txt import *
# these import statements get all the variables from other modules of this program
ROOT_DIR = 'Output'
create_dir(ROOT_DIR)
# Checks if directory is created or not, if not, the program creates it
def create_report(name, url, domain, ipadd, nmap, robots_txt, whois): # or def create_report(name, full_url, domain, ipadd, nmap, robots_txt, whois): ?
project_dir = ROOT_DIR + '/' + name
create_dir(project_dir)
write_file(project_dir + '/full_url.txt', url) # or full_url ?
write_file(project_dir + '/domain.txt', domain)
write_file(project_dir + '/ipadd.txt', ipadd)
write_file(project_dir + '/nmap.txt', nmap)
write_file(project_dir + '/robots_txt.txt', robots_txt)
write_file(project_dir + '/whois.txt', whois)
def gather_info(name, url):
domain = get_domain_name(url)
ipadd = get_ip_address(url)
nmap = get_nmap(ipadd)
robots_txt = get_robots_txt(url)
whois = get_whois(url)
create_report(name, url, domain, ipadd, nmap, robots_txt, whois)
class MainWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Reconnaissance Web-Scanner")
self.set_border_width(30)
self.set_size_request(300, 200)
# Layout of window
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=8)
self.add(vbox)
# Inputs
self.name = Gtk.Entry()
self.name.set_text("Enter name of website here:")
vbox.pack_start(self.name, True, True, 0)
self.url = Gtk.Entry()
self.url.set_text("Enter URL of website here:")
vbox.pack_start(self.url, True, True, 0)
# Button
self.button = Gtk.Button(label="Scan Website")
self.button.connect("clicked", self.button_clicked)
vbox.pack_start(self.button, True, True, 0)
# when user clicks the button
def button_clicked(self, widget):
gather_info(self.name, self.url)
# put exec code here
self.name
和self.url
都是Gtk.Entry
而不是字符串。因此,您必须将代码更改为:相关问题 更多 >
编程相关推荐