(self)
| 202 | self.ui.tableWidget.resizeColumnsToContents() |
| 203 | # 加载cmdline到table |
| 204 | def load_cmdline_to_table(self): |
| 205 | cmdlinedata = 'output\cmdline.txt' |
| 206 | with open(cmdlinedata, "r") as f: |
| 207 | #正则匹配:pattern = r'(\w+\.exe)\s*pid:\s*(\d+)\s*Command line\s*:\s*(.*)' |
| 208 | pattern = r'(\w+\.exe)\s*pid:\s*(\d+)\s*Command line\s*:\s*(.*)' |
| 209 | matches = re.findall(pattern , f.read()) |
| 210 | newheader = ['ProcessName','PID','CommandLine'] |
| 211 | #写入csv文件 |
| 212 | with open('output\cmdline.csv', 'w', newline='') as f: |
| 213 | writer = csv.writer(f) |
| 214 | writer.writerow(newheader) |
| 215 | for match in matches: |
| 216 | writer.writerow(match) |
| 217 | with open('output\cmdline.csv', "r") as f: |
| 218 | lines = f.readlines() |
| 219 | lines = [line for line in lines if line.strip()] |
| 220 | lines = [line.strip().split(',') for line in lines] |
| 221 | |
| 222 | self.ui.tableWidget.setRowCount(len(lines)) |
| 223 | self.ui.tableWidget.setColumnCount(len(lines[0])) |
| 224 | for i, row in enumerate(lines): |
| 225 | for j, col in enumerate(row): |
| 226 | self.ui.tableWidget.setItem(i, j, QTableWidgetItem(col)) |
| 227 | self.ui.tableWidget.resizeColumnsToContents() |
| 228 | # 搜索字符串 |
| 229 | def find_regex_in_large_file(self,file_path, regex): |
| 230 | #取WindowTitle标题 |
nothing calls this directly
no outgoing calls
no test coverage detected