用pyhtonGUI写一个自定义字典的Web目录扫描器
时间: 2023-05-16 17:07:08 浏览: 102
非常感谢您的提问。以下是一个简单的Python GUI程序,用于自定义字典的Web目录扫描器:
```python
import tkinter as tk
import requests
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widgets(self):
self.url_label = tk.Label(self, text="URL:")
self.url_label.pack()
self.url_entry = tk.Entry(self)
self.url_entry.pack()
self.dict_label = tk.Label(self, text="Dictionary:")
self.dict_label.pack()
self.dict_entry = tk.Entry(self)
self.dict_entry.pack()
self.result_label = tk.Label(self, text="Result:")
self.result_label.pack()
self.result_text = tk.Text(self)
self.result_text.pack()
self.scan_button = tk.Button(self, text="Scan", command=self.scan)
self.scan_button.pack()
self.quit_button = tk.Button(self, text="Quit", command=self.master.destroy)
self.quit_button.pack()
def scan(self):
url = self.url_entry.get()
dictionary = self.dict_entry.get()
with open(dictionary, "r") as f:
for line in f:
path = line.strip()
full_url = url + "/" + path
response = requests.get(full_url)
if response.status_code == 200:
self.result_text.insert(tk.END, full_url + "\n")
root = tk.Tk()
app = Application(master=root)
app.mainloop()
```
请注意,这只是一个简单的示例程序,可能需要进行更多的错误检查和优化。此外,使用字典扫描器可能会违反某些网站的使用条款,因此请确保您的使用方式合法。
阅读全文