def pBtnSetGCPip_function(self): print("GCP IP List Set Buttun Pressed.") # Load file path with easygui & Load IP List filePath = fopen.OpenWinFileExplorer() self.gcp_ipListPath.setText(filePath) print(self.gcp_ipListPath.text()) try: ip_text = open(self.gcp_ipListPath.text(), "r", encoding='utf8') except IOError: print("No File.") return 0 self.ip_list = ip_text.read().strip().split("\n") print("IP List: ", self.ip_list) tkWindow = Tk() # show IP List with Tk tkWindow.geometry("220x200") tkWindow.title("IP LIST") labeltxt = "Number of Collectors: " + str(len(self.ip_list)) tkLabel = Label(tkWindow, text=labeltxt) tkLabel.pack() ipListBox = Listbox(tkWindow) for i in range(0, len(self.ip_list)): ipListBox.insert(i + 1, self.ip_list[i]) ipListBox.pack(side="left", fill="both", expand=True) tkWindow.mainloop() print("GCP IP List Set Buttun Finish.") ip_text.close()
def pBtnGCP_OpenTargetList_function(self): print("GCP Target List Open Pressed") filePath = fopen.OpenWinFileExplorer() self.gcp_TargetListPath.setText(filePath) print(self.gcp_TargetListPath.text()) try: url_list = [] with open(self.gcp_TargetListPath.text(), "r", encoding='utf8') as f: for line in f: url_list.append(line) print(url_list) tkURLWindow = Tk() # show IP List with Tk tkURLWindow.geometry("320x300") tkURLWindow.title("URL LIST") labeltxt = "Number of Collectors: " + str(len(url_list)) tkLabel = Label(tkURLWindow, text=labeltxt) tkLabel.pack() urlListBox = Listbox(tkURLWindow) for i in range(0, len(url_list)): urlListBox.insert(i + 1, url_list[i]) urlListBox.pack(side="left", fill="both", expand=True) tkURLWindow.mainloop() except IOError: print("No File.") return 0 print("GCP Target List Open Finish")
def fileOpen_Btn_function(self): print("[*] fileOpen_Btn_function") dirPath = fopen.OpenWinFileExplorer() print(" directory path: ", dirPath) self.filePath.setText(dirPath)