コード例 #1
0
            def __init__(self, container, frame, label='', text='', row=0, column=0):
                self.container = container
                self.is_b0 = BooleanVar(container.parent)
                self.is_dw = BooleanVar(container.parent)
                self.column = column
                self.direction = StringVar(container.parent)

                self.label_from = Label(frame, text='from')
                self.text_from = Entry(frame)
                self.text_from.insert(0, text)
                self.button_file_from = Button(frame, text='...', command=lambda:filenameDialog_text(self.text_from))
                self.button_rm = Button(frame, text='remove', command=self.click_remove)
                self.radio_ap = Radiobutton(frame, text='AP', variable=self.direction, value='AP', command=self.set_direction)
                self.radio_pa = Radiobutton(frame, text='PA', variable=self.direction, value='PA', command=self.set_direction)

                self.label_to = Label(frame, text='to')
                self.text_to = Entry(frame)
                #self.text_to.insert(0, text)
                self.button_file_to = Button(frame, text='Gen', command=self.set_filename_to)
                self.check_b0 = Checkbutton(frame, text='B0',   variable=self.is_b0)
                self.check_dw = Checkbutton(frame, text='DWI',  variable=self.is_dw)

                self.button_up = Button(frame, text='up', width=3, command=self.click_up)
                self.button_dn = Button(frame, text='down', width=3, command=self.click_dn)

                self.row = -1
                self.change_row(row)
                if text != '':
                    self.set_appa()
                    self.set_filename_to()
コード例 #2
0
    def add_instrument(self, instrument):
        if not isinstance(instrument, ScaleSynth):
            return

        index = len(self.instruments)
        self.instruments.append(instrument)

        scale_plot = ScalePlot(self)
        scale_plot.draw_scale(instrument.scale)
        scale_plot.grid(column=1, row=self.row, sticky='nesw')
        self.scale_plots.append(scale_plot)
        instrument.add_observer(scale_plot)

        control_frame = Frame(self)
        self.control_frames.append(control_frame)

        activate_button = Radiobutton(control_frame,
                                      # text=str(instrument.name),
                                      textvar=instrument.id_variable,
                                      variable=self.radio_btn_var,
                                      value=index,
                                      command=self.activate_instrument,
                                      width=15,
                                      )
        activate_button.pack()

        self.radio_btn_var.set(index)
        self.activate_instrument()

        control_frame.grid(column=0, row=self.row, sticky='nesw')

        self.row += 1
コード例 #3
0
    def initUI(self):
        
        photo = ImageTk.PhotoImage(file='icon/main_bg_4.jpg')
        w = Tkinter.Label(self,image=photo)
        w.photo = photo 
        w.place(x=0, y=0, relwidth=1, relheight=1)
        #ackground_label.pack()
        
        
        self.api = IntVar()
        self.parent.title("Face Recognition System")
        self.style = Style()
        self.style.theme_use("default")

        self.pack(fill=BOTH, expand=1)
        
        faceplus = Radiobutton(self, text="Face++", variable=self.api, value=1)
        faceplus.place(x=50, y=40)
        
        facer = Radiobutton(self, text="FaceR Animetrics", variable=self.api, value=2)
        facer.place(x=200, y=40)

        start = Button(self, text="Start Recognition",
            command=self.startRecognition)
        start.place(x=100, y=80)
        
        helpButton = Button(self, text="Help",
            command=self.giveHelp)
        helpButton.place(x=100, y=110)
    
        quitButton = Button(self, text="Quit",
            command=self.quitGUI)
        quitButton.place(x=100, y=140)
コード例 #4
0
    def body(self, parent):
        self.tkVar = IntVar()
        self.tkVar.set(-1)
        tkRb1 = Radiobutton(parent,
                            text="QT Console",
                            variable=self.tkVar,
                            value=0,
                            command=self.radio_select)
        tkRb1.grid(row=0)
        tkRb2 = Radiobutton(parent,
                            text="Notebook",
                            variable=self.tkVar,
                            value=1,
                            command=self.radio_select)
        tkRb2.grid(row=1)

        self.tkDir = StringVar()
        self.tkDir.set(self.settings.notebook_dir)
        self.tkDirEntry = Entry(parent,
                                textvariable=self.tkDir,
                                state="disabled")
        self.tkDirEntry.grid(row=2, column=0)
        self.tkBrowseButton = Button(parent,
                                     text="Browse",
                                     state="disabled",
                                     command=self.get_directory)
        self.tkBrowseButton.grid(row=2, column=1)
コード例 #5
0
    def initUI(self):

        var = IntVar()

        #General stuff
        self.parent.title("I2C Command Manager")
        self.style = Style()
        self.style.theme_use("default")
        #self.pack(fill=BOTH, expand=1)
        self.parent.configure(background=Constants.BG_COL)

        s = Style()
        s.configure('C.TRadiobutton', background=Constants.BG_COL)

        #Quit button
        quitButton = Button(self.parent, text="Quit", command=self.quit)
        quitButton.place(x=Constants.QUIT_X, y=Constants.QUIT_Y)

        #Radiobuttons
        ledRadio = Radiobutton(
            self.parent,
            text="LED Strip",
            variable=var,
            value=1,
            command=lambda: self.instructor.setAddress(0x04),
            style='C.TRadiobutton')
        vertRadio = Radiobutton(
            self.parent,
            text="Vertical Motion",
            variable=var,
            value=2,
            command=lambda: self.instructor.setAddress(0x06),
            style='C.TRadiobutton')
        ledRadio.place(x=Constants.LED_X, y=Constants.LED_Y)
        vertRadio.place(x=Constants.VERT_X, y=Constants.VERT_Y)
        #ledRadio.configure(background = Constants.BG_COL)

        #Label
        sendLabel = Label(self.parent,
                          text="Enter command:",
                          background=Constants.BG_COL)
        sendLabel.place(x=Constants.SENDL_X, y=Constants.SENDL_Y)

        #Address label
        adLabel = Label(self.parent,
                        text="Select address:",
                        background=Constants.BG_COL)
        adLabel.place(x=Constants.ADL_X, y=Constants.ADL_Y)

        #Text entry box
        textBox = Entry(self.parent, bd=2, width=Constants.TEXT_W)
        textBox.place(x=Constants.TEXT_X, y=Constants.TEXT_Y)

        #Send command button
        sendButton = Button(self.parent,
                            text="Send",
                            command=lambda: self.assignCommand(textBox.get()))
        sendButton.place(x=Constants.SENDB_X, y=Constants.SENDB_Y)
コード例 #6
0
    def __init__(self, master):
        self.master = master
        master.title("Convert SPC files")

        mf = Frame(master, padding="10")
        mf.grid(column=0, row=0, sticky=(N, W, E, S))
        mf.columnconfigure(0, weight=1)
        mf.rowconfigure(0, weight=1)
        self.message = "Enter folder containing *.SPC files"
        self.label_text = StringVar()
        self.folder = StringVar()
        self.output_fmt = StringVar()

        self.label_text.set(self.message)

        self.label = Label(mf, textvariable=self.label_text)
        self.folder_label = Label(mf, text="Folder")
        self.output_fmt_label = Label(mf, text="Output Format")

        self.fmt_txt = Radiobutton(mf, text="TXT", variable=self.output_fmt, value='txt')
        self.fmt_csv = Radiobutton(mf, text="CSV", variable=self.output_fmt, value='csv')
        self.folder_entry = Entry(mf, textvariable=self.folder)

        self.sel_foler = Button(mf, text="Browse", command=self.ask_dir)
        self.convert_btn = Button(mf, text="Convert", command=self.convert)

        # map on grid
        self.label.grid(row=0, column=0, columnspan=4, sticky=W + E)
        self.folder_label.grid(row=1, column=0, sticky=E)
        self.output_fmt_label.grid(row=2, column=0, sticky=E)
        self.folder_entry.grid(row=1, column=1, columnspan=2, sticky=W + E)
        self.fmt_txt.grid(row=2, column=1, sticky=W)
        self.fmt_csv.grid(row=2, column=2, sticky=W)
        self.sel_foler.grid(row=1, column=3, sticky=W)
        self.convert_btn.grid(row=3, column=1, columnspan=2, sticky=W + E)

        for child in mf.winfo_children():
            child.grid_configure(padx=5, pady=5)
コード例 #7
0
    def __init__(self):
        Frame.__init__(self)
        self.style = Style()
        self.style.theme_use("default")
        self.master.title("Log viewer")
        self.pack(fill=BOTH, expand=True)

        self.used = []  # List of currently plotted series ([str])
        self.series = {}  # List of all series ({str -> [number]})
        self.names = []  # List of all nodes in tree view ([str])
        self.queues = [] # List of all queues ([str])
        self.logs = {} # List of all text logs ({str -> [str]})

        self.rowconfigure(1, weight=1)
        self.columnconfigure(6, weight=3)
        self.columnconfigure(11, weight=1)

        # Series selection takes row 1-2, col 0-2
        self.series_ui = Treeview(self)
        self.series_ui.grid(row=1, column=0, columnspan=2, rowspan=2, sticky=N+S)
        self.series_ui.configure(show="tree")
        self.series_ui.bind("<Double-Button-1>", self.onselect)
        self.series_ui.tag_configure("graphall", foreground="#070")
        self.series_ui.tag_configure("graphnone", foreground="#000")
        self.series_ui.tag_configure("graphsome", foreground="#007")
        series_ui_scroll = Scrollbar(self, command=self.series_ui.yview, orient=VERTICAL)
        series_ui_scroll.grid(row=1, column=2, rowspan=2, sticky=N+S)
        self.series_ui["yscrollcommand"] = series_ui_scroll.set

        # The plot takes row 1-2, col 3-6
        move_mode = StringVar()
        move_mode.set("pan")
        show_path = IntVar()
        show_path.set(0)
        event_bars = IntVar()
        event_bars.set(1)
        show_debug = IntVar()
        show_debug.set(1)
        show_error = IntVar()
        show_error.set(1)
        show_warning = IntVar()
        show_warning.set(1)
        show_info = IntVar()
        show_info.set(1)
        self.plot = HackPlot(self, move_mode, show_path, event_bars,
                [(show_debug, "[DEBUG]"), (show_error, "[ERROR]"), (show_warning, "[WARNING]"), (show_info, "[INFO]")])
        self.plot.canvas.grid(row=1, column=3, columnspan=4, rowspan=2, sticky=N+S+E+W)
        # Text logs take row 1-2, col 7-12
        self.plot.listbox.grid(row=1, column=7, columnspan=5, sticky=N+S+E+W)
        listbox_yscroll = Scrollbar(self, command=self.plot.listbox.yview, orient=VERTICAL)
        listbox_yscroll.grid(row=1, column=12, sticky=N+S)
        self.plot.listbox["yscrollcommand"] = listbox_yscroll.set
        listbox_xscroll = Scrollbar(self, command=self.plot.listbox.xview, orient=HORIZONTAL)
        listbox_xscroll.grid(row=2, column=7, columnspan=5, sticky=E+W)
        self.plot.listbox["xscrollcommand"] = listbox_xscroll.set


        # Controls take row 0, col 0-12
        Button(self, text="Load Directory", command=self.loaddir).grid(row=0, column=0)
        Button(self, text="Load File", command=self.loadfile).grid(row=0, column=1)
        Button(self, text="Fit X", command=self.plot.fit_x).grid(row=0, column=3, sticky=W)
        Button(self, text="Fit Y", command=self.plot.fit_y).grid(row=0, column=4, sticky=W)
        Button(self, text="Fit Auto", command=self.plot.fit_auto).grid(row=0, column=5, sticky=W)
        Button(self, text="Fit Tele", command=self.plot.fit_tele).grid(row=0, column=6, sticky=W)
        # Plot controls in a subframe to manage padding so it doesn't look awful
        move_mode_control = Frame(self, padx=10)
        Radiobutton(move_mode_control, text="Pan", value="pan", variable=move_mode).grid(row=0, column=0, sticky=W)
        Radiobutton(move_mode_control, text="Zoom In", value="zoomin", variable=move_mode).grid(row=0, column=1, sticky=W)
        Radiobutton(move_mode_control, text="Zoom Out", value="zoomout", variable=move_mode).grid(row=0, column=2, sticky=W)
        move_mode_control.grid(row=0, column=7, sticky=W)
        Checkbutton(self, text="Event Bars", variable=event_bars, command=self.plot.show_textlogs).grid(row=0, column=8, sticky=W)
        Checkbutton(self, text="Debug", variable=show_debug, command=self.plot.show_textlogs).grid(row=0, column=9, sticky=W)
        Checkbutton(self, text="Error", variable=show_error, command=self.plot.show_textlogs).grid(row=0, column=10, sticky=W)
        Checkbutton(self, text="Warning", variable=show_warning, command=self.plot.show_textlogs).grid(row=0, column=11, sticky=W)
        Checkbutton(self, text="Info", variable=show_info, command=self.plot.show_textlogs).grid(row=0, column=12, sticky=W)
        Checkbutton(self, text="Directories", variable=show_path, command=self.plot.show_textlogs).grid(row=0, column=13, sticky=E)
コード例 #8
0
    def initUI(self):

        self.parent.title("Append Data")
        self.pack(fill=BOTH, expand=True)
        labelfont20 = ('Roboto', 15, 'bold')
        labelfont10 = ('Roboto', 10, 'bold')
        labelfont8 = ('Roboto', 8, 'bold')

        frame0 = Frame(self)
        frame0.pack()

        lbl0 = Label(frame0, text="Hi Nakul")
        lbl0.config(font=labelfont20)
        lbl0.pack(padx=5, pady=5)
        lbl00 = Label(frame0, text="Fill the data here")
        lbl00.config(font=labelfont10)
        lbl00.pack(padx=5, pady=5)

        ####################################
        frame1 = Frame(self)
        frame1.pack()
        frame1.place(x=50, y=100)

        lbl1 = Label(frame1, text="Name", width=15)
        lbl1.pack(side=LEFT, padx=7, pady=5)

        self.entry1 = Entry(frame1, width=20)
        self.entry1.pack(padx=5, expand=True)

        ####################################
        frame2 = Frame(self)
        frame2.pack()
        frame2.place(x=50, y=130)

        lbl2 = Label(frame2, text="F Name", width=15)
        lbl2.pack(side=LEFT, padx=7, pady=5)

        self.entry2 = Entry(frame2)
        self.entry2.pack(fill=X, padx=5, expand=True)

        ######################################
        frame3 = Frame(self)
        frame3.pack()
        frame3.place(x=50, y=160)

        lbl3 = Label(frame3, text="DOB(D/M/Y)", width=15)
        lbl3.pack(side=LEFT, padx=7, pady=5)

        self.entry3 = Entry(frame3)
        self.entry3.pack(fill=X, padx=5, expand=True)

        #######################################
        frame4 = Frame(self)
        frame4.pack()
        frame4.place(x=50, y=190)

        lbl4 = Label(frame4, text="Medium(H/E)", width=15)
        lbl4.pack(side=LEFT, padx=7, pady=5)

        self.entry4 = Entry(frame4)
        self.entry4.pack(fill=X, padx=5, expand=True)

        ##########################################
        frame5 = Frame(self)
        frame5.pack()
        frame5.place(x=50, y=225)
        MODES = [
            ("M", "Male"),
            ("F", "Female"),
        ]
        lbl5 = Label(frame5, text="Gender", width=15)
        lbl5.pack(side=LEFT, padx=7, pady=5)

        global v
        v = StringVar()
        v.set("Male")  # initialize

        for text, mode in MODES:
            b = Radiobutton(frame5, text=text, variable=v, value=mode)
            b.pack(side=LEFT, padx=10)

        ############################################
        #####printing line
        lbl5a = Label(
            text="___________________________________________________")
        lbl5a.pack()
        lbl5a.place(x=45, y=255)

        ############################################
        frame6 = Frame(self)
        frame6.pack()
        frame6.place(x=50, y=290)

        lbl6 = Label(frame6, text="Phone No:", width=15)
        lbl6.pack(side=LEFT, padx=7, pady=5)

        self.entry6 = Entry(frame6)
        self.entry6.pack(fill=X, padx=5, expand=True)

        ################################################

        frame7 = Frame(self)
        frame7.pack()
        frame7.place(x=50, y=320)

        lbl7 = Label(frame7, text="Landline No:", width=15)
        lbl7.pack(side=LEFT, padx=7, pady=5)

        self.entry7 = Entry(frame7)
        self.entry7.pack(fill=X, padx=5, expand=True)

        ###############################################
        frame8 = Frame(self)
        frame8.pack()
        frame8.place(x=50, y=350)

        lbl8 = Label(frame8, text="Email:", width=15)
        lbl8.pack(side=LEFT, padx=7, pady=5)

        self.entry8 = Entry(frame8)
        self.entry8.pack(fill=X, padx=5, expand=True)

        #############################################
        frame9 = Frame(self)
        frame9.pack()
        frame9.place(x=50, y=380)

        lbl9 = Label(frame9, text="HomeTown:", width=15)
        lbl9.pack(side=LEFT, padx=7, pady=5)

        self.entry9 = Entry(frame9)
        self.entry9.pack(fill=X, padx=5, expand=True)

        ###############################################
        frame10 = Frame(self)
        frame10.pack()
        frame10.place(x=60, y=415)

        lbl10 = Label(frame10, text="Address:")
        lbl10.pack(padx=5, pady=5)

        self.entry10 = Text(frame10, height=5, width=28)
        self.entry10.pack(padx=5, expand=True)

        ##############################################

        #############################################

        frame11 = Frame(self)
        frame11.pack()
        frame11.place(x=350, y=100)

        lbl11x = Label(frame11, text="_______Class 10th Data_______")
        lbl11x.pack(padx=0, pady=0)

        lbl11 = Label(text="%", width=15)
        lbl11.pack(side=LEFT, padx=0, pady=0)
        lbl11.place(x=350, y=130)

        self.entry11 = Entry(width=12)
        self.entry11.pack(padx=1, expand=True)
        self.entry11.place(x=420, y=130)

        lbl11a = Label(text="Passing Year", width=15)
        lbl11a.pack(padx=0, pady=2)
        lbl11a.place(x=350, y=160)

        self.entry11a = Entry(width=12)
        self.entry11a.pack(padx=1, expand=True)
        self.entry11a.place(x=420, y=160)

        lbl11b = Label(text="Board Name", width=15)
        lbl11b.pack(padx=0, pady=2)
        lbl11b.place(x=350, y=190)

        self.entry11b = Entry(width=12)
        self.entry11b.pack(padx=1, expand=True)
        self.entry11b.place(x=420, y=190)

        ####################################################
        frame12 = Frame(self)
        frame12.pack()
        frame12.place(x=510, y=100)

        lbl12x = Label(frame12, text="_______Class 12th Data_______")
        lbl12x.pack(padx=0, pady=0)

        lbl12 = Label(text="%", width=15)
        lbl12.pack(side=LEFT, padx=0, pady=0)
        lbl12.place(x=510, y=130)

        self.entry12 = Entry(width=12)
        self.entry12.pack(padx=1, expand=True)
        self.entry12.place(x=580, y=130)

        lbl12a = Label(text="Passing Year", width=15)
        lbl12a.pack(padx=0, pady=2)
        lbl12a.place(x=510, y=160)

        self.entry12a = Entry(width=12)
        self.entry12a.pack(padx=1, expand=True)
        self.entry12a.place(x=580, y=160)

        lbl12b = Label(text="Board Name", width=15)
        lbl12b.pack(padx=0, pady=2)
        lbl12b.place(x=510, y=190)

        self.entry12b = Entry(width=12)
        self.entry12b.pack(padx=1, expand=True)
        self.entry12b.place(x=580, y=190)

        #####################################################
        frame13 = Frame(self)
        frame13.pack()
        frame13.place(x=670, y=100)

        lbl13x = Label(frame13, text="________B.Tech Data_________")
        lbl13x.pack(padx=0, pady=0)

        lbl13 = Label(text="%", width=15)
        lbl13.pack(side=LEFT, padx=0, pady=0)
        lbl13.place(x=670, y=130)

        self.entry13 = Entry(width=12)
        self.entry13.pack(padx=1, expand=True)
        self.entry13.place(x=740, y=130)

        lbl13a = Label(text="Passing Year", width=15)
        lbl13a.pack(padx=0, pady=2)
        lbl13a.place(x=670, y=160)

        self.entry13a = Entry(width=12)
        self.entry13a.pack(padx=1, expand=True)
        self.entry13a.place(x=740, y=160)

        lbl13b = Label(text="College", width=15)
        lbl13b.pack(padx=0, pady=2)
        lbl13b.place(x=670, y=190)

        self.entry13b = Entry(width=12)
        self.entry13b.pack(padx=1, expand=True)
        self.entry13b.place(x=740, y=190)

        ####################################################

        frame14 = Frame(self)
        frame14.pack()
        frame14.place(x=380, y=255)

        lbl14 = Label(frame14, text="Any Other Info:")
        lbl14.pack(padx=5, pady=5)

        self.entry14 = Text(frame14, height=5, width=28)
        self.entry14.pack(padx=5, expand=True)

        frame15 = Frame(self)
        frame15.pack()
        frame15.place(x=650, y=290)

        openButton = Button(frame15,
                            text="Attatch Resume",
                            width=15,
                            command=self.openResume)
        openButton.pack(padx=5, pady=5)
        self.entry15 = Entry(frame15)
        self.entry15.pack(fill=X, padx=4, expand=True)
        #############################################################
        frame16 = Frame(self)
        frame16.pack()
        frame16.place(x=450, y=500)

        closeButton = Button(frame16,
                             text="SUBMIT",
                             width=35,
                             command=self.getDatax)
        closeButton.pack(padx=5, pady=5)

        #######################################
        framexxx = Frame(self)
        framexxx.pack()
        framexxx.place(x=700, y=600)
        self.xxx = Label(framexxx, text="Recent Changes Will Appear Here")
        self.xxx.config(font=labelfont8)
        self.xxx.pack()

        #######################################

        frame000 = Frame(self)
        frame000.pack()
        frame000.place(x=50, y=600)

        self.lbl000 = Label(frame000,
                            text="Beta/Sample2.0 | (c) Nakul Rathore")
        self.lbl000.config(font=labelfont8)
        self.lbl000.pack(padx=5, pady=5)
コード例 #9
0
    def initUI(self):
   
      
        self.parent.title("Append Data")
        self.pack(fill=BOTH, expand=True)
        labelfont20 = ('Roboto', 15, 'bold')
        labelfont10 = ('Roboto', 10, 'bold')
        labelfont8 = ('Roboto', 8, 'bold')
        
        frame0 = Frame(self)
        frame0.pack()
        
        lbl0 = Label(frame0, text="Hi Nakul")
        lbl0.config(font=labelfont20)    
        lbl0.pack( padx=5, pady=5)
        lbl00 = Label(frame0, text="Fill the data here")
        lbl00.config(font=labelfont10)
        lbl00.pack( padx=5, pady=5)
        
        ####################################
        frame1 = Frame(self)
        frame1.pack()
        frame1.place(x=50, y=100)        
        
        lbl1 = Label(frame1, text="Name", width=15)
        lbl1.pack(side=LEFT,padx=7, pady=5) 
             
        self.entry1 = Entry(frame1,width=20)
        self.entry1.pack(padx=5, expand=True)
    
        ####################################
        frame2 = Frame(self)
        frame2.pack()
        frame2.place(x=50, y=130)
        
        lbl2 = Label(frame2, text="F Name", width=15)
        lbl2.pack(side=LEFT, padx=7, pady=5)

        self.entry2 = Entry(frame2)
        self.entry2.pack(fill=X, padx=5, expand=True)
        
        ######################################
        frame3 = Frame(self)
        frame3.pack()
        frame3.place(x=50, y=160)
        
        lbl3 = Label(frame3, text="DOB(D/M/Y)", width=15)
        lbl3.pack(side=LEFT, padx=7, pady=5)        

        self.entry3 = Entry(frame3)
        self.entry3.pack(fill=X, padx=5, expand=True) 
        
        #######################################
        frame4 = Frame(self)
        frame4.pack()
        frame4.place(x=50, y=190)
        
        lbl4 = Label(frame4, text="Medium(H/E)", width=15)
        lbl4.pack(side=LEFT, padx=7, pady=5)        

        self.entry4 = Entry(frame4)
        self.entry4.pack(fill=X, padx=5, expand=True)
        
        ##########################################
        frame5 = Frame(self)
        frame5.pack()
        frame5.place(x=50, y=225)  
        MODES = [
            ("M", "Male"),
            ("F", "Female"),
            ]
        lbl5 = Label(frame5, text="Gender", width=15)
        lbl5.pack(side=LEFT, padx=7, pady=5)

        global v
        v = StringVar()
        v.set("Male") # initialize

        for text, mode in MODES:
            b = Radiobutton(frame5, text=text,variable=v, value=mode)
            b.pack(side=LEFT,padx=10)
        
        ############################################
        #####printing line
        lbl5a = Label(text="___________________________________________________")
        lbl5a.pack()
        lbl5a.place(x=45, y=255)  
        
        ############################################
        frame6 = Frame(self)
        frame6.pack()
        frame6.place(x=50, y=290)
        
        lbl6 = Label(frame6, text="Phone No:", width=15)
        lbl6.pack(side=LEFT, padx=7, pady=5)        

        self.entry6 = Entry(frame6)
        self.entry6.pack(fill=X, padx=5, expand=True)
        
        ################################################
        
        frame7 = Frame(self)
        frame7.pack()
        frame7.place(x=50, y=320)
        
        lbl7 = Label(frame7, text="Landline No:", width=15)
        lbl7.pack(side=LEFT, padx=7, pady=5)        

        self.entry7 = Entry(frame7)
        self.entry7.pack(fill=X, padx=5, expand=True)
        
        ###############################################
        frame8 = Frame(self)
        frame8.pack()
        frame8.place(x=50, y=350)
        
        lbl8 = Label(frame8, text="Email:", width=15)
        lbl8.pack(side=LEFT, padx=7, pady=5)        

        self.entry8 = Entry(frame8)
        self.entry8.pack(fill=X, padx=5, expand=True)
        
        #############################################
        frame9 = Frame(self)
        frame9.pack()
        frame9.place(x=50, y=380)
        
        lbl9 = Label(frame9, text="HomeTown:", width=15)
        lbl9.pack(side=LEFT, padx=7, pady=5)        

        self.entry9 = Entry(frame9)
        self.entry9.pack(fill=X, padx=5, expand=True)
        
        ###############################################
        frame10 = Frame(self)
        frame10.pack()
        frame10.place(x=60, y=415)
        
        lbl10 = Label(frame10, text="Address:")
        lbl10.pack( padx=5, pady=5)        

        self.entry10 = Text(frame10,height=5, width=28)
        self.entry10.pack(padx=5, expand=True)
        
        ##############################################
        
        #############################################
        
        frame11 = Frame(self)
        frame11.pack()
        frame11.place(x=350, y=100)
        
        lbl11x = Label(frame11,text="_______Class 10th Data_______")
        lbl11x.pack(padx=0, pady=0)
        
        lbl11 = Label(text="%",width=15)
        lbl11.pack(side=LEFT,padx=0, pady=0)
        lbl11.place(x=350, y=130)        

        self.entry11 = Entry(width=12)
        self.entry11.pack(padx=1, expand=True)
        self.entry11.place(x=420, y=130) 
        
        lbl11a = Label(text="Passing Year",width=15)
        lbl11a.pack(padx=0, pady=2)   
        lbl11a.place(x=350, y=160)   

        self.entry11a = Entry(width=12)
        self.entry11a.pack(padx=1, expand=True)
        self.entry11a.place(x=420, y=160) 
        
        lbl11b = Label(text="Board Name",width=15)
        lbl11b.pack(padx=0, pady=2)   
        lbl11b.place(x=350, y=190)   

        self.entry11b = Entry(width=12)
        self.entry11b.pack(padx=1, expand=True)
        self.entry11b.place(x=420, y=190)
        
        
        ####################################################
        frame12 = Frame(self)
        frame12.pack()
        frame12.place(x=510, y=100)
        
        lbl12x = Label(frame12,text="_______Class 12th Data_______")
        lbl12x.pack(padx=0, pady=0)
        
        lbl12 = Label(text="%",width=15)
        lbl12.pack(side=LEFT,padx=0, pady=0)
        lbl12.place(x=510, y=130)        

        self.entry12 = Entry(width=12)
        self.entry12.pack(padx=1, expand=True)
        self.entry12.place(x=580, y=130) 
        
        lbl12a = Label(text="Passing Year",width=15)
        lbl12a.pack(padx=0, pady=2)   
        lbl12a.place(x=510, y=160)   

        self.entry12a = Entry(width=12)
        self.entry12a.pack(padx=1, expand=True)
        self.entry12a.place(x=580, y=160) 
        
        lbl12b = Label(text="Board Name",width=15)
        lbl12b.pack(padx=0, pady=2)   
        lbl12b.place(x=510, y=190)   

        self.entry12b = Entry(width=12)
        self.entry12b.pack(padx=1, expand=True)
        self.entry12b.place(x=580, y=190)

        #####################################################
        frame13 = Frame(self)
        frame13.pack()
        frame13.place(x=670, y=100)
        
        lbl13x = Label(frame13,text="________B.Tech Data_________")
        lbl13x.pack(padx=0, pady=0)
        
        lbl13 = Label(text="%",width=15)
        lbl13.pack(side=LEFT,padx=0, pady=0)
        lbl13.place(x=670, y=130)        

        self.entry13 = Entry(width=12)
        self.entry13.pack(padx=1, expand=True)
        self.entry13.place(x=740, y=130) 
        
        lbl13a = Label(text="Passing Year",width=15)
        lbl13a.pack(padx=0, pady=2)   
        lbl13a.place(x=670, y=160)   

        self.entry13a = Entry(width=12)
        self.entry13a.pack(padx=1, expand=True)
        self.entry13a.place(x=740, y=160) 
        
        lbl13b = Label(text="College",width=15)
        lbl13b.pack(padx=0, pady=2)   
        lbl13b.place(x=670, y=190)   

        self.entry13b = Entry(width=12)
        self.entry13b.pack(padx=1, expand=True)
        self.entry13b.place(x=740, y=190)
        
        ####################################################
        
        frame14 = Frame(self)
        frame14.pack()
        frame14.place(x=380, y=255)
        
        lbl14 = Label(frame14, text="Any Other Info:")
        lbl14.pack( padx=5, pady=5)        

        self.entry14 = Text(frame14,height=5, width=28)
        self.entry14.pack(padx=5, expand=True)
             
         
        
        frame15 = Frame(self)
        frame15.pack()
        frame15.place(x=650, y=290)
        
        openButton = Button(frame15, text="Attatch Resume",width=15,command=self.openResume)
        openButton.pack(padx=5, pady=5)
        self.entry15 = Entry(frame15)
        self.entry15.pack(fill=X, padx=4, expand=True)
        #############################################################
        frame16 = Frame(self)
        frame16.pack()
        frame16.place(x=450, y=500)
        
        closeButton = Button(frame16, text="SUBMIT",width=35,command=self.getDatax)
        closeButton.pack(padx=5, pady=5)
        
        #######################################
        framexxx = Frame(self)
        framexxx.pack()
        framexxx.place(x=700, y=600)
        self.xxx = Label(framexxx,text="Recent Changes Will Appear Here")
        self.xxx.config(font=labelfont8) 
        self.xxx.pack()
        
        #######################################
        
        frame000 = Frame(self)
        frame000.pack()
        frame000.place(x=50, y=600)
        
        self.lbl000= Label(frame000, text="Beta/Sample2.0 | (c) Nakul Rathore")
        self.lbl000.config(font=labelfont8)    
        self.lbl000.pack( padx=5, pady=5)
