def __init__(self, gui): self.run_scan = True self.configuration = fileio.read_config() self.gui = gui self.addr_queue = queue.Queue() self.record_list = [] self.results_list = tk.Listbox
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # Make sure to call this when overriding parent methods self.title('Network Crawler v0.1') GUI.build_gui(self) self.configuration = fileio.read_config() self.net_mon = scanner.NetworkMonitor(self) self.MAX_THREADS = 256 GUI.update_status(self, 'Press "Start" to begin search')
def config_window(self): self.configuration = fileio.read_config() config_win = tk.Toplevel() config_frame = tk.Frame(config_win) config_win.wm_title("Configuration") config_label = tk.Label(config_frame, text="Configuration", font=('Helvetica', 10, 'bold')).pack(side='top') config_frame.grid(row=0, column=0) config_win.resizable(False, False) '''IP Prefix Selection''' ip_frame = tk.Frame(config_win) ip_desc_label = tk.Label(ip_frame, text="Network prefix ").pack(side='left') prefix1_val = tk.StringVar() prefix2_val = tk.StringVar() prefix1_val.set(self.configuration['IP_PREFIX'][0]) prefix2_val.set(self.configuration['IP_PREFIX'][1]) ip_prefix_form1 = tk.Entry(ip_frame, textvariable=prefix1_val, width=5).pack(side='left') dot = tk.Label(ip_frame, text=" . ").pack(side='left') ip_prefix_form2 = tk.Entry(ip_frame, textvariable=prefix2_val, width=5).pack(side='left') ip_suffix = tk.Label(ip_frame, text=" . X . X").pack(side='left') ip_frame.grid(row=1, column=0, pady=5, sticky='w') '''Reports''' report_frame = tk.Frame(config_win) report_label = tk.Label(report_frame, text="Report frequency ").pack(side='left') report_freq = ['Live', '1 hour', '6 hours', '12 hours', '24 hours', 'Never'] freq_choice = tk.StringVar(self) freq_choice.set(self.configuration['REPORT']) freq_menu = tk.OptionMenu(report_frame, freq_choice, *report_freq).pack(side='left') report_frame.grid(row=2, column=0, pady=5, sticky='w') '''Discovery Type''' discovery_frame = tk.Frame(config_win) report_label = tk.Label(discovery_frame, text="Discovery method ").pack(side='left') disc_choice = tk.StringVar(self) disc_choice.set(self.configuration['DISCOVERY']) disc_menu = tk.OptionMenu(discovery_frame, disc_choice, *['ARP', 'Ping']).pack(side='left') discovery_frame.grid(row=3, column=0, pady=5, sticky='w') '''Thread Slider''' thread_frame = tk.Frame(config_win) thread_label = tk.Label(thread_frame, text="Threads").pack(side='left') thread_slider = tk.Scale(thread_frame, from_=8, to=self.MAX_THREADS, resolution=8, length=150, orient='horizontal') thread_slider.set(self.configuration['THREADS']) thread_slider.pack(side='left') thread_frame.grid(row=5, column=0, pady=5, sticky='w') '''Save Button''' save_button = tk.Button(config_win, text="Save", command=lambda: (fileio.save_config(prefix1_val.get(), prefix2_val.get(), freq_choice.get(), disc_choice.get(), thread_slider.get()), config_win.destroy())) # Could probably be cleaned up (pass dict?) save_button.grid(row=6, column=0, pady=5) config_win.grab_set() # Modal
# ============================================== # If the script is reading data from RESFET, # then we need to decode the log data. After the # decoding is done, we also need to calibrate # using RESFET Dashboard config. # ============================================== if settings["--type"] == "dashboard": print("Using 'dashboard' logs. Skipping decoding and calibration...\n") pass elif settings["--type"] == "resfet": print("Using 'resfet' logs. Performing decoding and calibration...\n") # Create a temporary directory to store decoded logs. tempdir = tempfile.TemporaryDirectory() calibrations = fileio.read_config(settings["--config"]) source_logs = fileio.decode_calibrate_logs(source_logs, calibrations, tempdir.name) else: print( "Wrong --type entered. This program only accepts 'dashboard' and 'resfet' as arguments for --type." ) exit() # ============================================== # Perform data analysis. # ============================================== sources = {} for source in source_logs: