class NewActionModulation(Frame): def __init__(self, parent): Frame.__init__(self, parent) self.parent = parent self.initUI() def initUI(self): self.parent.title("Test") self.frameTab = Frame(self, relief=RAISED, borderwidth=1) self.frameTab.grid(row=3, column=0, columnspan=4) self.grid(row=0, column=0) self.frameTab.grid(row=0, column=0) self.note_book = Notebook(self.frameTab) self.specific_actions = ActionModulation.ActionModulation(self.note_book) self.note_book.add(self.specific_actions.getFrame(), text="specific actions") self.general_actions = GeneralActionModulation.GeneralActionModulation(self.note_book) self.note_book.add(self.general_actions.getFrame(), text="general actions") self.note_book.grid(row=0, column=0) self.frameButtons = Frame(self, relief=RAISED, borderwidth=1) self.frameButtons.grid(row=3, column=0, columnspan=4) self.buttonReset = Button(self.frameButtons, text="Reset") self.buttonReset.grid(row=0, column=0) self.buttonAbort = Button(self.frameButtons, text="Abort") self.buttonAbort.grid(row=0, column=1) self.buttonStop = Button(self.frameButtons, text="Stop") self.buttonStop.grid(row=0, column=2) self.buttonSendAction = Button(self.frameButtons, text="Send Action") self.buttonSendAction.grid(row=0, column=4) self.buttonSendEmotion = Button(self.frameButtons, text="Send Emotion") self.buttonSendEmotion.grid(row=0, column=5) def getCurrentTab(self): return self.note_book.index(self.note_book.select()) def getFirstTab(self): return self.specific_actions def getSecondTab(self): return self.general_actions def getButtonSendAction(self): return self.buttonSendAction def getButtonSendEmotion(self): return self.buttonSendEmotion def getButtonReset(self): return self.buttonReset def getButtonAbort(self): return self.buttonAbort def getButtonStop(self): return self.buttonStop
class ConverterFrame(Frame): def __init__(self, converter, master=None): Frame.__init__(self, master) master.title("Ai Variable tool") self.converter = converter self.grid(row=0, sticky=(tk.N + tk.E + tk.W + tk.S)) self.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(0, weight=1) self.tabbedPane = Notebook(self, name="tabbed-pane") self.tabbedPane.grid(row=0, column=0, sticky=(tk.N + tk.E + tk.W + tk.S)) self.btnSave = tk.Button(self, text="Guardar", command=self.btnSaveCallback) self.btnSave.grid(row=1, column=0, sticky=(tk.N + tk.E + tk.W + tk.S)) self.rawTextPanel = RawTextPane(self.tabbedPane) self.rawTextPanel.grid(row=0, column=0, sticky=(tk.N + tk.E + tk.W + tk.S)) self.numbersPanel = NumbersPane(self.tabbedPane) self.numbersPanel.grid(row=0, column=0, sticky=(tk.N + tk.E + tk.W + tk.S)) self.tabbedPane.add(self.numbersPanel, text="Series de numeros") self.tabbedPane.add(self.rawTextPanel, text="Texto en crudo") self.panels = [self.numbersPanel, self.rawTextPanel] def btnSaveCallback(self): filename = tkFileDialog.asksaveasfilename( initialdir=".", title="Select file", filetypes=(("Xml files", "*.xml"), ("All files", "*.*"))) current_idx = self.tabbedPane.index("current") work_text = self.panels[current_idx].getText() self.converter.convert(work_text) if not self.converter.save(filename): tkMessageBox.showerror("Error", "El archivo no ha sido almacenado.") else: tkMessageBox.showinfo( "Exito", "El archivo ha sido almacenado adecuadamente.")
class MainApplication(Tk): def __init__(self, network_discoverer): Tk.__init__(self) self.winfo_toplevel().title("fHTTP") self.title_font = tkfont.Font(family='Helvetica', size=14, weight='bold', slant='italic') self.h2_font = tkfont.Font(family='Helvetica', size=12, weight='bold') self.h3_font = tkfont.Font(family='Helvetica', size=11, weight='bold') self.network_discoverer = network_discoverer self.own_mac_address = network_discoverer.get_own_mac_address() self.own_ip_address = network_discoverer.get_own_ip_address() self.ip_to_mac = None self.ip_to_mac_record = None self.configure(background='darkgrey') self.is_spoofing = self.is_extracting = self.is_filtering = False self.verbose_mode = False # verbose mode on/off for output frame self.victims = None self.target = None width = int(self.winfo_screenwidth() * 0.5) height = int(self.winfo_screenheight() * 0.8) x_start = int(self.winfo_screenwidth() * 0.25) y_start = int(self.winfo_screenheight() * 0.1) self.geometry('%dx%d+%d+%d' % (width, height, x_start, y_start)) self.resizable(0, 0) # do not feel like dealing with resizable frames self.conf_menu_bar() # configure menu-bar img_icon = PhotoImage(file=media_dir + os.path.sep + 'fhttp_logo.ico') self.tk.call('wm', 'iconphoto', self._w, img_icon) for row in range(0, 100): self.rowconfigure(row, weight=1) self.columnconfigure(row, weight=1) # notebook configuration (tabs) style = Style() style.theme_settings( "default", { "TNotebook": { "configure": { "tabmargins": [0, 0, 0, 0] } }, "TNotebook.Tab": { "configure": { "padding": [8, 1, 8, 1] } } }) self.notebook = Notebook(self) self.notebook.grid(row=1, column=0, columnspan=100, rowspan=10, sticky='nesw', padx=5) # output frame configuration self.output = OutputFrame(parent=self) self.output.grid(row=13, column=0, columnspan=100, rowspan=85, sticky='nesw', padx=5) # notebook frames self.tabs = {} self.tab_mapping = OrderedDict([ (StartFrame, 'Start'), (LocalNetworkScanFrame, 'Local Network Scan'), (ARPSpoofFrame, 'ARP Spoofing'), (InjectorExtractorFrame, 'Injection and Extraction') ]) for tab in self.tab_mapping.keys(): tab_frame_name = self.tab_mapping[tab] frame = tab(parent=self.notebook, controller=self) self.notebook.add(frame, text=tab_frame_name) self.tabs[tab.__name__] = frame self.notebook.tab(self.notebook.index( self.tabs['InjectorExtractorFrame']), state=DISABLED) self.notebook.tab(self.notebook.index(self.tabs['ARPSpoofFrame']), state=DISABLED) tkMessageBox.showinfo( "fHTTP", "\n\n\nWelcome to fhttp\n\n" "We inherently trust no one, including each other\n\n\n".ljust( 500)) def conf_menu_bar(self): menu_bar = Menu(self) # help menu help_menu = Menu(menu_bar, tearoff=0) help_menu.add_command(label='About', command=self.display_about) help_menu.add_command(label='Support and Documentation', command=self.display_support_doc) # help_menu.add_separator() menu_bar.add_cascade(label='Help', menu=help_menu) menu_bar.add_command(label='Exit', command=self.quit) self.config(menu=menu_bar) def clean_output_and_attack_frame(self): self.output = OutputFrame(parent=self) self.output.grid(row=13, column=0, columnspan=100, rowspan=85, sticky='nesw', padx=5) @staticmethod def display_about(): tkMessageBox.showinfo( "About", "fhttp is an application which is capable of exploiting vulnerabilities " "such as ARP cache poisoning. The (man-in-the-middle) positions that are acquired " "through the exploitation of these vulnerabilities are then used for things such as " "packet-sniffing, the `theft' of (insecure) cookies and img-tag-injection\n\n" "Abdel K. Bokharouss and Adriaan Knapen \n") @staticmethod def display_support_doc(): webbrowser.open('https://github.com/akbokha/fhttp') def show_frame(self, page_name, select=True, update=False): frame = self.tabs[page_name] if update: try: frame.update() except AttributeError: pass if select: self.notebook.select(self.notebook.index(frame)) def scan_and_update(self): self.ip_to_mac_record = self.network_discoverer.get_ip_to_mac_mapping( update=True) self.ip_to_mac = self.ip_to_mac_record.get_all()