コード例 #10
0
    def initUI(self):

        self.parent.title("Graphs")
        self.style = Style()
        self.style.theme_use("clam")
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, weight=1)
        self.columnconfigure(6, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)

        menu = Menu(self.parent)
        self.parent.config(menu=menu)
        filemenu = Menu(menu)
        menu.add_cascade(label="File", menu=filemenu)
        filemenu.add_command(label="Load data", command=self.load_data)

        # lable to show current file and chanel
        self.file_lbl = Label(self, text="")
        self.file_lbl.grid(row=0, column=3, pady=4, padx=5)

        # list box fro data files
        self.file_list = ScrolledList(self, lambda x: self.load_hunt_data(x))
        self.file_list.grid(row=1,
                            column=0,
                            columnspan=3,
                            rowspan=4,
                            padx=5,
                            sticky=E + W + S + N)

        # chanel graph viewer
        self.graph_viewer = TkinterGraph(self)
        self.graph_viewer.grid(row=1,
                               column=3,
                               columnspan=2,
                               rowspan=4,
                               padx=5,
                               sticky=E + W + S + N)

        btn1 = Button(self, text="Left", command=lambda: self.plot_left())
        btn1.grid(row=1, column=6)

        btn2 = Button(self, text="Right", command=lambda: self.plot_right())
        btn2.grid(row=2, column=6, pady=4)

        # frames for the classifier for the two chanels
        self.frame_left = Frame(self, borderwidth=1)
        self.frame_right = Frame(self, borderwidth=1)
        self.frame_left.grid(row=5, column=3, columnspan=2, rowspan=1)

        btn4 = Button(self, text="SAVE", command=lambda: self.save_graph())
        btn4.grid(row=5, column=6)

        # note manual addition of labels so that the lable will be to the right of tha radio button
        self.classify_left = StringVar()
        Label(self.frame_left, text="Left  :").pack(side=LEFT)
        Label(self.frame_left, text="Type A").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_left,
                          variable=self.classify_left,
                          value="TypeA")
        rb1.pack(side=LEFT)
        Label(self.frame_left, text="Type B").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_left,
                          variable=self.classify_left,
                          value="TypeB")
        rb1.pack(side=LEFT)
        Label(self.frame_left, text="Type C").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_left,
                          variable=self.classify_left,
                          value="TypeC")
        rb1.pack(side=LEFT)
        Label(self.frame_left, text="Type D").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_left,
                          variable=self.classify_left,
                          value="TypeD")
        rb1.pack(side=LEFT)

        self.classify_right = StringVar()
        Label(self.frame_right, text="Right  :").pack(side=LEFT)
        Label(self.frame_right, text="Type A").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,
                          variable=self.classify_right,
                          value="TypeA")
        rb1.pack(side=LEFT)
        Label(self.frame_right, text="Type B").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,
                          variable=self.classify_right,
                          value="TypeB")
        rb1.pack(side=LEFT)
        Label(self.frame_right, text="Type C").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,
                          variable=self.classify_right,
                          value="TypeC")
        rb1.pack(side=LEFT)
        Label(self.frame_right, text="Type D").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,
                          variable=self.classify_right,
                          value="TypeD")
        rb1.pack(side=LEFT)
コード例 #11
0
ファイル: process.py プロジェクト: Letris/Final_stroke
    def setup_radio_buttons(self):
        '''add atemporal vs temporal choice part'''
        dct = self.user_input

        temporal_processing_flag = BooleanVar()

        # get context dependent frame (regular)
        regular = Raw2Attributes()
        regular_frame = regular.make_frame(self)
        reg_button = Radiobutton(self,
                                 text='raw2attributes',
                                 value=False,
                                 variable=temporal_processing_flag)
        reg_button.grid(row=12, column=0, sticky=W)

        # get context dependent frame (temporal)
        temporal = Raw2Patterns()
        temporal_frame = temporal.make_frame(self)
        tmprl_button = Radiobutton(self,
                                   text='raw2patterns',
                                   value=True,
                                   variable=temporal_processing_flag)
        tmprl_button.grid(row=12, column=1, sticky=W)

        # configure events, invoke one by default
        reg_button.configure(
            command=lambda: self.set_frame(regular_frame, temporal_frame))
        tmprl_button.configure(
            command=lambda: self.set_frame(temporal_frame, regular_frame))
        reg_button.invoke()  # default

        dct['process_temporal'] = temporal_processing_flag
        dct['a-temporal_specific'] = regular.get_values()
        dct['temporal_specific'] = temporal.get_values()
コード例 #12
0
ファイル: pySAD.py プロジェクト: AlbMA/PySAD
    def initUI(self):

        self.initText()

        self.parent.title("PySAD")
        self.style = Style()
        self.style.theme_use("clam")

        self.pack(fill=BOTH, expand=1)

        barraLateral = Frame(self, borderwidth=1)
        barraLateral.pack(side=RIGHT, padx=5, pady=5)

        idiomaFrame = Frame(barraLateral, relief=FLAT)
        idiomaFrame.pack(side=TOP)

        self.espButton = Button(idiomaFrame,
                                text="es",
                                width=0,
                                command=lambda: self.updateText(0))
        self.espButton.grid(row=0, column=0)
        self.engButton = Button(idiomaFrame,
                                text="en",
                                width=0,
                                command=lambda: self.updateText(1))
        self.engButton.grid(row=0, column=1)

        self.updateText(0)

        editarFrame = Frame(barraLateral,
                            relief=RAISED,
                            borderwidth=1,
                            width=1000)
        editarFrame.pack(fill=BOTH, expand=1, side=TOP, padx=5, pady=5)

        self.tipoCurva = IntVar()

        tituloSelector = Label(editarFrame, textvariable=self.curTip)
        tituloSelector.grid(row=0, columnspan=2, padx=2, pady=4)
        Radiobutton(editarFrame,
                    textvariable=self.ArcSpi,
                    variable=self.tipoCurva,
                    value=1,
                    command=self.cambiaFormula,
                    width=17).grid(row=1, columnspan=2, sticky=W, padx=4)
        Radiobutton(editarFrame,
                    textvariable=self.LogSpi,
                    variable=self.tipoCurva,
                    value=2,
                    command=self.cambiaFormula).grid(row=2,
                                                     columnspan=2,
                                                     sticky=W,
                                                     padx=4)

        self.formulaLabel = Label(editarFrame)
        self.formulaLabel.grid(row=4, columnspan=2, pady=4)

        Label(editarFrame, textvariable=self.aaa).grid(row=5, column=0, pady=2)
        Label(editarFrame, textvariable=self.bbb).grid(row=6, column=0, pady=2)
        self.labelC = Label(editarFrame, textvariable=self.ccc)
        self.labelC.grid(row=7, column=0, pady=2)
        self.labelC.config(state=DISABLED)
        Label(editarFrame, textvariable=self.Lma).grid(row=8, column=0, pady=2)
        Label(editarFrame, textvariable=self.fre).grid(row=9, column=0, pady=2)

        parA = Entry(editarFrame, width=4, textvariable=self.a)
        parA.grid(row=5, column=1, sticky=W)

        parB = Entry(editarFrame, width=4, textvariable=self.b)
        parB.grid(row=6, column=1, sticky=W)

        self.parC = Entry(editarFrame, width=4, textvariable=self.c)
        self.parC.grid(row=7, column=1, sticky=W)
        self.parC.config(state=DISABLED)

        lMax = Entry(editarFrame, width=4, textvariable=self.lMax)
        lMax.grid(row=8, column=1, sticky=W)
        self.createToolTip(lMax, self.stringText['LmaToo'])

        frec = Entry(editarFrame, width=4, textvariable=self.frec)
        frec.grid(row=9, column=1, sticky=W)
        self.createToolTip(frec, self.stringText['FreToo'])

        self.espejar = IntVar()
        checkEspejar = Checkbutton(editarFrame,
                                   textvariable=self.Mir,
                                   variable=self.espejar,
                                   command=self.activarFuente)
        checkEspejar.grid(row=10, columnspan=2, pady=2, sticky=W, padx=4)
        self.createToolTip(checkEspejar, self.stringText['MirToo'])

        self.fuente = IntVar()
        self.checkFuente = Checkbutton(editarFrame,
                                       textvariable=self.Sou,
                                       state=DISABLED,
                                       variable=self.fuente)
        self.checkFuente.grid(row=11, columnspan=2, pady=2, sticky=W, padx=4)
        self.createToolTip(self.checkFuente, self.stringText['SouToo'])

        okButton = Button(editarFrame,
                          textvariable=self.Gen,
                          command=self.regraficar)
        okButton.grid(row=12, columnspan=2, pady=5)
        self.createToolTip(okButton, self.stringText['GenToo'])

        self.frame2 = Frame(self, borderwidth=1)
        self.frame2.pack(fill=BOTH, expand=1, side=LEFT, padx=5, pady=5)

        self.canvas = FigureCanvasTkAgg(self.f, master=self.frame2)
        self.canvas.get_tk_widget().pack(side=TOP,
                                         fill=BOTH,
                                         expand=1,
                                         padx=10,
                                         pady=10)

        frameGuardar = Frame(barraLateral, relief=FLAT, borderwidth=1)
        frameGuardar.pack(fill=BOTH, expand=1, side=BOTTOM, padx=5, pady=5)

        icGuardar = PhotoImage(
            data=
            '''R0lGODlhEAAQAIABADMzM////yH5BAEKAAEALAAAAAAQABAAAAIlDI55wchvQJQOxontUktTbkHcSJZkGCao161N5U5SLNM1vZlOAQA7'''
        )
        saveButtonNEC = Button(frameGuardar,
                               text=self.stringText['NEC'][0],
                               image=icGuardar,
                               compound=LEFT,
                               command=self.escribirFichero,
                               width=3)
        saveButtonNEC.image = icGuardar
        saveButtonNEC.grid(row=0, column=0, pady=2, padx=2, sticky=W)
        self.createToolTip(saveButtonNEC, self.stringText['NECToo'])

        saveButtonPDF = Button(frameGuardar,
                               text=self.stringText['PDF'][0],
                               image=icGuardar,
                               compound=LEFT,
                               command=self.escribirPDF,
                               width=3)
        saveButtonPDF.image = icGuardar
        saveButtonPDF.grid(row=0, column=2, pady=2, padx=2, sticky=E)
        self.createToolTip(saveButtonPDF, self.stringText['PDFToo'])

        self.helpButton = Button(frameGuardar,
                                 text="?",
                                 command=self.mostrarAyuda,
                                 width=2)
        self.helpButton.grid(row=0, column=3, pady=2, padx=2, sticky=E)

        frame3 = Frame(barraLateral, relief=RAISED, borderwidth=1)
        frame3.pack(fill=BOTH, expand=1, side=BOTTOM, padx=5, pady=5)

        Label(frame3, textvariable=self.lenlen).grid(row=1,
                                                     column=0,
                                                     pady=4,
                                                     padx=12)
        Label(frame3, textvariable=self.radrad).grid(row=2,
                                                     column=0,
                                                     pady=4,
                                                     padx=12)
        Label(frame3, textvariable=self.StringLongitud).grid(row=1,
                                                             column=1,
                                                             pady=4)
        Label(frame3, textvariable=self.StringRadio).grid(row=2,
                                                          column=1,
                                                          pady=4)
コード例 #13
0
    def dictionaryCrackingMethodUI(self,mode):
        #mode is either 1 (network) or 0 (single)
        currentMode= "ERROR: Mode not selected" #initialize variable
        self.selectedDictionaryFile= ""
        selectedAlgorithm= "MD5" #set to md5 as the default
        inputHash= StringVar()
        inputHash.set("")
        try:
            if(mode == 0):
                currentMode= "Single"
            elif(mode == 1):
                currentMode= "Network"
            else:
                raise Exception("ERROR: Invalid mode parameter: '"+str(mode)+"'")

            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackDictionaryCrackingMethodUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.dictionaryCrackingMethodLabel= Label(self, text="Dictionary Cracking Method")
            self.dictionaryCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.currentModeLabel = Label(self,text="Current Mode: "+str(currentMode))
            self.currentModeLabel.pack(side=TOP, padx=5, pady=5)
            self.dictionaryFileLocationLabel= Label(self, text="Dictionary File to be used:")
            self.dictionaryFileLocationLabel.pack(side=TOP, padx=5, pady=5)
            self.selectedDictionaryFileLabel= Label(self, text=str(self.selectedDictionaryFile))
            self.selectedDictionaryFileLabel.pack(side=TOP, padx=5, pady=5)
            self.selectDictionaryFileButton= Button(self, text="Select Dictionary File", textvariable= str(self.selectedDictionaryFile), command=self.selectFileWindow) #
            self.selectDictionaryFileButton.pack(side=TOP, padx=5, pady=5)
            #TODO modify the dictionary file so that when a file is selected, that filepath is passed onto server
            #TODO check for dictionary file existance before handling (and file extensions for windows)
            #TODO insert option to crack a file of hashes (pass file to the server/single)
            #TODO check for file existance before handling (and file extensions for windows)
            self.inputHashTextFieldLabel= Label(self, text="The hash to be cracked:")
            self.inputHashTextFieldLabel.pack(side=TOP, padx=5, pady=5)
            self.inputHashTextField= Entry(self, bd=5, textvariable= inputHash)
            self.inputHashTextField.pack(side=TOP, padx=5, pady=5)
            self.selectAlgorithmLabel = Label(self, text="Select the Cracking Algorithm:")
            self.selectAlgorithmLabel.pack(side=TOP, padx=5, pady=5)
            self.md5RadioButton=  Radiobutton(self, text="MD5 (default)", variable= selectedAlgorithm, value="MD5" )
            self.md5RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha1RadioButton= Radiobutton(self, text="SHA 1", variable= selectedAlgorithm, value="SHA 1")
            self.sha1RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha224RadioButton= Radiobutton(self, text="SHA 224", variable= selectedAlgorithm, value="SHA 224")
            self.sha224RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha256RadioButton= Radiobutton(self, text="SHA 256", variable= selectedAlgorithm, value="SHA 256")
            self.sha256RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha512RadioButton= Radiobutton(self, text="SHA 512", variable= selectedAlgorithm, value="SHA 512")
            self.sha512RadioButton.pack(side=LEFT, padx=5, pady=5)
            #TODO display result in a noneditable text view
            if(currentMode is 'Single'):
                self.dict = {'cracking method': "dic", 'file name': str(self.selectedDictionaryFileLabel.cget("text")), 'algorithm': selectedAlgorithm, 'hash': str(inputHash.get()), 'single':"True"}
                print "selectedDictionaryFileLabel text="+str(self.selectedDictionaryFileLabel.cget("text"))
                self.startDictionaryCrackButton= Button(self, text="Start Dictionary Crack (Single Mode)", command=lambda: self.startNetworkServer(self.dict))
                self.startDictionaryCrackButton.pack(side=BOTTOM, padx=5, pady=5)
            elif(currentMode is 'Network'):
                print "GUI DEBUG: Inside elif(currentMode is 'Network)"
                if(len(str(self.inputHashTextField)) < 1):
                    showwarning("Empty hash text field", "The hash text field is empty")
                else:
                    print "GUI DEBUG: '"+str(self.inputHashTextField.get())+"'"
                    self.dict = {'cracking method': "dic", 'file name': str(self.selectedDictionaryFile), 'algorithm': selectedAlgorithm, 'hash': str(inputHash.get())}
                    self.startDictionaryCrackButton= Button(self, text="Start Dictionary Crack (Network Mode)", command=lambda: self.startNetworkServer(self.dict))
                    self.startDictionaryCrackButton.pack(side=BOTTOM, padx=5, pady=5)

            else:
                raise Exception("GUI ERROR: Invalid currentMode in startDictionaryCrackButton: '"+str(currentMode)+"'")

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in dictionaryCrackingMethodUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
コード例 #14
0
    def initUI(self):
        self.title("LMS8001-PLL-VCO Model Definition")

        self.style = Style()
        self.style.theme_use("default")

        self.columnconfigure(0, pad=1)
        self.columnconfigure(1, pad=1)
        self.columnconfigure(2, pad=1)
        #self.columnconfigure(3, pad=1, weight=1)

        self.rowconfigure(0, pad=10)
        self.rowconfigure(1, pad=1, weight=1)
        self.rowconfigure(2, pad=1, weight=1)
        self.rowconfigure(3, pad=15, weight=1)
        self.rowconfigure(4, pad=1, weight=1)

        self.VCO_EM = BooleanVar()
        self.VCO_EM.set(self.parent.VCO_EM.get())
        self.cbox_vco_em = Checkbutton(self,
                                       text='Use EM (RLCK) VCO Model',
                                       onvalue=1,
                                       offvalue=0,
                                       variable=self.VCO_EM,
                                       command=self.on_VCO_EM)
        self.cbox_vco_em.grid(row=0, column=0, columnspan=3, sticky=W)

        self.radio_fvco = IntVar()
        self.radio_fvco.set(int(self.parent.VCO_MEAS_FREQ.get()))
        self.radio_fvco_meas = Radiobutton(
            self,
            text='Use Measured VCO Frequency Values in Analysis',
            variable=self.radio_fvco,
            value=1)
        self.radio_fvco_meas.grid(row=1,
                                  column=0,
                                  columnspan=2,
                                  padx=15,
                                  sticky=W + N)
        self.radio_fvco_sim = Radiobutton(
            self,
            text='Use Simulated VCO Frequency Values in Analysis',
            variable=self.radio_fvco,
            value=0)
        self.radio_fvco_sim.grid(row=2,
                                 column=0,
                                 columnspan=2,
                                 padx=15,
                                 sticky=W + N)

        buttonFreq = Button(self,
                            text='Plot Freq',
                            command=self.on_FREQ,
                            width=10)
        buttonFreq.grid(row=3, column=0, sticky=W + E)

        buttonKVCO = Button(self,
                            text='Plot KVCO',
                            command=self.on_KVCO,
                            width=10)
        buttonKVCO.grid(row=3, column=1, sticky=W + E)

        buttonFSTEP = Button(self,
                             text='Plot FSTEP',
                             command=self.on_FSTEP,
                             width=17)
        buttonFSTEP.grid(row=3, column=2, sticky=W + E)

        buttonOK = Button(self, text='OK', command=self.on_OK, width=10)
        buttonOK.grid(row=4, column=0, sticky=W + E)

        buttonQuit = Button(self, text='Quit', command=self.on_Quit, width=17)
        buttonQuit.grid(row=4, column=2, sticky=W + E)

        buttonApply = Button(self,
                             text='Apply',
                             command=self.on_Apply,
                             width=10)
        buttonApply.grid(row=4, column=1, sticky=W + E)

        self.on_VCO_EM()
