7
7
import subprocess
8
8
from colorama import Fore , Back , Style
9
9
import csv
10
- import re
11
10
import shutil
12
11
from PySide6 import QtGui
13
12
import convert .netstat
14
13
import convert .loadcsv
15
14
import vol2find
16
15
import pandas as pd
17
16
from PySide6 import QtWidgets
17
+ import re
18
18
19
19
20
20
class CommandRunner (QThread ):
@@ -41,7 +41,7 @@ def __init__(self):
41
41
self .setWindowIcon (QtGui .QIcon ('res/ico.jpg' ))
42
42
#长宽不允许修改
43
43
self .setFixedSize (self .width (), self .height ())
44
- self .actionOpenFile .triggered .connect (self .open_file )
44
+ self .actionOpenFile .triggered .connect (self .open_file_select )
45
45
self .actionOpenFile .setShortcut ('Ctrl+O' )
46
46
self .actionOpenFile .setStatusTip ('打开文件' )
47
47
self .setContextMenuPolicy (Qt .CustomContextMenu )
@@ -147,6 +147,12 @@ def dropEvent(self, event):
147
147
if event .mimeData ().hasUrls ():
148
148
file_path = event .mimeData ().urls ()[0 ].toLocalFile ()
149
149
self .open_file (file_path )
150
+
151
+ #打开文件
152
+ def open_file_select (self ):
153
+ file_path , _ = QFileDialog .getOpenFileName (self , '打开文件' , '' , '内存镜像文件 (*.raw)' )
154
+ if file_path :
155
+ self .open_file (file_path )
150
156
151
157
def open_file (self , file_path ):
152
158
self .file_name = file_path
@@ -284,29 +290,29 @@ def ntfsfind(self):
284
290
str1 = self .lineEdit_str .text ()
285
291
files = r'M:\forensic\csv\timeline_ntfs.csv'
286
292
result = []
287
- with open (files , 'r' ,encoding = 'UTF-8' ) as file :
293
+ with open (files , 'r' , encoding = 'UTF-8' ) as file :
288
294
for line in file :
289
- if str1 in line :
295
+ if re . search ( str1 , line , re . IGNORECASE ) :
290
296
result .append (line )
291
- #pandas读result
297
+ # pandas读result
292
298
df = pd .DataFrame (result )
293
299
df = df .values .tolist ()
294
- #每行分割
300
+ # 每行分割
295
301
for i in range (len (df )):
296
302
df [i ] = re .split (',' , df [i ][0 ])
297
- #去掉最后一列
303
+ # 去掉最后一列
298
304
df [i ].pop ()
299
305
# 加载至tableWidget_find,不知几列
300
306
self .tableWidget_find .setRowCount (len (df ))
301
307
self .tableWidget_find .setColumnCount (len (df [0 ]))
302
308
# Time Type Action PID Value32 Value64 Text Pad
303
- self .tableWidget_find .setHorizontalHeaderLabels (['Time' ,'Type' ,'Action' ,'PID' ,'Value32' ,'Value64' ,'Text' ])
309
+ self .tableWidget_find .setHorizontalHeaderLabels (['Time' , 'Type' , 'Action' , 'PID' , 'Value32' , 'Value64' , 'Text' ])
304
310
for i in range (len (df )):
305
311
for j in range (len (df [0 ])):
306
312
self .tableWidget_find .setItem (i , j , QTableWidgetItem (df [i ][j ]))
307
- #宽度自适应,根据内容调整列宽,最后一列填充空白部分
313
+ # 宽度自适应,根据内容调整列宽,最后一列填充空白部分
308
314
self .tableWidget_find .horizontalHeader ().setSectionResizeMode (QHeaderView .ResizeToContents )
309
- self .tableWidget_find .horizontalHeader ().setSectionResizeMode (len (df [0 ])- 1 , QHeaderView .Stretch )
315
+ self .tableWidget_find .horizontalHeader ().setSectionResizeMode (len (df [0 ]) - 1 , QHeaderView .Stretch )
310
316
print (Fore .GREEN + '[+] 搜索成功!' + Style .RESET_ALL )
311
317
def volfindscan (self ):
312
318
if self .lineEdit_str .text () == '' :
@@ -325,8 +331,12 @@ def volfindscan(self):
325
331
profile = str1 + str2
326
332
#cmd = config.volatility2 + " -f " + self.mem_path + " --profile=" + profile + " filescan | findstr " + str
327
333
cmd = f'{ config .volatility2 } -f "{ self .mem_path } " --profile={ profile } filescan | findstr { str } '
334
+ #运行时 按钮变为不可用
335
+ self .pushButton_withvol2find .setEnabled (False )
328
336
self .command_runner = CommandRunner (cmd )
329
337
self .command_runner .start ()
338
+ #线程结束后 按钮变为可用
339
+ self .command_runner .finished .connect (lambda : self .pushButton_withvol2find .setEnabled (True ))
330
340
def procdump2gimp (self ):
331
341
str = self .lineEdit_str .text ()
332
342
#判断是否为数字
0 commit comments