-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathAutoAnalysis.bat
executable file
·72 lines (55 loc) · 1.98 KB
/
AutoAnalysis.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@echo off
:: ###########################
:: TOOLS
:: windump.exe
:: procmon.exe
:: graphviz
:: ProcDot (post processing)
:: Windows PSR ( Event driven screen capture tool )
:: ###########################
:: SET WORKING DIRECTORY
set basePath=C:\Users\IEUser\Desktop\autoanalysis
:: ###########################
:: Variables
:: Get TimeStamp
:: See http://stackoverflow.com/q/1642677/1143274
FOR /f %%a IN ('WMIC OS GET LocalDateTime ^| FIND "."') DO SET DTS=%%a
SET DateTime=%DTS:~0,4%-%DTS:~4,2%-%DTS:~6,2%_%DTS:~8,2%-%DTS:~10,2%-%DTS:~12,2%
set logPath=%basePath%\logs\%DateTime%
set toolPath=%basePath%\tools
:: ###########################
echo -----------------
echo Starting Analysis
echo -----------------
cd %basePath%
mkdir %logPath%
echo Starting Windump...
start /min %toolPath%\windump\windump.exe -s 0 -w %logPath%\capture.pcap
echo Starting Procmon...
start /min %toolPath%\SysinternalsSuite\procmon.exe /AcceptEula /Quiet /Minimized /backingfile %logPath%\capture.pml
start /min %toolPath%\SysinternalsSuite\procmon.exe /AcceptEula /WaitForIdle
echo Starting PSR...
start psr /start /output %logPath%\psr.zip /sc 1 /gui 0
echo Sleeping 5 seconds...
ping -n 5 localhost > nul
echo Capturing Data...
echo Execute test plan and close when done executing processes.
pause
start /min %toolPath%\SysinternalsSuite\procmon.exe /AcceptEula /Terminate
start /min %toolPath%\SysinternalsSuite\procmon.exe /AcceptEula /PagingFile /NoConnect /Minimized /Quiet
echo Killing windump
taskkill /im windump.exe /f
echo Sleeping 10 seconds...
ping -n 10 localhost > nul
echo Terminating Capture
%toolPath%\SysinternalsSuite\procmon.exe /Terminate
echo Sleeping 5 seconds...
ping -n 5 localhost > nul
psr /stop
echo Sleeping 5 seconds...
ping -n 5 localhost > nul
echo Saving as .csv
%toolPath%\SysinternalsSuite\procmon.exe /AcceptEula /OpenLog %logPath%\capture.pml /SaveAs %logPath%\capture.csv
echo.
echo Logs Saved - %logPath%
pause