コード例 #15
0
class guiDemo3(Frame):

    def __init__(self,parent):
        Frame.__init__(self,parent)
        self.parent = parent
        self.dict = {} #temporary
        self.initUI() #start up the main menu

    def initUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.mainMenuLabel= Label(self, text="Main Menu")
            self.mainMenuLabel.pack(side=TOP,padx=5, pady=5)
            self.singleModeButton= Button(self, text="Single Computer Mode", command=self.unpackInitUI_LoadSingleComputerMode)
            self.singleModeButton.pack(side=TOP, padx=5, pady=5)
            self.networkModeButton= Button(self, text="Networking Mode", command=self.unpackInitUI_LoadNetworkMode)
            self.networkModeButton.pack(side=TOP, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in initUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
    #end of initUI////////////////////////////

    def unpackInitUI_LoadSingleComputerMode(self):
        self.closeButton.pack_forget()
        self.mainMenuLabel.pack_forget()
        self.singleModeButton.pack_forget()
        self.networkModeButton.pack_forget()
        self.singleModeUI()

    def unpackInitUI_LoadNetworkMode(self):
        self.closeButton.pack_forget()
        self.mainMenuLabel.pack_forget()
        self.singleModeButton.pack_forget()
        self.networkModeButton.pack_forget()
        self.networkModeUI()

    def unpackSingleModeUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.singleModeLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.initUI()

    def unpackSingleModeUI_LoadSingleDictionaryUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.singleModeLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.dictionaryCrackingMethodUI(0)

    def unpackSingleModeUI_LoadSingleBruteForceUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.singleModeLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodUI(0)

    def unpackSingleModeUI_LoadSingleRainbowTableUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.singleModeLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodUI(0)

    def singleModeUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackSingleModeUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.singleModeLabel= Label(self, text="Single Computer Mode")
            self.singleModeLabel.pack(side=TOP, padx=5, pady=5)
            self.selectCrackingMethodLabel= Label(self, text="Select Your Cracking Method")
            self.selectCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.dictionaryCrackingMethodButton= Button(self, text="Dictionary", command=self.unpackSingleModeUI_LoadSingleDictionaryUI)
            self.dictionaryCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.bruteForceCrackingMethodButton= Button(self, text="Brute-Force (default)", command=self.unpackSingleModeUI_LoadSingleBruteForceUI)
            self.bruteForceCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.rainbowTableCrackingMethodButton= Button(self, text="Rainbow Table", command=self.unpackSingleModeUI_LoadSingleRainbowTableUI)
            self.rainbowTableCrackingMethodButton.pack(side=TOP, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in singleModeUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
    #End of single mode

    def unpackNetworkModeUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkModeLabel.pack_forget()
        self.selectNetworkModuleLabel.pack_forget()
        self.serverModuleButton.pack_forget()
        self.clientModuleButton.pack_forget()
        self.initUI()

    def networkModeUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkModeUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.networkModeLabel= Label(self, text="Network Mode: Server/Client Selection Screen")
            self.networkModeLabel.pack(side=TOP, padx=5, pady=5)
            self.selectNetworkModuleLabel= Label(self, text="Select Server or Client")
            self.selectNetworkModuleLabel.pack(side=TOP, padx=5, pady=5)
            self.serverModuleButton= Button(self, text="I am the Server", command= self.unpackNetworkModeUI_LoadNetworkServerUI)
            self.serverModuleButton.pack(side=TOP, padx=5, pady=5)
            self.clientModuleButton= Button(self, text="I am a Client", command= self.unpackNetworkModeUI_LoadNetworkClientUI)
            self.clientModuleButton.pack(side=TOP, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in networkModeUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
    #end of networkModeUI

    def unpackNetworkModeUI_LoadNetworkServerUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkModeLabel.pack_forget()
        self.selectNetworkModuleLabel.pack_forget()
        self.serverModuleButton.pack_forget()
        self.clientModuleButton.pack_forget()
        self.networkServerUI()

    def unpackNetworkModeUI_LoadNetworkClientUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkModeLabel.pack_forget()
        self.selectNetworkModuleLabel.pack_forget()
        self.serverModuleButton.pack_forget()
        self.clientModuleButton.pack_forget()
        self.networkClientUI()

    def unpackNetworkClientUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkClientLabel.pack_forget()
        self.insertServerIPLabel.pack_forget()
        self.insertServerIPTextfield.pack_forget()
        self.startClientButton.pack_forget()
        self.initUI()

    def networkClientUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkClientUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.networkClientLabel= Label(self, text="Network Client")
            self.networkClientLabel.pack(side=TOP, padx=5, pady=5)
            self.insertServerIPLabel= Label(self, text="Enter in the Server's IP:")
            self.insertServerIPLabel.pack(side=TOP, padx=5, pady=5)
            self.insertServerIPTextfield= Entry(self, bd=5)
            self.insertServerIPTextfield.pack(side=TOP, padx=5, pady=5)
            #TODO allow right click for pasting into box
            self.startClientButton= Button(self, text="Start Client", command=lambda: self.startClient(str(self.insertServerIPTextfield.get())))
            self.startClientButton.pack(side=TOP, padx=5, pady=5)
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in networkClientUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
    #end of networkclient UI

    def startClient(self,inputIP):
        try:
            if(len(inputIP) < 1):
                showwarning("Network Client Start Warning: NO IP","No IP address has been entered!")
            else:
                self.networkClient= Process(target=Client, args=(inputIP,))
                self.networkClient.start()
                self.networkClientStatusUI()
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in startClient definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="

    def networkClientStatusUI(self):
        self.networkClientStatusWindow= Tk()
        self.networkClientStatusWindow.geometry("640x480")
        self.networkClientStatusWindow.title("Network Client Status Window")
        self.networkClientStatusWindow.style = Style()
        self.networkClientStatusWindow.style.theme_use("default")
        self.networkClientStatusWindow.pack(fill=BOTH, expand=1)
        #TODO throws an attribute error on 'pack', thus nothing is drawn to the screen, fix this
        self.CloseButton= Button(self, text="Close Status Window", command=lambda: closeStatusWindow())
        self.CloseButton.pack(side=BOTTOM, padx=5, pady=5)

        def closeStatusWindow(self):
            self.networkClientStatusWindow.destroy()


    def unpackNetworkServerUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkServerLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.initUI()

    def networkServerUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkServerUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.networkServerLabel= Label(self, text="Network Server")
            self.networkServerLabel.pack(side=TOP, padx=5,  pady=5)
            self.selectCrackingMethodLabel= Label(self, text="Select Your Cracking Method")
            self.selectCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.dictionaryCrackingMethodButton= Button(self, text="Dictionary", command=self.unpackNetworkServerUI_LoadNetworkDictionaryUI)
            self.dictionaryCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.bruteForceCrackingMethodButton= Button(self, text="Brute-Force (default)", command=self.unpackNetwrokServerUI_LoadNetworkBruteForceUI)
            self.bruteForceCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.rainbowTableCrackingMethodButton= Button(self, text="Rainbow Table", command=self.unpackNetworkServerUI_LoadNetworkRainbowTableUI)
            self.rainbowTableCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in networkServerUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
    #end of networkServerUI

    def unpackNetworkServerUI_LoadNetworkDictionaryUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkServerLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.dictionaryCrackingMethodUI(1)

    def unpackNetwrokServerUI_LoadNetworkBruteForceUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkServerLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodUI(1)

    def unpackNetworkServerUI_LoadNetworkRainbowTableUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkServerLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodUI(1)

    def unpackDictionaryCrackingMethodUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.dictionaryCrackingMethodLabel.pack_forget()
        self.currentModeLabel.pack_forget()
        self.dictionaryFileLocationLabel.pack_forget()
        self.selectedDictionaryFileLabel.pack_forget()
        self.selectDictionaryFileButton.pack_forget()
        self.inputHashTextFieldLabel.pack_forget()
        self.inputHashTextField.pack_forget()
        self.selectAlgorithmLabel.pack_forget()
        self.md5RadioButton.pack_forget()
        self.sha1RadioButton.pack_forget()
        self.sha224RadioButton.pack_forget()
        self.sha256RadioButton.pack_forget()
        self.sha512RadioButton.pack_forget()
        self.startDictionaryCrackButton.pack_forget()
        self.initUI()

    def dictionaryCrackingMethodUI(self,mode):
        #mode is either 1 (network) or 0 (single)
        currentMode= "ERROR: Mode not selected" #initialize variable
        self.selectedDictionaryFile= ""
        selectedAlgorithm= "MD5" #set to md5 as the default
        inputHash= StringVar()
        inputHash.set("")
        try:
            if(mode == 0):
                currentMode= "Single"
            elif(mode == 1):
                currentMode= "Network"
            else:
                raise Exception("ERROR: Invalid mode parameter: '"+str(mode)+"'")

            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackDictionaryCrackingMethodUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.dictionaryCrackingMethodLabel= Label(self, text="Dictionary Cracking Method")
            self.dictionaryCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.currentModeLabel = Label(self,text="Current Mode: "+str(currentMode))
            self.currentModeLabel.pack(side=TOP, padx=5, pady=5)
            self.dictionaryFileLocationLabel= Label(self, text="Dictionary File to be used:")
            self.dictionaryFileLocationLabel.pack(side=TOP, padx=5, pady=5)
            self.selectedDictionaryFileLabel= Label(self, text=str(self.selectedDictionaryFile))
            self.selectedDictionaryFileLabel.pack(side=TOP, padx=5, pady=5)
            self.selectDictionaryFileButton= Button(self, text="Select Dictionary File", textvariable= str(self.selectedDictionaryFile), command=self.selectFileWindow) #
            self.selectDictionaryFileButton.pack(side=TOP, padx=5, pady=5)
            #TODO modify the dictionary file so that when a file is selected, that filepath is passed onto server
            #TODO check for dictionary file existance before handling (and file extensions for windows)
            #TODO insert option to crack a file of hashes (pass file to the server/single)
            #TODO check for file existance before handling (and file extensions for windows)
            self.inputHashTextFieldLabel= Label(self, text="The hash to be cracked:")
            self.inputHashTextFieldLabel.pack(side=TOP, padx=5, pady=5)
            self.inputHashTextField= Entry(self, bd=5, textvariable= inputHash)
            self.inputHashTextField.pack(side=TOP, padx=5, pady=5)
            self.selectAlgorithmLabel = Label(self, text="Select the Cracking Algorithm:")
            self.selectAlgorithmLabel.pack(side=TOP, padx=5, pady=5)
            self.md5RadioButton=  Radiobutton(self, text="MD5 (default)", variable= selectedAlgorithm, value="MD5" )
            self.md5RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha1RadioButton= Radiobutton(self, text="SHA 1", variable= selectedAlgorithm, value="SHA 1")
            self.sha1RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha224RadioButton= Radiobutton(self, text="SHA 224", variable= selectedAlgorithm, value="SHA 224")
            self.sha224RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha256RadioButton= Radiobutton(self, text="SHA 256", variable= selectedAlgorithm, value="SHA 256")
            self.sha256RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha512RadioButton= Radiobutton(self, text="SHA 512", variable= selectedAlgorithm, value="SHA 512")
            self.sha512RadioButton.pack(side=LEFT, padx=5, pady=5)
            #TODO display result in a noneditable text view
            if(currentMode is 'Single'):
                self.dict = {'cracking method': "dic", 'file name': str(self.selectedDictionaryFileLabel.cget("text")), 'algorithm': selectedAlgorithm, 'hash': str(inputHash.get()), 'single':"True"}
                print "selectedDictionaryFileLabel text="+str(self.selectedDictionaryFileLabel.cget("text"))
                self.startDictionaryCrackButton= Button(self, text="Start Dictionary Crack (Single Mode)", command=lambda: self.startNetworkServer(self.dict))
                self.startDictionaryCrackButton.pack(side=BOTTOM, padx=5, pady=5)
            elif(currentMode is 'Network'):
                print "GUI DEBUG: Inside elif(currentMode is 'Network)"
                if(len(str(self.inputHashTextField)) < 1):
                    showwarning("Empty hash text field", "The hash text field is empty")
                else:
                    print "GUI DEBUG: '"+str(self.inputHashTextField.get())+"'"
                    self.dict = {'cracking method': "dic", 'file name': str(self.selectedDictionaryFile), 'algorithm': selectedAlgorithm, 'hash': str(inputHash.get())}
                    self.startDictionaryCrackButton= Button(self, text="Start Dictionary Crack (Network Mode)", command=lambda: self.startNetworkServer(self.dict))
                    self.startDictionaryCrackButton.pack(side=BOTTOM, padx=5, pady=5)

            else:
                raise Exception("GUI ERROR: Invalid currentMode in startDictionaryCrackButton: '"+str(currentMode)+"'")

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in dictionaryCrackingMethodUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
    #end of dictionary cracking methodUI

    def setDictHash(self,newHash):
        print "GUI DEBUG: hash is: '"+str(newHash)+"'"
        self.dict['hash']= str(newHash)

    def startNetworkServer(self, crackingMethod):
        print "GUI DEBUG: hash is: '"+str(crackingMethod['hash'])+"'"
        self.networkServer= Process(target=Server, args=(crackingMethod,))
        self.networkServer.start()
        #TODO idea: create a server is running window, with the stats

    def unpackBruteForceCrackingMethodUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.inputHashTextFieldLabel.pack_forget()
        self.inputHashTextField.pack_forget()
        self.bruteForceCrackingMethodLabel.pack_forget()
        self.currentModeLabel.pack_forget()
        self.startBruteForceCrackButton.pack_forget()
        self.algorithmSelectionLabel.pack_forget()
        self.algorithmOptionMenu.pack_forget()
        self.alphabetSelectionLabel.pack_forget()
        self.alphabetOptionMenu.pack_forget()
        self.minKeyLengthLabel.pack_forget()
        self.minKeyLengthTextField.pack_forget()
        self.maxKeyLengthLabel.pack_forget()
        self.maxKeyLengthTextField.pack_forget()
        self.outputHashTextFieldLabel.pack_forget()
        self.outputHashTextField.pack_forget()
        self.initUI()

    def bruteForceCrackingMethodUI(self, mode):
        #mode is either 1 (network) or 0 (single)
        currentMode= None
        selectedAlgorithm= StringVar()
        selectedAlgorithm.set("MD5")
        selectedAlphabet= StringVar()
        selectedAlphabet.set("All")
        minKeyLength= IntVar()
        minKeyLength.set(5)
        maxKeyLength= IntVar()
        maxKeyLength.set(15)
        inputHash= StringVar()
        inputHash.set("")
        try:
            if(mode==0):
                currentMode= "Single"
            elif(mode ==1):
                currentMode= "Network"
            else:
                raise Exception("ERROR: Invalid mode parameter: '"+str(mode)+"'")

            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackBruteForceCrackingMethodUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.bruteForceCrackingMethodLabel = Label(self, text="Brute-Force Cracking Method")
            self.bruteForceCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.currentModeLabel= Label(self, text="Current Mode: "+str(currentMode))
            self.currentModeLabel.pack(side=TOP, padx=5, pady=5)
            self.algorithmSelectionLabel= Label(self, text="Select which algorithm you want to use:")
            self.algorithmSelectionLabel.pack(side=TOP, padx=5, pady=5)
            self.algorithmOptionMenu= OptionMenu(self, selectedAlgorithm, "MD5", "SHA 1", "SHA 224", "SHA 256", "SHA 512")
            self.algorithmOptionMenu.pack(side=TOP, padx=5, pady=5)
            self.alphabetSelectionLabel= Label(self, text="Select which alphabet you want to use:")
            self.alphabetSelectionLabel.pack(side=TOP, padx=5, pady=5)
            self.alphabetOptionMenu= OptionMenu(self, selectedAlphabet, "All", "ASCII_Uppercase", "ASCII_Lowercase", "Digits", "Special_Symbols")
            self.alphabetOptionMenu.pack(side=TOP, padx=5, pady=5)
            self.minKeyLengthLabel= Label(self, text="Select the minimum key length: (Default is 5)")
            self.minKeyLengthLabel.pack(side=TOP, padx=5, pady=5)
            self.minKeyLengthTextField= Entry(self, bd=5, textvariable= minKeyLength)
            self.minKeyLengthTextField.pack(side=TOP, padx=5, pady=5)
            self.maxKeyLengthLabel= Label(self, text="Select the maximum key length:  (Default is 15)")
            self.maxKeyLengthLabel.pack(side=TOP, padx=5, pady=5)
            self.maxKeyLengthTextField= Entry(self, bd=5, textvariable= maxKeyLength)
            self.maxKeyLengthTextField.pack(side=TOP, padx=5, pady=5)
            #TODO add support for combination of alphabets
            #TODO insert option to hash a file of hashes (pass the file to server/single)
            #TODO check for file existance before handling (and file extensions for windows)
            self.inputHashTextFieldLabel= Label(self, text="The hash to be cracked:")
            self.inputHashTextFieldLabel.pack(side=TOP, padx=5, pady=5)
            self.inputHashTextField= Entry(self, bd=5, textvariable= inputHash)
            self.inputHashTextField.pack(side=TOP, padx=5, pady=5)
            #TODO display results is a copiable textview

            if(currentMode is 'Single'):
                self.dict = {'cracking method': "bf", 'hash': str(inputHash.get()), 'algorithm':str(selectedAlgorithm.get()),
                             'alphabet':str(selectedAlphabet.get()), 'min key length':int(minKeyLength.get()), 'max key length':int(maxKeyLength.get()), 'single':"True"}
                self.startBruteForceCrackButton= Button(self, text="Start Brute-Force Crack (Single Mode)", command=lambda: self.startNetworkServer(self.dict))
                self.startBruteForceCrackButton.pack(side=BOTTOM, padx=5, pady=5)

            elif(currentMode is 'Network'):
               # print "GUI DEBUG: Inside elif(currentMode is 'Network)"
                #if(len(str(inputHash.get())) < 1):
                 #   showwarning("Empty hash text field", "The hash text field is empty")
                #else:
                print "GUI DEBUG: '"+str(self.inputHashTextField.get())+"'"
                self.dict = {'cracking method': "bf", 'hash': str(inputHash.get()), 'algorithm':str(selectedAlgorithm.get()),
                             'alphabet':str(selectedAlphabet.get()), 'min key length':int(minKeyLength.get()), 'max key length':int(maxKeyLength.get())}
                self.startBruteForceCrackButton= Button(self, text="Start Brute-Force Crack (Network Mode)", command=lambda: self.startNetworkServer(self.dict))
                self.startBruteForceCrackButton.pack(side=BOTTOM, padx=5, pady=5)
            else:
                raise Exception("ERROR: Invalid mode parameter in Brute-Force CrackingUI: '"+str(mode)+"'")

            #This will display the results, could set to show up after the program is run.
            self.outputHashTextFieldLabel= Label(self, text="Results")
            self.outputHashTextFieldLabel.pack(side=TOP, padx=5, pady=5)
            self.outputHashTextField= Entry(self, bd=5)
            self.outputHashTextField.insert(0, "Test")
            self.outputHashTextField.pack(side=TOP,padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in bruteForceCrackingMethodUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
    #end of brute force cracking UI

    def unpackRainbowTableCrackingMethodUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.rainbowTableCrackingMethodLabel.pack_forget()
        self.currentModeLabel.pack_forget()
        self.initUI()

    def rainbowTableCrackingMethodUI(self, mode):
        #mode is either 1 (network) or 0 (single)
        currentMode= None
        try:
            if(mode == 0):
                currentMode = "Single"
            elif(mode == 1):
                currentMode = "Network"
            else:
               raise Exception("ERROR: Invalid mode parameter: '"+str(mode)+"'")

            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackRainbowTableCrackingMethodUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.rainbowTableCrackingMethodLabel= Label(self, text="Rainbow Table Cracking Method")
            self.rainbowTableCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.currentModeLabel= Label(self,text="Current Mode: "+str(currentMode))
            self.currentModeLabel.pack(side=TOP, padx=5, pady=5)
            #TODO insert Rainbow table settings here

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in rainbowTableCrackingMethodUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
    #end of rainbow table cracking UI

    def selectFileWindow(self):
        filename= ""
        filename= askopenfilename()
        #remove the file extension
       # modifiedFileName= self.removeFileNameExtension(filename)
        print "Modified fileName= '"+str(filename)+"'"
        self.selectedDictionaryFileLabel.config(text=str(filename))
        self.selectedDictionaryFile= str(self.selectedDictionaryFileLabel.cget("text"))

    '''
    def removeFileNameExtension(self, inputFileName):
        outboundFileName= ""
        lastForwardSlashPos=0
        for i in range(0, len(inputFileName)):
            if(inputFileName[i] == "."):
                break
            elif(inputFileName[i] == "/"):
                lastForwardSlashPos= i
                outboundFileName+= inputFileName[i]
            else:
                outboundFileName+= inputFileName[i]
        print "FileName after extension is removed: '"+str(outboundFileName)+"'"
        pathlessFileName= self.removeAbsoluteFilePath(outboundFileName, lastForwardSlashPos)
        print "FileName after absolute filepath was removed: '"+str(pathlessFileName)+"'"
        return pathlessFileName

    def removeAbsoluteFilePath(self, inboundFilePath, lastForwardSlashPos):
        relativeFilePath= ""
        for i in range(lastForwardSlashPos+1, len(inboundFilePath)):
            if(inboundFilePath[i] is not None):
                relativeFilePath+= inboundFilePath[i]
            else:
                break
        return relativeFilePath
    '''

    def confirmExit(self):
        result= askyesno('Exit Confirmation', 'Are you sure you want to quit this application? \n (WARNING: All server, client, and single computer processes will be terminated!!)')
        if result == True:
            self.onExit()
        #if no is selected, then the window just closes

    def onExit(self):
       # self.networkServer.join()
        try:
            self.networkServer.terminate()
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in onExit terminate networkserver process Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
        #self.networkClient.join()
        try:
            self.networkClient.terminate()
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in onExit terminate networkclient process Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="

        self.parent.destroy()
コード例 #16
0
    def setup(self, parent):
        parent.title("Z5212 Debug Client by 2017 ZEBEX, Inc. Version 1.3")
        resize_and_center(parent, 900, 480)

        self.conn_status = StringVar()
        self.conn_status.set('...')

        # Top Frame (name entry box, buttons, conn status)
        self.conn_frame = Frame(parent, **self.style.Frame)
        self.conn_frame.pack(side="top", fill="x")

        self.lower_frame = Frame(parent, **self.style.Frame)
        self.lower_frame.pack(side="top", fill="both", expand=1)

        # The message entry
        self.display_frame = Frame(self.lower_frame, **self.style.Frame)
        self.display_frame.pack(side="top",
                                fill="both",
                                expand=1,
                                padx=5,
                                pady=5)

        self.right_frame = Frame(self.lower_frame, **self.style.Frame)
        self.right_frame.pack(side="right", fill="y")

        ###
        # Top Frame Widgets
        ###
        self.name_label = Label(self.conn_frame,
                                textvariable=self.conn_status,
                                **self.style.Label).pack(side="left",
                                                         padx=5,
                                                         pady=5)

        Button(self.conn_frame, text='連線', command=self.conn, **self.style.SettingButton)\
            .pack(side="left", padx=5, pady=5)

        Button(self.conn_frame, text="重新開始", command=self.reopen, **self.style.SettingButton)\
            .pack(side="left", padx=5, pady=5)

        self.ports_Combobox = Combobox(self.conn_frame, values=c.port, width=8)
        # assign function to combobox
        self.ports_Combobox.bind('<<ComboboxSelected>>', self.port_on_select)
        self.ports_Combobox.current(portindex)

        self.baud_rate_Combo = Combobox(self.conn_frame,
                                        values=c.baud,
                                        width=8)
        self.baud_rate_Combo.bind('<<ComboboxSelected>>',
                                  self.baud_rate_on_select)
        self.baud_rate_Combo.current(baudindex)

        self.enter_exit_button = Button(self.conn_frame,
                                        text="回復預設值",
                                        command=self.quit,
                                        **self.style.Button)

        self.ports_Combobox.pack(side="left", padx=5, pady=5)
        self.baud_rate_Combo.pack(side="left", padx=5, pady=5)
        self.enter_exit_button.pack(side="left", padx=5, pady=5)

        ###
        # Image Frame Widgets get image, set quality
        ###

        self.img_frame = Frame(self.conn_frame, **self.style.Frame)
        image_q_label = Label(self.img_frame,
                              text='Quality',
                              anchor="w",
                              **self.style.Label)
        image_q_label.pack(side=LEFT, fill="x")
        self.quality.set(85)
        Radiobutton(self.img_frame,
                    text='L',
                    variable=self.quality,
                    value=35,
                    command=self.selected_quality).pack(side=RIGHT, anchor="w")
        Radiobutton(self.img_frame,
                    text='M',
                    variable=self.quality,
                    value=85,
                    command=self.selected_quality).pack(side=RIGHT, anchor="w")
        Radiobutton(self.img_frame,
                    text='H',
                    variable=self.quality,
                    value=93,
                    command=self.selected_quality).pack(side=RIGHT, anchor="w")

        self.img_frame.pack(side="left", padx=5, pady=5)

        Button(self.conn_frame,
               text='拍照',
               command=self.getimg,
               **self.style.SettingButton).pack(side="left", padx=5, pady=5)

        ###
        # Display Frame Widgets
        ###
        self.display_frame.configure(background='#666666')
        # Create a canvas
        self.canvas = Canvas(self.display_frame,
                             width=640,
                             height=360,
                             bg="#666666")
        self.loadImage('Capture.jpg')
コード例 #17
0
    def pack_view(self, *args, **kwargs):
        layout = kwargs.get('layout', 2)
        image_object = kwargs['image_object']
        image_no = kwargs.get('image_no', None)

        temps_string = [str(value) + 'C' for value in self.__temp_values]  # ['26C', '29C', '35C', '38C']
        temps_editable_text = self.__temps_editable_text
        left_frame = self.display_left(False)

        rdo1 = Radiobutton(left_frame, variable=self.__var_rdo, value=0)
        rdo2 = Radiobutton(left_frame, variable=self.__var_rdo, value=1)
        rdo3 = Radiobutton(left_frame, variable=self.__var_rdo, value=2)
        rdo4 = Radiobutton(left_frame, variable=self.__var_rdo, value=3)

        radio_buttons = [rdo1, rdo2, rdo3, rdo4]
        idx = 0
        for radio_button in radio_buttons:
            radio_button.grid(row=idx, column=0, ipady=10)
            idx += 1

        btn1 = Button(left_frame, text=temps_string[0], command=lambda *args: self.__var_rdo.set(0))
        btn2 = Button(left_frame, text=temps_string[1], command=lambda *args: self.__var_rdo.set(1))
        btn3 = Button(left_frame, text=temps_string[2], command=lambda *args: self.__var_rdo.set(2))
        btn4 = Button(left_frame, text=temps_string[3], command=lambda *args: self.__var_rdo.set(3))

        push_buttons = [btn1, btn2, btn3, btn4]
        idx = 0
        for push_button in push_buttons:
            push_button.grid(row=idx, column=1, ipady=5, ipadx=10)
            idx += 1

        lbl1 = Label(left_frame, text=temps_editable_text[0])
        lbl2 = Label(left_frame, text=temps_editable_text[1])
        lbl3 = Label(left_frame, text=temps_editable_text[2])
        lbl4 = Label(left_frame, text=temps_editable_text[3])

        labels = [lbl1, lbl2, lbl3, lbl4]
        idx = 0
        for label in labels:
            label.grid(row=idx, column=2, ipady=5)
            idx += 1

        # ROW & COLUMN CONFIGURE
        for row in range(4):
            left_frame.rowconfigure(row, weight=2, pad=10)  # row: 0, 1, 2, 3
        for column in range(3):
            left_frame.columnconfigure(column, weight=2, pad=5)  # column: 0, 1, 2

        # image and button
        # adding preview image
        if layout == 3:
            right_frame = self.display_right(True)
            self._prev_img = ImageTk.PhotoImage(image_object)
            self._prev = Label(right_frame, image=self._prev_img)
            self._prev.pack(fill=BOTH, expand=YES, anchor=CENTER)

        # adding next button
        if layout in (2, 3):
            bottom_frame = self.display_bottom(False)
            self.add_next_action_btn(self.on_next_click)

        self.display()
コード例 #18
0
    def __init__(self, master):

        plat = platform.system()
        if plat == 'Darwin':

            try:
                system(
                    '''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python" to true' '''
                )
                print("Trying to force Python window to the front on macOS")
            except:
                system(
                    '''/usr/bin/osascript -e 'tell app "Finder" to set frontmost of process "Python2.7" to true' '''
                )
                print(
                    "Trying to force Python 2.7 window to the front on macOS")

        self.master = master
        frame = Frame(master)
        frame.config(background="#dcdcdc")
        frame.config(borderwidth=5, relief=GROOVE)
        frame.place(relx=0.5, rely=0.5, anchor=CENTER)
        master.title('Verify v. 0.2')  #   Main frame title
        master.config(background="#dcdcdc")
        master.geometry('820x750')
        menubar = Menu(master)
        """statmenu = Menu(menubar,tearoff=0)
        statmenu.add_command(label="Fieller", command=self.on_fieller)
        
        statmenu.rantest = Menu(statmenu)
        statmenu.rantest.add_command(label="Continuously variable data", command=self.on_rantest_continuous)
        statmenu.rantest.add_command(label="Binomial data (each result= yes or no)", command=self.on_rantest_binomial)
        statmenu.add_cascade(label="Randomisation test", menu=statmenu.rantest)
        
        statmenu.add_command(label="Help", command=self.on_help, state=DISABLED)
        statmenu.add_command(label="Quit", command=master.quit)
        
        menubar.add_cascade(label="Statistical Tests", menu=statmenu)
        master.config(menu=menubar)
      """
        b3 = Button(frame,
                    text="Load traces",
                    width=20,
                    command=self.callback3,
                    highlightbackground="#dcdcdc")
        b3.grid(row=0, column=0, columnspan=2, padx=10, pady=8, sticky=W)

        self.b4 = Button(frame,
                         text="Verify traces variance",
                         width=20,
                         state=DISABLED,
                         command=self.callback2,
                         highlightbackground="#dcdcdc")
        self.b4.grid(row=1, padx=10, pady=8, column=0, columnspan=2)

        self.b5 = Button(frame,
                         text="Plot Variance vs. current",
                         width=20,
                         state=DISABLED,
                         command=self.callback5,
                         highlightbackground="#dcdcdc")
        self.b5.grid(row=2, padx=10, pady=8, column=0, columnspan=2)

        #need to remove Pack to use separator
        s1 = Separator(frame, orient=VERTICAL)
        s1.grid(column=2, row=0, rowspan=40, pady=10, sticky=N + W + S)

        self.input_filename_label = StringVar()
        self.input_filename_label.set("No data loaded yet")
        self.l1 = Label(frame,
                        textvariable=self.input_filename_label,
                        width=40,
                        bg="#dcdcdc")
        self.l1.grid(row=0, column=2, columnspan=4, pady=5)

        Label(frame, text="Baseline range (pts)",
              bg="#dcdcdc").grid(row=1,
                                 column=2,
                                 columnspan=2,
                                 pady=5,
                                 sticky=E)
        self.br = Entry(frame,
                        justify=CENTER,
                        width=5,
                        highlightbackground="#dcdcdc")
        self.br.grid(row=1, column=4, sticky=W, pady=5)
        self.br.insert(END, '0, 50')

        Label(frame, text="Decimation", bg="#dcdcdc").grid(row=2,
                                                           column=2,
                                                           columnspan=2,
                                                           pady=5,
                                                           sticky=E)
        self.de = Entry(frame,
                        justify=CENTER,
                        width=5,
                        highlightbackground="#dcdcdc")
        self.de.grid(row=2, column=4, sticky=W, pady=5)
        self.de.insert(END, '1')

        Label(frame, text="Unitary current amplitude (pA)",
              bg="#dcdcdc").grid(row=3,
                                 column=2,
                                 columnspan=2,
                                 pady=5,
                                 sticky=E)
        self.ua = Entry(frame,
                        justify=CENTER,
                        width=5,
                        highlightbackground="#dcdcdc")
        self.ua.grid(row=3, column=4, sticky=W, pady=5)
        self.ua.insert(END, '1')
        #default unitary current is 1 pA

        Label(frame, text="Output filename", bg="#dcdcdc").grid(row=4,
                                                                column=2,
                                                                columnspan=2,
                                                                pady=5)

        style = Style()
        style.theme_use('clam')
        style.configure("w.TRadiobutton",
                        padding=2,
                        background="#dcdcdc",
                        foreground="black",
                        width=15)
        style.configure("TRadiobutton",
                        padding=2,
                        background="#dcdcdc",
                        foreground="black",
                        width=8)

        MODES = [("verified.txt", 3), ("Save as...", 2), ("v_[infile]", 1),
                 ("[date:time]_v_[infile]", 0)]

        self.v = IntVar()
        self.v.set(0)  # initialize

        #note this is the ttk radiobutton, the tk one doesn't select at first
        for text, mode in MODES:
            b = Radiobutton(frame,
                            text=text,
                            command=self.callback_fname,
                            variable=self.v,
                            value=mode,
                            state=NORMAL)
            b.grid(row=5, padx=10, column=mode + 2, sticky=E)

        #the last button in the loop (0) is the wide one, so gets the wide style.
        b.configure(style='w.TRadiobutton')

        self.traceHost = Frame(frame)
        self.traceHost.grid(row=15, column=0, columnspan=3)
        self.p = Plot(self.traceHost)

        self.Host2D = Frame(frame)
        self.Host2D.grid(row=15, column=3, columnspan=3)
        self.pcv = Plot(self.Host2D)

        s2 = Separator(frame)
        s2.grid(row=25, columnspan=6, sticky=S + E + W)

        message = Message(frame,
                          text=self.introduction,
                          width=800,
                          font=("Courier", 12),
                          bg="#dcdcdc")
        message.grid(row=26, rowspan=8, columnspan=6, sticky=EW)

        s3 = Separator(frame)
        s3.grid(row=35, columnspan=6, sticky=E + W)

        version_text = "https://github.com/aplested/verify\nPython version:\t" + sys.version.replace(
            "\n", "\t")
        version = Message(frame,
                          width=800,
                          text=version_text,
                          justify=LEFT,
                          background="#dcdcdc",
                          font=("Courier", 12))
        version.grid(row=36, columnspan=5, sticky=EW)

        self.b6 = Button(frame,
                         text="Quit",
                         command=master.quit,
                         width=10,
                         highlightbackground="#dcdcdc")
        self.b6.grid(row=36, padx=10, pady=8, column=5, sticky=W)
コード例 #19
0
    def dictionaryCrackingMethodUI(self,mode):
        #mode is either 1 (network) or 0 (single)
        currentMode= "ERROR: Mode not selected" #initialize variable
        selectedDictionaryFile= "No Dictionary file has been selected"
        selectedAlgorithm= "MD5" #set to md5 as the default
        try:
            if(mode == 0):
                currentMode= "Single"
            elif(mode == 1):
                currentMode= "Network"
            else:
                raise Exception("ERROR: Invalid mode parameter: '"+str(mode)+"'")

            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackDictionaryCrackingMethodUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            if(currentMode is 'Single'):
                self.startDictionaryCrackButton= Button(self, text="Start Dictionary Crack (Single Mode)")
                self.startDictionaryCrackButton.pack(side=BOTTOM, padx=5, pady=5)
                 #TODO create call method to start the dictionary crack
            elif(currentMode is 'Network'):
                self.startDictionaryCrackButton= Button(self, text="Start Dictionary Crack (Network Mode)")
                self.startDictionaryCrackButton.pack(side=BOTTOM, padx=5, pady=5)
                 #TODO create call method to start the dictionary crack
            else:
                raise Exception("GUI ERROR: Invalid currentMode in startDictionaryCrackButton: '"+str(currentMode)+"'")


            self.dictionaryCrackingMethodLabel= Label(self, text="Dictionary Cracking Method")
            self.dictionaryCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.currentModeLabel = Label(self,text="Current Mode: "+str(currentMode))
            self.currentModeLabel.pack(side=TOP, padx=5, pady=5)
            self.dictionaryFileLocationLabel= Label(self, text="Dictionary File to be used:")
            self.dictionaryFileLocationLabel.pack(side=TOP, padx=5, pady=5)
            self.selectedDictionaryFileLabel= Label(self, text=str(selectedDictionaryFile))
            self.selectedDictionaryFileLabel.pack(side=TOP, padx=5, pady=5)
            self.selectDictionaryFileButton= Button(self, text="Select Dictionary File", command=self.selectFileWindow)
            self.selectDictionaryFileButton.pack(side=TOP, padx=5, pady=5)
            self.inputHashTextFieldLabel= Label(self, text="The hash to be cracked:")
            self.inputHashTextFieldLabel.pack(side=TOP, padx=5, pady=5)
            self.inputHashTextField= Entry(self, bd=5)
            self.inputHashTextField.pack(side=TOP, padx=5, pady=5)
            self.selectAlgorithmLabel = Label(self, text="Select the Cracking Algorithm:")
            self.selectAlgorithmLabel.pack(side=TOP, padx=5, pady=5)
            self.md5RadioButton=  Radiobutton(self, text="MD5 (default)", variable= selectedAlgorithm, value="MD5" )
            self.md5RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha1RadioButton= Radiobutton(self, text="SHA 1", variable= selectedAlgorithm, value="SHA 1")
            self.sha1RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha224RadioButton= Radiobutton(self, text="SHA 224", variable= selectedAlgorithm, value="SHA 224")
            self.sha224RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha256RadioButton= Radiobutton(self, text="SHA 256", variable= selectedAlgorithm, value="SHA 256")
            self.sha256RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha512RadioButton= Radiobutton(self, text="SHA 512", variable= selectedAlgorithm, value="SHA 512")
            self.sha512RadioButton.pack(side=LEFT, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in dictionaryCrackingMethodUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
コード例 #20
0
class vco_model_win(Toplevel):
    def __init__(self, parent):
        Toplevel.__init__(self)

        img = ImageTk.PhotoImage(file=os.path.join(os.path.dirname(__file__),
                                                   'Icons/LMS8001_PLLSim.png'))
        self.tk.call('wm', 'iconphoto', self._w, img)

        self.resizable(0, 0)

        self.parent = parent
        self.pll = self.parent.pll

        self.initUI()
        center_Window(self)
        self.protocol("WM_DELETE_WINDOW", self.on_Quit)

    def initUI(self):
        self.title("LMS8001-PLL-VCO Model Definition")

        self.style = Style()
        self.style.theme_use("default")

        self.columnconfigure(0, pad=1)
        self.columnconfigure(1, pad=1)
        self.columnconfigure(2, pad=1)
        #self.columnconfigure(3, pad=1, weight=1)

        self.rowconfigure(0, pad=10)
        self.rowconfigure(1, pad=1, weight=1)
        self.rowconfigure(2, pad=1, weight=1)
        self.rowconfigure(3, pad=15, weight=1)
        self.rowconfigure(4, pad=1, weight=1)

        self.VCO_EM = BooleanVar()
        self.VCO_EM.set(self.parent.VCO_EM.get())
        self.cbox_vco_em = Checkbutton(self,
                                       text='Use EM (RLCK) VCO Model',
                                       onvalue=1,
                                       offvalue=0,
                                       variable=self.VCO_EM,
                                       command=self.on_VCO_EM)
        self.cbox_vco_em.grid(row=0, column=0, columnspan=3, sticky=W)

        self.radio_fvco = IntVar()
        self.radio_fvco.set(int(self.parent.VCO_MEAS_FREQ.get()))
        self.radio_fvco_meas = Radiobutton(
            self,
            text='Use Measured VCO Frequency Values in Analysis',
            variable=self.radio_fvco,
            value=1)
        self.radio_fvco_meas.grid(row=1,
                                  column=0,
                                  columnspan=2,
                                  padx=15,
                                  sticky=W + N)
        self.radio_fvco_sim = Radiobutton(
            self,
            text='Use Simulated VCO Frequency Values in Analysis',
            variable=self.radio_fvco,
            value=0)
        self.radio_fvco_sim.grid(row=2,
                                 column=0,
                                 columnspan=2,
                                 padx=15,
                                 sticky=W + N)

        buttonFreq = Button(self,
                            text='Plot Freq',
                            command=self.on_FREQ,
                            width=10)
        buttonFreq.grid(row=3, column=0, sticky=W + E)

        buttonKVCO = Button(self,
                            text='Plot KVCO',
                            command=self.on_KVCO,
                            width=10)
        buttonKVCO.grid(row=3, column=1, sticky=W + E)

        buttonFSTEP = Button(self,
                             text='Plot FSTEP',
                             command=self.on_FSTEP,
                             width=17)
        buttonFSTEP.grid(row=3, column=2, sticky=W + E)

        buttonOK = Button(self, text='OK', command=self.on_OK, width=10)
        buttonOK.grid(row=4, column=0, sticky=W + E)

        buttonQuit = Button(self, text='Quit', command=self.on_Quit, width=17)
        buttonQuit.grid(row=4, column=2, sticky=W + E)

        buttonApply = Button(self,
                             text='Apply',
                             command=self.on_Apply,
                             width=10)
        buttonApply.grid(row=4, column=1, sticky=W + E)

        self.on_VCO_EM()

        #self.pack(fill=BOTH, expand=True)

    def get_vals(self):
        if (self.VCO_EM.get()):
            EM_MODEL = True
            if (self.radio_fvco.get()):
                MEAS_FREQ = True
            else:
                MEAS_FREQ = False
        else:
            EM_MODEL = False
            MEAS_FREQ = False
        return (EM_MODEL, MEAS_FREQ)

    def on_FREQ(self):
        (EM_MODEL, MEAS_FREQ) = self.get_vals()
        vco = lms8001_vco(EM_MODEL=EM_MODEL, MEAS_FREQ=MEAS_FREQ)
        fvco = np.array(np.empty([3, 256]))
        for sel in range(1, 4):
            for freq in range(0, 256):
                fvco[sel - 1, freq] = vco.calcF(sel, freq, 0.6)

        figure(15)
        plt1, = plotsig(range(0, 256),
                        fvco[0, :] / 1.0e9,
                        15,
                        xlabel='$Cap. Bank Code$',
                        ylabel='$F_{VCO} [GHz]$',
                        title='VCO Frequency vs. Cap Bank Code',
                        line_color='black',
                        font_name=self.parent.font_name)
        plt2, = plotsig(range(0, 256),
                        fvco[1, :] / 1.0e9,
                        15,
                        xlabel='$Cap. Bank Code$',
                        ylabel='$F_{VCO} [GHz]$',
                        title='VCO Frequency vs. Cap Bank Code',
                        line_color='blue',
                        font_name=self.parent.font_name)
        plt3, = plotsig(range(0, 256),
                        fvco[2, :] / 1.0e9,
                        15,
                        xlabel='$Cap. Bank Code$',
                        ylabel='$F_{VCO} [GHz]$',
                        title='VCO Frequency vs. Cap Bank Code',
                        line_color='red',
                        font_name=self.parent.font_name)
        setlegend(15, [plt1, plt2, plt3],
                  ['VCO_SEL=1', 'VCO_SEL=2', 'VCO_SEL=3'],
                  font_name=self.parent.font_name)
        show_plots()

    def on_KVCO(self):
        (EM_MODEL, MEAS_FREQ) = self.get_vals()
        vco = lms8001_vco(EM_MODEL=EM_MODEL, MEAS_FREQ=MEAS_FREQ)
        fvco = np.array(np.empty([3, 256]))
        NDIV = np.array(np.empty([3, 256]))
        kvco = np.array(np.empty([3, 256]))
        for sel in range(1, 4):
            for freq in range(0, 256):
                fvco[sel - 1, freq] = vco.calcF(sel, freq, 0.6)
                kvco[sel - 1, freq] = vco.calcKVCO(sel, freq, 0.6)
                NDIV[sel - 1, freq] = 1.0 * fvco[sel - 1, freq] / self.pll.Fref

        for sel in range(1, 4):
            kvco_avg = 1.0
            kvco_over_NDIV_avg = 1.0
            for freq in range(0, 256):
                kvco_avg = kvco_avg * (kvco[sel - 1, freq] / 1.0e6)**(1.0 /
                                                                      256)
                kvco_over_NDIV_avg = kvco_over_NDIV_avg * (
                    (kvco[sel - 1, freq] / 1.0e6) /
                    NDIV[sel - 1, freq])**(1.0 / 256.0)

            print 'VCO_SEL=%d, KVCO_AVG=%.3f MHz/V, KVCO_over_NDIV_AVG=%.3f MHz/V' % (
                sel, kvco_avg, kvco_over_NDIV_avg)
        print ''

        figure(16)
        plt1, = plotsig(fvco[0, :] / 1.0e9,
                        kvco[0, :] / 1.0e6,
                        16,
                        xlabel='$F_{VCO} [GHz]$',
                        ylabel='$K_{VCO} [MHz/V]$',
                        title='VCO Sensitivity vs. Frequency',
                        line_color='black',
                        font_name=self.parent.font_name)
        plt2, = plotsig(fvco[1, :] / 1.0e9,
                        kvco[1, :] / 1.0e6,
                        16,
                        xlabel='$F_{VCO} [GHz]$',
                        ylabel='$K_{VCO} [MHz/V]$',
                        title='VCO Sensitivity vs. Frequency',
                        line_color='blue',
                        font_name=self.parent.font_name)
        plt3, = plotsig(fvco[2, :] / 1.0e9,
                        kvco[2, :] / 1.0e6,
                        16,
                        xlabel='$F_{VCO} [GHz]$',
                        ylabel='$K_{VCO} [MHz/V]$',
                        title='VCO Sensitivity vs. Frequency',
                        line_color='red',
                        font_name=self.parent.font_name)
        setlegend(16, [plt1, plt2, plt3],
                  ['VCO_SEL=1', 'VCO_SEL=2', 'VCO_SEL=3'],
                  font_name=self.parent.font_name)
        show_plots()

    def on_FSTEP(self):
        (EM_MODEL, MEAS_FREQ) = self.get_vals()
        vco = lms8001_vco(EM_MODEL=EM_MODEL, MEAS_FREQ=MEAS_FREQ)
        fstep = np.array(np.empty([3, 255]))
        for sel in range(1, 4):
            for freq in range(0, 255):
                fstep[sel - 1,
                      freq] = vco.calcF(sel, freq + 1, 0.6) - vco.calcF(
                          sel, freq, 0.6)

        figure(17)
        plt1, = plotsig(
            range(0, 255),
            fstep[0, :] / 1.0e6,
            17,
            xlabel='$Cap. Bank Code$',
            ylabel='$F_{STEP} [MHz/V]$',
            title='VCO Frequency Step Between Adjacent Tuning Bands',
            line_color='black',
            font_name=self.parent.font_name)
        plt2, = plotsig(
            range(0, 255),
            fstep[1, :] / 1.0e6,
            17,
            xlabel='$Cap. Bank Code$',
            ylabel='$F_{STEP} [MHz/V]$',
            title='VCO Frequency Step Between Adjacent Tuning Bands',
            line_color='blue',
            font_name=self.parent.font_name)
        plt3, = plotsig(
            range(0, 255),
            fstep[2, :] / 1.0e6,
            17,
            xlabel='$Cap. Bank Code$',
            ylabel='$F_{STEP} [MHz/V]$',
            title='VCO Frequency Step Between Adjacent Tuning Bands',
            line_color='red',
            font_name=self.parent.font_name)
        setlegend(17, [plt1, plt2, plt3],
                  ['VCO_SEL=1', 'VCO_SEL=2', 'VCO_SEL=3'],
                  font_name=self.parent.font_name)
        show_plots()

    def on_VCO_EM(self):
        if (self.VCO_EM.get()):
            self.radio_fvco_meas.config(state='enabled')
            self.radio_fvco_sim.config(state='enabled')
        else:
            self.radio_fvco_meas.config(state='disabled')
            self.radio_fvco_sim.config(state='disabled')

    def on_OK(self):
        self.on_Apply()
        self.on_Quit()

    def on_Quit(self):
        self.parent.vco_model_win = None
        self.destroy()

    def on_Apply(self):
        (EM_MODEL, MEAS_FREQ) = self.get_vals()
        self.parent.VCO_EM.set(EM_MODEL)
        self.parent.VCO_MEAS_FREQ.set(MEAS_FREQ)

        self.pll.vco = lms8001_vco(SEL=2,
                                   FREQ=128,
                                   EM_MODEL=EM_MODEL,
                                   MEAS_FREQ=MEAS_FREQ)
コード例 #21
0
class ConvertSPC:
    def __init__(self, master):
        self.master = master
        master.title("Convert SPC files")

        mf = Frame(master, padding="10")
        mf.grid(column=0, row=0, sticky=(N, W, E, S))
        mf.columnconfigure(0, weight=1)
        mf.rowconfigure(0, weight=1)
        self.message = "Enter folder containing *.SPC files"
        self.label_text = StringVar()
        self.folder = StringVar()
        self.output_fmt = StringVar()

        self.label_text.set(self.message)

        self.label = Label(mf, textvariable=self.label_text)
        self.folder_label = Label(mf, text="Folder")
        self.output_fmt_label = Label(mf, text="Output Format")

        self.fmt_txt = Radiobutton(mf, text="TXT", variable=self.output_fmt, value='txt')
        self.fmt_csv = Radiobutton(mf, text="CSV", variable=self.output_fmt, value='csv')
        self.folder_entry = Entry(mf, textvariable=self.folder)

        self.sel_foler = Button(mf, text="Browse", command=self.ask_dir)
        self.convert_btn = Button(mf, text="Convert", command=self.convert)

        # map on grid
        self.label.grid(row=0, column=0, columnspan=4, sticky=W + E)
        self.folder_label.grid(row=1, column=0, sticky=E)
        self.output_fmt_label.grid(row=2, column=0, sticky=E)
        self.folder_entry.grid(row=1, column=1, columnspan=2, sticky=W + E)
        self.fmt_txt.grid(row=2, column=1, sticky=W)
        self.fmt_csv.grid(row=2, column=2, sticky=W)
        self.sel_foler.grid(row=1, column=3, sticky=W)
        self.convert_btn.grid(row=3, column=1, columnspan=2, sticky=W + E)

        for child in mf.winfo_children():
            child.grid_configure(padx=5, pady=5)

    def convert(self):
        self.fol_val = str(self.folder.get())
        self.fmt_val = str(self.output_fmt.get())
        print("About to convert {} with {} ext".format(self.fol_val, self.fmt_val))

        if self.fmt_val == 'txt':
            exten = '.txt'
            delim = '\t'
        else:
            # defaults
            exten = '.csv'
            delim = ','

        flist = []

        # only directory here
        ffn = os.path.abspath(self.fol_val)
        for f in os.listdir(ffn):
            flist.append(os.path.join(ffn, f))

        # process files
        for fpath in flist:
            if fpath.lower().endswith('spc'):

                foutp = fpath[:-4] + exten
                try:
                    print(fpath, end=' ')
                    f = spc.File(fpath)
                    f.write_file(foutp, delimiter=delim)
                    print('Converted')
                except:
                    print('Error processing %s' % fpath)
            else:
                print('%s not spc file, skipping' % fpath)

    def ask_dir(self):
        self.folder.set(tkFileDialog.askdirectory())
コード例 #22
0
ファイル: reader-0-2.py プロジェクト: rcolasanti/Wheeze
    def initUI(self):
      
        self.parent.title("Graphs")
        self.style = Style()
        self.style.theme_use("clam")
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, weight=1)
        self.columnconfigure(6, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)
        
        menu = Menu(self.parent)
        self.parent.config(menu=menu)
        filemenu = Menu(menu)
        menu.add_cascade(label="File", menu=filemenu)
        filemenu.add_command(label="Load data",command = self.load_data)
        
        # lable to show current file and chanel
        self.file_lbl = Label(self, text="")
        self.file_lbl.grid(row = 0 , column = 3, pady=4, padx=5)
        
        # list box fro data files
        self.file_list =  ScrolledList(self,lambda x: self.load_hunt_data(x))
        self.file_list.grid(row=1, column=0, columnspan=3, rowspan=4, 
            padx=5, sticky=E+W+S+N)
        
        # chanel graph viewer
        self.graph_viewer = TkinterGraph(self)
        self.graph_viewer.grid(row=1, column=3, columnspan=2, rowspan=4, 
            padx=5, sticky=E+W+S+N)
        
        btn1 = Button(self, text="Left",command = lambda: self.plot_left())
        btn1.grid(row=1, column=6)

        btn2 = Button(self, text="Right", command = lambda:self.plot_right())
        btn2.grid(row=2, column=6, pady=4)
        
        # frames for the classifier for the two chanels 
        self.frame_left = Frame(self, borderwidth=1)
        self.frame_right = Frame(self, borderwidth=1)
        self.frame_left.grid(row=5,column=3,columnspan=2, rowspan=1)

        btn4 = Button(self, text="SAVE", command = lambda:self.save_graph())
        btn4.grid(row=5, column=6) 
        
        # note manual addition of labels so that the lable will be to the right of tha radio button 
        self.classify_left = StringVar()
        Label(self.frame_left,text="Left  :").pack(side=LEFT)
        Label(self.frame_left,text="Type A").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_left,variable=self.classify_left,value="TypeA")
        rb1.pack(side=LEFT)
        Label(self.frame_left,text="Type B").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_left,variable=self.classify_left,value="TypeB")
        rb1.pack(side=LEFT)
        Label(self.frame_left,text="Type C").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_left,variable=self.classify_left,value="TypeC")
        rb1.pack(side=LEFT)
        Label(self.frame_left,text="Type D").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_left,variable=self.classify_left,value="TypeD")
        rb1.pack(side=LEFT)
       
        
               
        self.classify_right = StringVar()
        Label(self.frame_right,text="Right  :").pack(side=LEFT)
        Label(self.frame_right,text="Type A").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,variable=self.classify_right,value="TypeA")
        rb1.pack(side=LEFT)
        Label(self.frame_right,text="Type B").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,variable=self.classify_right,value="TypeB")
        rb1.pack(side=LEFT)
        Label(self.frame_right,text="Type C").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,variable=self.classify_right,value="TypeC")
        rb1.pack(side=LEFT)
        Label(self.frame_right,text="Type D").pack(side=LEFT)
        rb1 = Radiobutton(self.frame_right,variable=self.classify_right,value="TypeD")
        rb1.pack(side=LEFT)
