def handle_u_key_verify(u_key_ui, u_key_dialog): u_key_ui.pushButton_verify.setText("正在验证...") QtWidgets.QApplication.processEvents() if len(u_key_ui.lineEdit_password.text()) < 6: msg_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Warning, '警告', '口令应为6位整数。') msg_box.exec_() u_key_ui.pushButton_verify.setText("验证") QtWidgets.QApplication.processEvents() return # res=True res = RequestManager.make_get_request("/v1.0/ukey/verify?code={}".format( u_key_ui.lineEdit_password.text())) print(res) # if res : if True: u_key_dialog.accept() else: msg_box = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Warning, '警告', '口令不正确,请重新输入。') msg_box.exec_() u_key_ui.pushButton_verify.setText("验证") QtWidgets.QApplication.processEvents()
def run(self): # net_info=json.loads(requests.get("http://localhost/v1.0/native/get_usb_storage_device_using_records").content) from requests_manager import RequestManager net_info=RequestManager.make_get_request('/v1.0/native/get_usb_storage_device_using_records') self._signal.emit(net_info); # 信号发送
def run(self): # net_info = json.loads(requests.get( # "http://localhost/v1.0/native/get_file_access_records").content) from requests_manager import RequestManager net_info=RequestManager.make_get_request('/v1.0/native/get_file_access_records') self._signal.emit(net_info) # 信号发送
def get_file_info(self): # postdatas = { # "scan_path": ["C://Users//long//Desktop//audit", ], # "file_suffix": [".wps", ".doc", "docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".xlsx"], # "keywords_list": ["秘密", "机密"], # "min_filesize": 1024, # "max_filesize": 1024000000, # "switches": { # "size_switch": True, # } # } # headers = {"Content-Type": "application/json","Accept": "application/json", } # dis_task = requests.post('http://localhost/v1.0/pc/files/scan',data=json.dumps(self.post_info), headers=headers).content # dis_task = json.loads(dis_task) dis_task = RequestManager.make_post_request("/v1.0/pc/files/scan", self.post_info) # dis_task = json.loads(dis_task) data = {"task_id": dis_task["task_id"], "page_size": 1} while True: # net_info = requests.get("http://localhost/v1.0/files/scan/status?task_id={}&page_size={}".format(data["task_id"],data["page_size"])).content.decode('unicode-escape') # # 返回结果中含有 \ ,使得json.loads无法解析,所以需要将返回结果中的 \ 替换为 \\ # net_info = net_info.replace("\\", "\\\\") # net_info = json.loads(net_info) net_info = RequestManager.make_get_request( "/v1.0/files/scan/status?task_id={}&page_size={}".format( data["task_id"], data["page_size"])) if len(net_info["results"]) == 0: self._signal.emit({}, net_info["progress"], net_info["status"], data["task_id"]) for result in net_info["results"]: self._signal.emit(result, net_info["progress"], net_info["status"], data["task_id"]) if net_info["status"] == "finished": break
def start_dlan_gui(server_port: int): RequestManager.on_port_ready(server_port) app = QtWidgets.QApplication(sys.argv) u_key_dialog = QtWidgets.QDialog() u_key_ui = u_key.Ui_Dialog() u_key_ui.setupUi(u_key_dialog) u_key_dialog.setWindowIcon(QtGui.QIcon('icon/logo.png')) u_key_dialog.setWindowTitle("帝岚科技计算机终端保密检查系统") u_key_ui.pushButton_verify.clicked.connect( lambda: handle_u_key_verify(u_key_ui, u_key_dialog)) from PyQt5.QtGui import QIntValidator u_key_ui.lineEdit_password.setValidator(QIntValidator(0, 999999)) u_key_dialog.show() if u_key_dialog.exec_() == QtWidgets.QDialog.Accepted: # app = QtWidgets.QApplication(sys.argv) main_window = Main_window() main_window.setWindowIcon(QtGui.QIcon('icon/logo.png')) main_window.setWindowTitle("帝岚科技计算机终端保密检查系统") print(main_window.width()) # main_window.resize(main_window.width(),main_window.width()*0.6) main_window.show() app.exec()
def get_file_info(self): data = {"task_id": self.task_id, "page_size": 1} while True: # net_info = requests.get("http://localhost/v1.0/files/scan/status?task_id={}&page_size={}".format(data["task_id"],data["page_size"])).content.decode('unicode-escape') # # 返回结果中含有 \ ,使得json.loads无法解析,所以需要将返回结果中的 \ 替换为 \\ # net_info = net_info.replace("\\", "\\\\") # net_info = json.loads(net_info) net_info = RequestManager.make_get_request( "/v1.0/files/scan/status?task_id={}&page_size={}".format( data["task_id"], data["page_size"])) for result in net_info["results"]: self._signal.emit(result, net_info["progress"], net_info["status"], data["task_id"]) if net_info["status"] == "finished": break
def run(self): # 需要替换 net_info = RequestManager.make_get_request( '/v1.0/native/get_system_logs_records') self._signal.emit(net_info)
def run(self): print("run") from requests_manager import RequestManager status_bar_info = j = RequestManager.make_get_request( '/v1.0/app/footer/info') self._signal_status.emit(status_bar_info)
def run(self): # 需要替换 net_info = RequestManager.make_get_request( '/v1.0/native/get_users_groups_records') self._signal.emit(net_info)
def run(self): while True: if not RequestManager.is_server_ready(): self._signal.emit(False) time.sleep(1)
def run(self): # net_info=json.loads(requests.get("http://localhost/v1.0/native/get_installed_anti_virus_software_records").content) from requests_manager import RequestManager net_info = RequestManager.make_get_request( '/v1.0/native/get_installed_anti_virus_software_records') self._signal.emit(net_info)
def run(self): # net_info = json.loads(requests.get("http://localhost/v1.0/harddisks/info").content) from requests_manager import RequestManager net_info=RequestManager.make_get_request('/v1.0/harddisks/info') self._signal.emit(net_info) # 信号发送
def run(self): net_info = RequestManager.make_get_request('/v1.0/pc/network') com_info = RequestManager.make_get_request('/v1.0/pc/info') self._signal.emit(net_info, com_info)
def run(self): # 需要替换 net_info = RequestManager.make_get_request( '/v1.0/native/get_power_off_records') self._signal.emit(net_info)
def run(self): # 需要替换 net_info = RequestManager.make_get_request( '/v1.0/native/get_deleted_files_records') self._signal.emit(net_info)
def run(self): # net_info=json.loads(requests.get("http://localhost/v1.0/native/get_all_usb_device_records").content) net_info = RequestManager.make_get_request( '/v1.0/native/get_all_usb_device_records') self._signal.emit(net_info)
def run(self): # 需要替换 net_info = RequestManager.make_get_request( '/v1.0/native/get_current_network_records') self._signal.emit(net_info)