2015-11-27 3 views
0

Моя программа - сканер на основе Python, который извлекает данные через команды терминала в дистрибутивах Linux (используется Ubuntu 14). Теперь с тех пор я реализовал GT3 + GUI для этого я получил следующее сообщение об ошибке:Проблемы с запуском GUK3 + Python 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 

ответ

0

self.name и self.url оба Gtk.Entry s и не строки. Поэтому вам необходимо изменить свой код на:

def button_clicked(self, widget): 
     gather_info(self.name.get_text(), self.url.get_text())