def main(): the_scanner = c_protocol_scanner() ############################################################################ #####实现一种协议的扫描类后,只需要在这里实例化一个实例,然后追加到扫描容器内 the_mysql_scanner = mysql_scanner.c_mysql_scanner() the_scanner.append_protocol_scanner(the_mysql_scanner) the_http_scanner = http_scanner.c_http_scanner() the_scanner.append_protocol_scanner(the_http_scanner) the_ssh_scanner = ssh_scanner.c_ssh_scanner() the_scanner.append_protocol_scanner(the_ssh_scanner) ############################################################################ the_scanner.run(1)
def __init__(self, master): self.the_scanner = protocol_scanner.c_protocol_scanner() #IP的选择操作 #单IP ip_frame = Frame(master, relief=RIDGE, borderwidth=2) ip_frame.pack(side=TOP) self.single_ip = IntVar() self.single_ip.set(1) self.ip_radio = Radiobutton(ip_frame, variable=self.single_ip, value=1, text="单IP:", width=8, anchor=W) self.ip_radio.pack(side=LEFT) self.ip_radio.bind('<Button-1>', self.choose_data) self.the_ip = StringVar() self.the_ip.set("127.0.0.1") self.ip_entry = Entry(ip_frame, textvariable=self.the_ip) self.ip_entry.pack(side=LEFT) #IP列表 self.ip_list_radio = Radiobutton(ip_frame, variable=self.single_ip, value=0, text="IP列表:", width=8, anchor=W) self.ip_list_radio['state'] = NORMAL self.ip_list_radio.pack(side=LEFT) self.ip_list_radio.bind('<Button-1>', self.choose_data) self.the_ip_list = StringVar() self.the_ip_list.set("./config/host_list.txt") self.ip_file = Entry(ip_frame, textvariable=self.the_ip_list) self.ip_file['state'] = DISABLED self.ip_file.pack(side=LEFT) self.ip_button = Button(ip_frame, text='选择') #, command = self.choose_file) self.ip_button['command'] = lambda: self.choose_file('IP') self.ip_button['state'] = DISABLED self.ip_button.pack() #USER的选择操作 #单USER user_frame = Frame(master, relief=RIDGE, borderwidth=2) user_frame.pack(side=TOP) self.single_user = IntVar() self.single_user.set(1) self.user_radio = Radiobutton(user_frame, variable=self.single_user, value=1, text="单账户:", width=8, anchor=W) self.user_radio.pack(side=LEFT) self.user_radio.bind('<Button-1>', self.choose_data) self.the_user = StringVar() self.the_user.set('root') self.user_entry = Entry(user_frame, textvariable=self.the_user) self.user_entry.pack(side=LEFT) #USER列表 self.user_list_radio = Radiobutton(user_frame, variable=self.single_user, value=0, text="账户列表:", width=8, anchor=W) self.user_list_radio['state'] = NORMAL self.user_list_radio.pack(side=LEFT) self.user_list_radio.bind('<Button-1>', self.choose_data) self.the_user_list = StringVar() self.the_user_list.set("./config/user_list.txt") self.user_file = Entry(user_frame, textvariable=self.the_user_list) self.user_file['state'] = DISABLED self.user_file.pack(side=LEFT) self.user_button = Button(user_frame, text='选择') #, command = self.choose_file) self.user_button['command'] = lambda: self.choose_file('USER') self.user_button['state'] = DISABLED self.user_button.pack() #PASSWORD的选择操作 #单PASSWD passwd_frame = Frame(master, relief=RIDGE, borderwidth=2) passwd_frame.pack(side=TOP) self.single_passwd = StringVar() self.single_passwd.set(1) self.passwd_radio = Radiobutton(passwd_frame, variable=self.single_passwd, value=1, text="单密码:", width=8, anchor=W) self.passwd_radio.pack(side=LEFT) self.passwd_radio.bind('<Button-1>', self.choose_data) self.the_passwd = StringVar() self.the_passwd.set('123456') self.passwd_entry = Entry(passwd_frame, textvariable=self.the_passwd) self.passwd_entry.pack(side=LEFT) #PASSWD列表 self.passwd_list_radio = Radiobutton(passwd_frame, variable=self.single_passwd, value=0, text="密码列表:", width=8, anchor=W) self.passwd_list_radio['state'] = NORMAL self.passwd_list_radio.pack(side=LEFT) self.passwd_list_radio.bind('<Button-1>', self.choose_data) self.the_passwd_list = StringVar() self.the_passwd_list.set("./config/passwd_list.txt") self.passwd_file = Entry(passwd_frame, textvariable=self.the_passwd_list) self.passwd_file['state'] = DISABLED self.passwd_file.pack(side=LEFT) self.passwd_button = Button(passwd_frame, text='选择') #, command = self.choose_file) self.passwd_button['command'] = lambda: self.choose_file('PASSWD') self.passwd_button['state'] = DISABLED self.passwd_button.pack() #PROTOCOL的选择操作 #单PROTOCOL protocol_frame = Frame(master, relief=RIDGE, borderwidth=2) protocol_frame.pack(side=TOP) self.single_protocol = IntVar() self.single_protocol.set(1) self.protocol_radio = Radiobutton(protocol_frame, variable=self.single_protocol, value=1, text="单协议:", width=8, anchor=W) self.protocol_radio.pack(side=LEFT) self.protocol_radio.bind('<Button-1>', self.choose_data) self.the_protocol = StringVar() self.the_protocol.set('mysql') self.protocol_entry = Entry(protocol_frame, textvariable=self.the_protocol) self.protocol_entry.pack(side=LEFT) #PROTOCOL列表 self.protocol_list_radio = Radiobutton(protocol_frame, variable=self.single_protocol, value=0, text="协议列表:", width=8, anchor=W) self.protocol_list_radio['state'] = NORMAL self.protocol_list_radio.pack(side=LEFT) self.protocol_list_radio.bind('<Button-1>', self.choose_data) self.the_protocol_list = StringVar() self.the_protocol_list.set("./config/protocol_list.txt") self.protocol_file = Entry(protocol_frame, textvariable=self.the_protocol_list) self.protocol_file['state'] = DISABLED self.protocol_file.pack(side=LEFT) self.protocol_button = Button( protocol_frame, text='选择') #, command = lambda:self.choose_file()) self.protocol_button['command'] = lambda: self.choose_file('PROTOCOL') self.protocol_button['state'] = DISABLED self.protocol_button.pack() #输入GUI结束 self.exit_button = Button(master, text="退出", fg="red", command=master.quit) self.exit_button.pack(side=RIGHT) self.suspend_button = Button(master, text="暂停", command=self.suspend_running) self.suspend_button.pack(side=RIGHT) self.start_button = Button(master, text="开始", command=self.lets_go) self.start_button.pack(side=RIGHT) #################################################################################### ########实现一种协议的扫描类后,只需要在这里实例化一个实例,然后追加到扫描容器内 the_mysql_scanner = mysql_scanner.c_mysql_scanner() self.the_scanner.append_protocol_scanner(the_mysql_scanner) the_http_scanner = http_scanner.c_http_scanner() self.the_scanner.append_protocol_scanner(the_http_scanner) the_ssh_scanner = ssh_scanner.c_ssh_scanner() self.the_scanner.append_protocol_scanner(the_ssh_scanner)
def __init__(self, master): self.the_scanner = protocol_scanner.c_protocol_scanner() #IP的选择操作 #单IP ip_frame = Frame(master, relief=RIDGE, borderwidth=2) ip_frame.pack(side=TOP) self.single_ip = IntVar() self.single_ip.set(1) self.ip_radio = Radiobutton(ip_frame, variable=self.single_ip,value=1, text="单IP:", width=8,anchor=W) self.ip_radio.pack(side=LEFT) self.ip_radio.bind('<Button-1>', self.choose_data) self.the_ip = StringVar() self.the_ip.set("127.0.0.1") self.ip_entry = Entry(ip_frame, textvariable=self.the_ip) self.ip_entry.pack(side=LEFT) #IP列表 self.ip_list_radio = Radiobutton(ip_frame, variable=self.single_ip, value=0,text="IP列表:", width=8,anchor=W) self.ip_list_radio['state'] = NORMAL self.ip_list_radio.pack(side=LEFT) self.ip_list_radio.bind('<Button-1>', self.choose_data) self.the_ip_list = StringVar() self.the_ip_list.set("./config/host_list.txt") self.ip_file = Entry(ip_frame, textvariable=self.the_ip_list) self.ip_file['state'] = DISABLED self.ip_file.pack(side=LEFT) self.ip_button = Button(ip_frame, text='选择')#, command = self.choose_file) self.ip_button['command'] = lambda:self.choose_file('IP') self.ip_button['state'] = DISABLED self.ip_button.pack() #USER的选择操作 #单USER user_frame = Frame(master, relief=RIDGE, borderwidth=2) user_frame.pack(side=TOP) self.single_user = IntVar() self.single_user.set(1) self.user_radio=Radiobutton(user_frame,variable=self.single_user,value=1,text="单账户:",width=8,anchor=W) self.user_radio.pack(side=LEFT) self.user_radio.bind('<Button-1>', self.choose_data) self.the_user = StringVar() self.the_user.set('root') self.user_entry = Entry(user_frame, textvariable=self.the_user) self.user_entry.pack(side=LEFT) #USER列表 self.user_list_radio = Radiobutton(user_frame, variable=self.single_user, value=0,text="账户列表:", width=8,anchor=W) self.user_list_radio['state'] = NORMAL self.user_list_radio.pack(side=LEFT) self.user_list_radio.bind('<Button-1>', self.choose_data) self.the_user_list = StringVar() self.the_user_list.set("./config/user_list.txt") self.user_file = Entry(user_frame, textvariable=self.the_user_list) self.user_file['state'] = DISABLED self.user_file.pack(side=LEFT) self.user_button = Button(user_frame, text='选择')#, command = self.choose_file) self.user_button['command'] = lambda:self.choose_file('USER') self.user_button['state'] = DISABLED self.user_button.pack() #PASSWORD的选择操作 #单PASSWD passwd_frame = Frame(master, relief=RIDGE, borderwidth=2) passwd_frame.pack(side=TOP) self.single_passwd = StringVar() self.single_passwd.set(1) self.passwd_radio=Radiobutton(passwd_frame,variable=self.single_passwd,value=1,text="单密码:",width=8,anchor=W) self.passwd_radio.pack(side=LEFT) self.passwd_radio.bind('<Button-1>', self.choose_data) self.the_passwd = StringVar() self.the_passwd.set('123456') self.passwd_entry = Entry(passwd_frame, textvariable=self.the_passwd) self.passwd_entry.pack(side=LEFT) #PASSWD列表 self.passwd_list_radio = Radiobutton(passwd_frame, variable=self.single_passwd, value=0,text="密码列表:", width=8,anchor=W) self.passwd_list_radio['state'] = NORMAL self.passwd_list_radio.pack(side=LEFT) self.passwd_list_radio.bind('<Button-1>', self.choose_data) self.the_passwd_list = StringVar() self.the_passwd_list.set("./config/passwd_list.txt") self.passwd_file = Entry(passwd_frame, textvariable=self.the_passwd_list) self.passwd_file['state'] = DISABLED self.passwd_file.pack(side=LEFT) self.passwd_button = Button(passwd_frame, text='选择')#, command = self.choose_file) self.passwd_button['command'] = lambda:self.choose_file('PASSWD') self.passwd_button['state'] = DISABLED self.passwd_button.pack() #PROTOCOL的选择操作 #单PROTOCOL protocol_frame = Frame(master, relief=RIDGE, borderwidth=2) protocol_frame.pack(side=TOP) self.single_protocol = IntVar() self.single_protocol.set(1) self.protocol_radio=Radiobutton(protocol_frame,variable=self.single_protocol,value=1,text="单协议:",width=8,anchor=W) self.protocol_radio.pack(side=LEFT) self.protocol_radio.bind('<Button-1>', self.choose_data) self.the_protocol = StringVar() self.the_protocol.set('mysql') self.protocol_entry = Entry(protocol_frame, textvariable=self.the_protocol) self.protocol_entry.pack(side=LEFT) #PROTOCOL列表 self.protocol_list_radio = Radiobutton(protocol_frame, variable=self.single_protocol, value=0,text="协议列表:", width=8,anchor=W) self.protocol_list_radio['state'] = NORMAL self.protocol_list_radio.pack(side=LEFT) self.protocol_list_radio.bind('<Button-1>', self.choose_data) self.the_protocol_list = StringVar() self.the_protocol_list.set("./config/protocol_list.txt") self.protocol_file = Entry(protocol_frame, textvariable=self.the_protocol_list) self.protocol_file['state'] = DISABLED self.protocol_file.pack(side=LEFT) self.protocol_button = Button(protocol_frame, text='选择')#, command = lambda:self.choose_file()) self.protocol_button['command'] = lambda:self.choose_file('PROTOCOL') self.protocol_button['state'] = DISABLED self.protocol_button.pack() #输入GUI结束 self.exit_button = Button(master, text="退出", fg="red", command=master.quit) self.exit_button.pack(side=RIGHT) self.suspend_button = Button(master, text="暂停", command=self.suspend_running) self.suspend_button.pack(side=RIGHT) self.start_button = Button(master, text="开始", command=self.lets_go) self.start_button.pack(side=RIGHT) #################################################################################### ########实现一种协议的扫描类后,只需要在这里实例化一个实例,然后追加到扫描容器内 the_mysql_scanner = mysql_scanner.c_mysql_scanner() self.the_scanner.append_protocol_scanner(the_mysql_scanner) the_http_scanner = http_scanner.c_http_scanner() self.the_scanner.append_protocol_scanner(the_http_scanner) the_ssh_scanner = ssh_scanner.c_ssh_scanner() self.the_scanner.append_protocol_scanner(the_ssh_scanner)