text
stringlengths
1
93.6k
if value:
investigation_id = value
else:
investigation_id = self.selection.get()
try:
iid, data = self.db_handler.open_investigation(investigation_id)
for target in data:
for transform in data[target]:
pockint.treeview.insert(pockint.getID(target), "end", values=(transform[0], transform[1]))
pockint.investigation_id_tracker = iid
self.quit_open()
except Exception as e:
print("[*] Error: ", e)
self.quit_open()
def quit_open(self):
"""Quits the open window"""
self.db_handler.close_connection()
self.destroy()
class DeleteTool(tk.Toplevel):
"""Opens a window to retrieve investigation data"""
def __init__(self, master=None, *args, **kwargs):
"""Initializes Toplevel object and builds interface"""
super().__init__(master, *args, **kwargs)
# initialize variables
self.selection = tk.StringVar(self)
# initialize database
self.db_handler = Database()
# hide window in background during drawing and load, to prevent flickering and glitches during frame load
self.withdraw()
# build and draw the window
self.build()
# unhide the Toplevel window immediately after draw and load
self.after(0, self.deiconify)
def build(self):
"""Initializes and builds application widgets"""
# create input labelframe
labelframe_1 = tk.LabelFrame(self, fg='brown')
labelframe_1.pack(side="top", expand='yes', fill='both', padx=2, pady=2, anchor="n")
# create explanation label
self.label = tk.Label(labelframe_1, text='Delete...')
self.label.pack(expand=True, fill='x', side="left", padx=2, pady=2)
# create data input entry widget
self.options = tk.OptionMenu(labelframe_1, self.selection, *self.db_handler.retrieve_investigation_ids(),
command=self.delete_data)
self.options.pack(expand=True, fill='x', side="left", padx=2, pady=2)
self.selection.set(self.db_handler.retrieve_investigation_ids()[0])
# create save button
self.save_button = tk.Button(labelframe_1, text="Delete", command=self.delete_data)
self.save_button.pack(expand=False, side="left", padx=2, pady=2, anchor="e")
# create cancel button
self.cancel_button = tk.Button(labelframe_1, text="Cancel", command=self.quit)
self.cancel_button.pack(expand=False, side="left", padx=2, pady=2, anchor="e")
def delete_data(self, value=None):
"""Deletes investigation data from database"""
if value:
investigation_id = value
else:
investigation_id = self.selection.get()
try:
self.db_handler.delete_investigation(investigation_id)
self.quit()
except Exception as e:
print("[*] Error: ", e)
self.quit()
def quit(self):
"""Quits the open window"""
self.db_handler.close_connection()
self.destroy()
class ApiTool(tk.Toplevel):
"""Opens a new window providing users ability to input api keys"""
def __init__(self, master=None, *args, **kwargs):
"""Initializes Toplevel object and builds interface"""
super().__init__(master, *args, **kwargs)
self.db_handler = Database()
# hide window in background during drawing and load, to prevent flickering and glitches during frame load
self.withdraw()
# build and draw the window
self.build()
# unhide the Toplevel window immediately after draw and load
self.after(0, self.deiconify)
def build(self):
"""Initializes and builds application widgets"""
# create input labelframe
labelframe_1 = tk.LabelFrame(self, text="api key manager", fg='brown')
labelframe_1.pack(side="top", expand='yes', fill='both', padx=2, pady=2, anchor="n")