コード例 #23
0
	def setup_radio_buttons(self):
		'''add atemporal vs temporal choice part'''
		dct = self.user_input

		temporal_processing_flag = BooleanVar()

		# get context dependent frame (regular)
		regular = Raw2Attributes()
		regular_frame = regular.make_frame(self)
		reg_button = Radiobutton(self, text='raw2attributes', value=False, variable=temporal_processing_flag)
		reg_button.grid(row=11, column=0, sticky=W)

		# get context dependent frame (temporal)
		temporal = Raw2Patterns()
		temporal_frame = temporal.make_frame(self)
		tmprl_button = Radiobutton(self, text='raw2patterns', value=True, variable=temporal_processing_flag)
		tmprl_button.grid(row=11, column=1, sticky=W)

		# configure events, invoke one by default
		reg_button.configure(command=lambda : self.set_frame(regular_frame, temporal_frame))
		tmprl_button.configure(command=lambda : self.set_frame(temporal_frame, regular_frame))
		reg_button.invoke() # default
		
		dct['process_temporal'] = temporal_processing_flag
		dct['a-temporal_specific'] = regular.get_values()
		dct['temporal_specific'] = temporal.get_values()
コード例 #24
0
        class A_DWI:
            def __init__(self, container, frame, label='', text='', row=0, column=0):
                self.container = container
                self.is_b0 = BooleanVar(container.parent)
                self.is_dw = BooleanVar(container.parent)
                self.column = column
                self.direction = StringVar(container.parent)

                self.label_from = Label(frame, text='from')
                self.text_from = Entry(frame)
                self.text_from.insert(0, text)
                self.button_file_from = Button(frame, text='...', command=lambda:filenameDialog_text(self.text_from))
                self.button_rm = Button(frame, text='remove', command=self.click_remove)
                self.radio_ap = Radiobutton(frame, text='AP', variable=self.direction, value='AP', command=self.set_direction)
                self.radio_pa = Radiobutton(frame, text='PA', variable=self.direction, value='PA', command=self.set_direction)

                self.label_to = Label(frame, text='to')
                self.text_to = Entry(frame)
                #self.text_to.insert(0, text)
                self.button_file_to = Button(frame, text='Gen', command=self.set_filename_to)
                self.check_b0 = Checkbutton(frame, text='B0',   variable=self.is_b0)
                self.check_dw = Checkbutton(frame, text='DWI',  variable=self.is_dw)

                self.button_up = Button(frame, text='up', width=3, command=self.click_up)
                self.button_dn = Button(frame, text='down', width=3, command=self.click_dn)

                self.row = -1
                self.change_row(row)
                if text != '':
                    self.set_appa()
                    self.set_filename_to()

            def prefix(self):
                return self.container.parent.prefix()

            def set_direction(self):
                pass

            def get_dwi_filenames(self):
                '''
                :return: [('from', 'to'), ('from', 'to')]
                '''
                filename_from = self.text_from.get()
                filename_to = self.text_to.get()
                if self.is_dw.get():
                    rtn = [ [filename_from, filename_to] ]
                    filename_b_from = filename_wo_ext(filename_from)
                    filename_b_to = filename_wo_ext(filename_to)
                    rtn.append( [filename_b_from+'.bval', filename_b_to+'.bval'] )
                    rtn.append( [filename_b_from+'.bvec', filename_b_to+'.bvec'] )
                    return rtn
                return []

            def get_b0_filename(self):
                '''
                :return: [('from', 'to')]
                '''
                filename_from = self.text_from.get()
                filename_to = self.text_to.get()
                ext = extname(filename_to)
                if self.is_b0.get():
                    if self.is_dw.get():
                        filename_to = '%s_B0%s' % (filename_wo_ext(filename_to), ext)
                    return [ [filename_from, filename_to] ]
                return []

            def set_appa(self):
                filename_from = self.text_from.get()
                basename_from = os.path.basename(filename_from)
                basename_b_from = filename_wo_ext(basename_from)
                if 'pa' in basename_b_from.lower():
                    self.direction.set('PA')
                elif 'ap' in basename_b_from.lower():
                    self.direction.set('AP')
                else:
                    pass

            def set_filename_to(self, middle=None):
                filename_from = self.text_from.get()
                basename_from = os.path.basename(filename_from)
                number = os.path.dirname(filename_from).split('/')[-1].split('_')[0]
                if number == '':
                    number = str(self.row)
                else:
                    try:
                        int(number)
                    except:
                        number = str(self.row)


                ext = extname(basename_from)
                intermediate = self.direction.get()
                if intermediate == '':
                    intermediate = 'DWI'

                if self.is_b0.get() and not self.is_dw.get():
                    intermediate += '_B0'

                self.text_to.delete(0, len(self.text_to.get()))
                self.text_to.insert(0, '%s%s_%s%s' % (self.prefix(), number, intermediate, ext))

            def change_row(self, row):
                if self.row == row:
                    return
                self.row = row
                i = 2*row
                j = self.column
                j += 0; self.button_up.grid(row=i, column=j)
                j += 1; self.label_from.grid(row=i, column=j)
                j += 1; self.text_from.grid(row=i, column=j, sticky=EW)
                j += 1; self.button_file_from.grid(row=i, column=j)
                j += 1; self.button_rm.grid(row=i, column=j)
                j += 1; self.radio_ap.grid(row=i, column=j)
                j += 1; self.radio_pa.grid(row=i, column=j)
                i += 1
                j = 0
                j += 0; self.button_dn.grid(row=i, column=j)
                j += 1; self.label_to.grid(row=i, column=j)
                j += 1; self.text_to.grid(row=i, column=j, sticky=EW)
                j += 1; self.button_file_to.grid(row=i, column=j)
                j += 1
                j += 1; self.check_b0.grid(row=i, column=j)
                j += 1; self.check_dw.grid(row=i, column=j)

            def click_remove(self):
                self.container.remove(self.row)

                self.button_up.destroy()
                self.label_from.destroy()
                self.text_from.destroy()
                self.button_file_from.destroy()
                self.button_rm.destroy()
                self.radio_ap.destroy()
                self.radio_pa.destroy()
                self.button_dn.destroy()
                self.label_to.destroy()
                self.text_to.destroy()
                self.button_file_to.destroy()
                self.check_b0.destroy()
                self.check_dw.destroy()

            def click_up(self):
                self.container.up(self.row)
            def click_dn(self):
                self.container.dn(self.row)
コード例 #25
0
class guiDemo3(Frame):

    def __init__(self,parent):
        Frame.__init__(self,parent)

        self.parent = parent

        self.initUI() #start up the main menu

    def initUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.mainMenuLabel= Label(self, text="Main Menu")
            self.mainMenuLabel.pack(side=TOP,padx=5, pady=5)
            self.singleModeButton= Button(self, text="Single Computer Mode", command=self.unpackInitUI_LoadSingleComputerMode)
            self.singleModeButton.pack(side=TOP, padx=5, pady=5)
            self.networkModeButton= Button(self, text="Networking Mode", command=self.unpackInitUI_LoadNetworkMode)
            self.networkModeButton.pack(side=TOP, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in initUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="
    #end of initUI////////////////////////////

    def unpackInitUI_LoadSingleComputerMode(self):
        self.closeButton.pack_forget()
        self.mainMenuLabel.pack_forget()
        self.singleModeButton.pack_forget()
        self.networkModeButton.pack_forget()
        self.singleModeUI()

    def unpackInitUI_LoadNetworkMode(self):
        self.closeButton.pack_forget()
        self.mainMenuLabel.pack_forget()
        self.singleModeButton.pack_forget()
        self.networkModeButton.pack_forget()
        self.networkModeUI()

    def unpackSingleModeUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.singleModeLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.initUI()

    def unpackSingleModeUI_LoadSingleDictionaryUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.singleModeLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.dictionaryCrackingMethodUI(0)

    def unpackSingleModeUI_LoadSingleBruteForceUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.singleModeLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodUI(0)

    def unpackSingleModeUI_LoadSingleRainbowTableUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.singleModeLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodUI(0)

    def singleModeUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackSingleModeUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.singleModeLabel= Label(self, text="Single Computer Mode")
            self.singleModeLabel.pack(side=TOP, padx=5, pady=5)
            self.selectCrackingMethodLabel= Label(self, text="Select Your Cracking Method")
            self.selectCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.dictionaryCrackingMethodButton= Button(self, text="Dictionary", command=self.unpackSingleModeUI_LoadSingleDictionaryUI)
            self.dictionaryCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.bruteForceCrackingMethodButton= Button(self, text="Brute-Force (default)", command=self.unpackSingleModeUI_LoadSingleBruteForceUI)
            self.bruteForceCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.rainbowTableCrackingMethodButton= Button(self, text="Rainbow Table", command=self.unpackSingleModeUI_LoadSingleRainbowTableUI)
            self.rainbowTableCrackingMethodButton.pack(side=TOP, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in singleModeUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="


    def unpackNetworkModeUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkModeLabel.pack_forget()
        self.selectNetworkModuleLabel.pack_forget()
        self.serverModuleButton.pack_forget()
        self.clientModuleButton.pack_forget()
        self.initUI()

    def networkModeUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkModeUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.networkModeLabel= Label(self, text="Network Mode: Server/Client Selection Screen")
            self.networkModeLabel.pack(side=TOP, padx=5, pady=5)
            self.selectNetworkModuleLabel= Label(self, text="Select Server or Client")
            self.selectNetworkModuleLabel.pack(side=TOP, padx=5, pady=5)
            self.serverModuleButton= Button(self, text="I am the Server", command= self.unpackNetworkModeUI_LoadNetworkServerUI)
            self.serverModuleButton.pack(side=TOP, padx=5, pady=5)
            self.clientModuleButton= Button(self, text="I am a Client", command= self.unpackNetworkModeUI_LoadNetworkClientUI)
            self.clientModuleButton.pack(side=TOP, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in networkModeUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="

    def unpackNetworkModeUI_LoadNetworkServerUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkModeLabel.pack_forget()
        self.selectNetworkModuleLabel.pack_forget()
        self.serverModuleButton.pack_forget()
        self.clientModuleButton.pack_forget()
        self.networkServerUI()

    def unpackNetworkModeUI_LoadNetworkClientUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkModeLabel.pack_forget()
        self.selectNetworkModuleLabel.pack_forget()
        self.serverModuleButton.pack_forget()
        self.clientModuleButton.pack_forget()
        self.networkClientUI()

    def unpackNetworkClientUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkClientLabel.pack_forget()
        self.insertServerIPLabel.pack_forget()
        self.insertServerIPTextfield.pack_forget()
        self.startClientButton.pack_forget()
        self.initUI()

    def networkClientUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkClientUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.networkClientLabel= Label(self, text="Network Client")
            self.networkClientLabel.pack(side=TOP, padx=5, pady=5)
            self.insertServerIPLabel= Label(self, text="Enter in the Server's IP:")
            self.insertServerIPLabel.pack(side=TOP, padx=5, pady=5)
            self.insertServerIPTextfield= Entry(self, bd=5)
            self.insertServerIPTextfield.pack(side=TOP, padx=5, pady=5)
            self.startClientButton= Button(self, text="Start Client", command=lambda:self.startClient(str(self.insertServerIPTextfield)))
            self.startClientButton.pack(side=TOP, padx=5, pady=5)
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in networkClientUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="

    def startClient(self,inputIP):
        try:
            if(len(inputIP) < 1):
                showwarning("Network Client Start Warning: NO IP","No IP address has been entered!")
            else:
                self.networkClient= Process(target=Client, args=(inputIP,))
                self.networkClient.start()
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in startClient definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="

    def unpackNetworkServerUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkServerLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.initUI()

    def networkServerUI(self):
        try:
            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackNetworkServerUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.networkServerLabel= Label(self, text="Network Server")
            self.networkServerLabel.pack(side=TOP, padx=5,  pady=5)
            self.selectCrackingMethodLabel= Label(self, text="Select Your Cracking Method")
            self.selectCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.dictionaryCrackingMethodButton= Button(self, text="Dictionary", command=self.unpackNetworkServerUI_LoadNetworkDictionaryUI)
            self.dictionaryCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.bruteForceCrackingMethodButton= Button(self, text="Brute-Force (default)", command=self.unpackNetwrokServerUI_LoadNetworkBruteForceUI)
            self.bruteForceCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
            self.rainbowTableCrackingMethodButton= Button(self, text="Rainbow Table", command=self.unpackNetworkServerUI_LoadNetworkRainbowTableUI)
            self.rainbowTableCrackingMethodButton.pack(side=TOP, padx=5, pady=5)
        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in networkServerUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="

    def unpackNetworkServerUI_LoadNetworkDictionaryUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkServerLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.dictionaryCrackingMethodUI(1)

    def unpackNetwrokServerUI_LoadNetworkBruteForceUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkServerLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodUI(1)

    def unpackNetworkServerUI_LoadNetworkRainbowTableUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.networkServerLabel.pack_forget()
        self.selectCrackingMethodLabel.pack_forget()
        self.dictionaryCrackingMethodButton.pack_forget()
        self.bruteForceCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodButton.pack_forget()
        self.rainbowTableCrackingMethodUI(1)

    def unpackDictionaryCrackingMethodUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.dictionaryCrackingMethodLabel.pack_forget()
        self.currentModeLabel.pack_forget()
        self.dictionaryFileLocationLabel.pack_forget()
        self.selectedDictionaryFileLabel.pack_forget()
        self.selectDictionaryFileButton.pack_forget()
        self.inputHashTextFieldLabel.pack_forget()
        self.inputHashTextField.pack_forget()
        self.selectAlgorithmLabel.pack_forget()
        self.md5RadioButton.pack_forget()
        self.sha1RadioButton.pack_forget()
        self.sha224RadioButton.pack_forget()
        self.sha256RadioButton.pack_forget()
        self.sha512RadioButton.pack_forget()
        self.startDictionaryCrackButton.pack_forget()
        self.initUI()

    def dictionaryCrackingMethodUI(self,mode):
        #mode is either 1 (network) or 0 (single)
        currentMode= "ERROR: Mode not selected" #initialize variable
        selectedDictionaryFile= "No Dictionary file has been selected"
        selectedAlgorithm= "MD5" #set to md5 as the default
        try:
            if(mode == 0):
                currentMode= "Single"
            elif(mode == 1):
                currentMode= "Network"
            else:
                raise Exception("ERROR: Invalid mode parameter: '"+str(mode)+"'")

            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackDictionaryCrackingMethodUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            if(currentMode is 'Single'):
                self.startDictionaryCrackButton= Button(self, text="Start Dictionary Crack (Single Mode)")
                self.startDictionaryCrackButton.pack(side=BOTTOM, padx=5, pady=5)
                 #TODO create call method to start the dictionary crack
            elif(currentMode is 'Network'):
                self.startDictionaryCrackButton= Button(self, text="Start Dictionary Crack (Network Mode)")
                self.startDictionaryCrackButton.pack(side=BOTTOM, padx=5, pady=5)
                 #TODO create call method to start the dictionary crack
            else:
                raise Exception("GUI ERROR: Invalid currentMode in startDictionaryCrackButton: '"+str(currentMode)+"'")


            self.dictionaryCrackingMethodLabel= Label(self, text="Dictionary Cracking Method")
            self.dictionaryCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.currentModeLabel = Label(self,text="Current Mode: "+str(currentMode))
            self.currentModeLabel.pack(side=TOP, padx=5, pady=5)
            self.dictionaryFileLocationLabel= Label(self, text="Dictionary File to be used:")
            self.dictionaryFileLocationLabel.pack(side=TOP, padx=5, pady=5)
            self.selectedDictionaryFileLabel= Label(self, text=str(selectedDictionaryFile))
            self.selectedDictionaryFileLabel.pack(side=TOP, padx=5, pady=5)
            self.selectDictionaryFileButton= Button(self, text="Select Dictionary File", command=self.selectFileWindow)
            self.selectDictionaryFileButton.pack(side=TOP, padx=5, pady=5)
            self.inputHashTextFieldLabel= Label(self, text="The hash to be cracked:")
            self.inputHashTextFieldLabel.pack(side=TOP, padx=5, pady=5)
            self.inputHashTextField= Entry(self, bd=5)
            self.inputHashTextField.pack(side=TOP, padx=5, pady=5)
            self.selectAlgorithmLabel = Label(self, text="Select the Cracking Algorithm:")
            self.selectAlgorithmLabel.pack(side=TOP, padx=5, pady=5)
            self.md5RadioButton=  Radiobutton(self, text="MD5 (default)", variable= selectedAlgorithm, value="MD5" )
            self.md5RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha1RadioButton= Radiobutton(self, text="SHA 1", variable= selectedAlgorithm, value="SHA 1")
            self.sha1RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha224RadioButton= Radiobutton(self, text="SHA 224", variable= selectedAlgorithm, value="SHA 224")
            self.sha224RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha256RadioButton= Radiobutton(self, text="SHA 256", variable= selectedAlgorithm, value="SHA 256")
            self.sha256RadioButton.pack(side=LEFT, padx=5, pady=5)
            self.sha512RadioButton= Radiobutton(self, text="SHA 512", variable= selectedAlgorithm, value="SHA 512")
            self.sha512RadioButton.pack(side=LEFT, padx=5, pady=5)

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in dictionaryCrackingMethodUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="



    def unpackBruteForceCrackingMethodUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.inputHashTextFieldLabel.pack_forget()
        self.inputHashTextField.pack_forget()
        self.bruteForceCrackingMethodLabel.pack_forget()
        self.currentModeLabel.pack_forget()
        self.startBruteForceCrackButton.pack_forget()
        self.outputHashTextFieldLabel.pack_forget()
        self.outputHashTextField.pack_forget()
        self.initUI()

    def bruteForceCrackingMethodUI(self, mode):
        #mode is either 1 (network) or 0 (single)
        currentMode= None
        try:
            if(mode==0):
                currentMode= "Single"
            elif(mode ==1):
                currentMode= "Network"
            else:
                raise Exception("ERROR: Invalid mode parameter: '"+str(mode)+"'")

            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackBruteForceCrackingMethodUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            if(currentMode is 'Single'):
                self.startBruteForceCrackButton= Button(self, text="Start Brute-Force Crack (Single Mode)")
                self.startBruteForceCrackButton.pack(side=BOTTOM, padx=5, pady=5)
                #TODO create call method to start the brute force crack
            elif(currentMode is 'Network'):
                self.startBruteForceCrackButton= Button(self, text="Start Brute-Force Crack (Network Mode)")
                self.startBruteForceCrackButton.pack(side=BOTTOM, padx=5, pady=5)
                #TODO create call method to start the brute force crack
            else:
                raise Exception ("GUI ERROR: Invalid currentMode in startBruteForceCrackButton: '"+str(currentMode)+"'")
            self.bruteForceCrackingMethodLabel = Label(self, text="Brute-Force Cracking Method")
            self.bruteForceCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.currentModeLabel= Label(self, text="Current Mode: "+str(currentMode))
            self.currentModeLabel.pack(side=TOP, padx=5, pady=5)
            self.inputHashTextFieldLabel= Label(self, text="The hash to be cracked:")
            self.inputHashTextFieldLabel.pack(side=TOP, padx=5, pady=5)
            self.inputHashTextField= Entry(self, bd=5)
            self.inputHashTextField.pack(side=TOP, padx=5, pady=5)

            #self.selectAlgorithmLabel = Label(self, text="Select the Cracking Algorithm:")
            #self.selectAlgorithmLabel.pack(side=TOP, padx=5, pady=5)
            #self.md5RadioButton=  Radiobutton(self, text="MD5 (default)", value="MD5" )
            #self.md5RadioButton.pack(side=LEFT, padx=5, pady=5)
            #self.sha1RadioButton= Radiobutton(self, text="SHA 1", value="SHA 1")
            #self.sha1RadioButton.pack(side=LEFT, padx=5, pady=5)
            #self.sha224RadioButton= Radiobutton(self, text="SHA 224", value="SHA 224")
            #self.sha224RadioButton.pack(side=LEFT, padx=5, pady=5)
            #self.sha256RadioButton= Radiobutton(self, text="SHA 256", value="SHA 256")
            #self.sha256RadioButton.pack(side=LEFT, padx=5, pady=5)
            #self.sha512RadioButton= Radiobutton(self, text="SHA 512", value="SHA 512")
            #self.sha512RadioButton.pack(side=LEFT, padx=5, pady=5)


            #self.selectAlgorithm =

            #This will display the results, could set to show up after the program is run.
            self.outputHashTextFieldLabel= Label(self, text="Results")
            self.outputHashTextFieldLabel.pack(side=TOP, padx=5, pady=5)
            self.outputHashTextField= Entry(self, bd=5)
            self.outputHashTextField.insert(0, "Test")
            #This will disable modification but you cant hightlight and copy it.
            #self.outputHashTextField.config(state='disabled')
            self.outputHashTextField.pack(side=TOP,padx=5, pady=5)



        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in bruteForceCrackingMethodUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="

    def unpackRainbowTableCrackingMethodUI_LoadInitUI(self):
        self.closeButton.pack_forget()
        self.returnToInitUIButton.pack_forget()
        self.rainbowTableCrackingMethodLabel.pack_forget()
        self.currentModeLabel.pack_forget()
        self.initUI()

    def rainbowTableCrackingMethodUI(self, mode):
        #mode is either 1 (network) or 0 (single)
        currentMode= None
        try:
            if(mode == 0):
                currentMode = "Single"
            elif(mode == 1):
                currentMode = "Network"
            else:
               raise Exception("ERROR: Invalid mode parameter: '"+str(mode)+"'")

            self.parent.title("Mighty Cracker")
            self.style = Style()
            self.style.theme_use("default")

            self.pack(fill=BOTH, expand=1)

            #load buttons and labels
            self.closeButton= Button(self, text="Close Program", command=self.confirmExit)
            self.closeButton.pack(side=BOTTOM, padx=5, pady=5)
            self.returnToInitUIButton= Button(self, text="Return to Main Menu", command=self.unpackRainbowTableCrackingMethodUI_LoadInitUI)
            self.returnToInitUIButton.pack(side=BOTTOM, padx=5, pady=5)
            self.rainbowTableCrackingMethodLabel= Label(self, text="Rainbow Table Cracking Method")
            self.rainbowTableCrackingMethodLabel.pack(side=TOP, padx=5, pady=5)
            self.currentModeLabel= Label(self,text="Current Mode: "+str(currentMode))
            self.currentModeLabel.pack(side=TOP, padx=5, pady=5)
            #TODO insert Rainbow table settings here

        except Exception as inst:
            print "============================================================================================="
            print "GUI ERROR: An exception was thrown in rainbowTableCrackingMethodUI definition Try block"
            #the exception instance
            print type(inst)
            #srguments stored in .args
            print inst.args
            #_str_ allows args tto be printed directly
            print inst
            print "============================================================================================="

    def selectFileWindow(self):
        filename= ""
        filename= askopenfilename()
        self.selectedDictionaryFileLabel.config(text=str(filename))


    def confirmExit(self):
        result= askyesno('Exit Confirmation', 'Are you sure you want to quit this application? \n (WARNING: All server, client, and single computer processes will be terminated!!)')
        if result == True:
            self.onExit()
        #if no is selected, then the window just closes


    def onExit(self):
        self.quit()