forked from epi052/osed-scripts
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-mona.ps1
51 lines (40 loc) · 1.98 KB
/
install-mona.ps1
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
$share_path = "\\tsclient\mona-share\"
$install_dir = "C:\Users\Offsec\Desktop\install-mona"
if((Get-WmiObject Win32_OperatingSystem).OSArchitecture = "64-bit"){
$program_files = "C:\Program Files (x86)"
} else {
$program_files = "C:\Program Files"
}
echo "[+] creating installation directory: $install_dir"
mkdir $install_dir
# install old c++ runtime
echo "[+] installing old c++ runtime"
copy "$share_path\vcredist_x86.exe" $install_dir
cd $install_dir
.\vcredist_x86.exe
start-sleep 10
echo "[+] backing up old pykd files"
move "$program_files\Windows Kits\10\Debuggers\x86\winext\pykd.pyd" "$program_files\Windows Kits\10\Debuggers\x86\winext\pykd.pyd.bak"
move "$program_files\Windows Kits\10\Debuggers\x86\winext\pykd.dll" "$program_files\Windows Kits\10\Debuggers\x86\winext\pykd.dll.bak"
# install python2.7
echo "[+] installing python2.7"
copy "$share_path\python-2.7.17.msi" $install_dir
msiexec.exe /i $install_dir\python-2.7.17.msi /qn
start-sleep 10
# register Python2.7 binaries in path before Python3
echo "[+] adding python2.7 to the PATH"
$p = [System.Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::User)
[System.Environment]::SetEnvironmentVariable('Path',"C:\Python27\;C:\Python27\Scripts;"+$p,[System.EnvironmentVariableTarget]::User)
echo "[+] Installing pykd with pip"
pip install pykd
# copy mona files
echo "[+] bringing over mona files and fresh pykd"
copy "$share_path\windbglib.py" "$program_files\Windows Kits\10\Debuggers\x86"
copy "$share_path\mona.py" "$program_files\Windows Kits\10\Debuggers\x86"
copy "$share_path\pykd.pyd" "$program_files\Windows Kits\10\Debuggers\x86\winext"
# register runtime debug dll
echo "[+] registering runtime debug dll"
cd "$program_files\Common Files\Microsoft Shared\VC"
regsvr32 /s msdia90.dll
echo "[=] in case you see something about symbols when running mona, try executing the following (the runtime took too long to install)"
echo 'regsvr32 "$program_files\Common Files\Microsoft Shared\VC\msdia90.dll"'