├── .gitignore
├── .gitmodules
├── Detours
├── Detours.vcxproj
└── Detours.vcxproj.filters
├── Dummy
├── Dummy.cpp
├── Dummy.vcxproj
└── Dummy.vcxproj.filters
├── GenerateRelease.cmd
├── LICENSE.txt
├── PEDoll.sln
├── PEDollController
├── BlobFormatters
│ ├── FmtHex.cs
│ ├── FmtRaw.cs
│ ├── FmtText.cs
│ ├── FmtX86.cs
│ ├── IBlobFormatter.cs
│ └── Util.cs
├── Commands
│ ├── CmdBreak.cs
│ ├── CmdDump.cs
│ ├── CmdEnd.cs
│ ├── CmdEval.cs
│ ├── CmdExit.cs
│ ├── CmdHelp.cs
│ ├── CmdHook.cs
│ ├── CmdKill.cs
│ ├── CmdListen.cs
│ ├── CmdLoad.cs
│ ├── CmdLoaddll.cs
│ ├── CmdPs.cs
│ ├── CmdRem.cs
│ ├── CmdShell.cs
│ ├── CmdTarget.cs
│ ├── CmdUnhook.cs
│ ├── CmdVerdict.cs
│ ├── CommandLine.cs
│ ├── ICommand.cs
│ ├── Util.cs
│ └── cmdDoll.cs
├── FDlgAbout.Designer.cs
├── FDlgAbout.cs
├── FDlgAbout.resx
├── FDlgAbout.zh-CN.resx
├── FDlgAddHook.Designer.cs
├── FDlgAddHook.cs
├── FDlgAddHook.resx
├── FDlgAddHook.zh-CN.resx
├── FDlgBrowsePID.Designer.cs
├── FDlgBrowsePID.cs
├── FDlgBrowsePID.resx
├── FDlgBrowsePID.zh-CN.resx
├── FMain.Designer.cs
├── FMain.cs
├── FMain.resx
├── FMain.zh-CN.resx
├── FSplash.Designer.cs
├── FSplash.cs
├── FSplash.resx
├── Logger.cs
├── PEDollController.csproj
├── Program.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Resources.zh-CN.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Puppet
│ ├── Puppet.cs
│ └── Util.cs
├── Resources
│ ├── CREDITS.txt
│ ├── Controller.ico
│ ├── Controller.png
│ ├── Controller.svg
│ └── Splash.png
├── Threads
│ ├── AsyncDataProvider.cs
│ ├── BlockingQueue.cs
│ ├── Client.cs
│ ├── CmdEngine.cs
│ ├── EvalEngine.cs
│ ├── EvalEngineContext.cs
│ ├── Gui.cs
│ └── Listener.cs
├── app.config
└── packages.config
├── PEDollMonitor
├── Doll.cpp
├── Doll.h
├── GetFileVersion.cpp
├── GetFileVersion.h
├── PEDollMonitor.cpp
├── PEDollMonitor.h
├── PEDollMonitor.rc
├── PEDollMonitor.vcxproj
├── PEDollMonitor.vcxproj.filters
├── Proc.cpp
├── Proc.h
├── SetPrivilege.cpp
├── SetPrivilege.h
├── ThreadPuppet.cpp
├── framework.h
├── pch.cpp
├── pch.h
└── resource.h
├── README.md
├── README.zh-CN.md
├── Scripts
├── API
│ ├── CreateFile.txt
│ ├── CreateProcess.txt
│ ├── DeleteFile.txt
│ ├── ExitWindowsEx.txt
│ ├── LoadLibraryEx.txt
│ ├── MessageBox.txt
│ ├── OpenProcess.txt
│ ├── RegCreateKeyEx.txt
│ ├── RegOpenKeyEx.txt
│ ├── RegSetKeyValue.txt
│ ├── SetFileAttributes.txt
│ ├── WriteFile.txt
│ ├── WriteProcessMemory.txt
│ ├── recv.txt
│ ├── recvfrom.txt
│ ├── send.txt
│ └── sendto.txt
├── Break_on_MessageBox.txt
├── Break_on_MessageBox_64.txt
├── HTTP.txt
├── MBR_Ransom.txt
├── MBR_Ransom_64.txt
├── Registry.txt
├── Remote_Trojan.txt
├── TCP.txt
└── UDP.txt
├── libDoll
├── BoyerMoore.cpp
├── BoyerMoore.h
├── Hook.cpp
├── Hook.h
├── HookStub.cpp
├── HookStub.h
├── HookStub_x64.asm
├── HookStub_x86.asm
├── Thread.cpp
├── Thread.h
├── ThreadPuppet.cpp
├── dllmain.cpp
├── framework.h
├── libDoll.h
├── libDoll.rc
├── libDoll.vcxproj
├── libDoll.vcxproj.filters
├── pch.cpp
├── pch.h
└── resource.h
└── libPuppet
├── PuppetClientTCP.cpp
├── PuppetClientTCP.h
├── framework.h
├── libPuppet.cpp
├── libPuppet.h
├── libPuppet.vcxproj
├── libPuppet.vcxproj.filters
├── pch.cpp
└── pch.h
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Detours/repo"]
2 | path = Detours/repo
3 | url = https://github.com/microsoft/Detours
4 |
--------------------------------------------------------------------------------
/Detours/Detours.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
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 |
--------------------------------------------------------------------------------
/Dummy/Dummy.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | using namespace std;
5 |
6 | // FIXME: Debug build of this dummy does not work
7 | #define DETOUR_PAYLOAD
8 |
9 | #ifdef DETOUR_PAYLOAD
10 |
11 | // Include a Detours payload section for easlier debugging
12 | #include "../Detours/repo/src/detours.h"
13 |
14 | # pragma pack(push, 1)
15 |
16 | struct PAYLOAD_SERVER_INFO
17 | {
18 | DETOUR_SECTION_HEADER header;
19 | DETOUR_SECTION_RECORD record;
20 | char data[32];
21 | };
22 |
23 | # pragma pack(pop)
24 |
25 | #pragma data_seg(".detour")
26 |
27 | static PAYLOAD_SERVER_INFO payload = {
28 | DETOUR_SECTION_HEADER_DECLARE(sizeof(PAYLOAD_SERVER_INFO)),
29 | {
30 | (sizeof(PAYLOAD_SERVER_INFO) - sizeof(DETOUR_SECTION_HEADER)),
31 | 0,
32 | { 0xa2062469, 0x2b45, 0x496d, { 0x8f, 0xe9, 0x7e, 0x89, 0x4e, 0xd7, 0x22, 0x70 } }
33 | },
34 | "127.0.0.1"
35 | };
36 | #pragma data_seg()
37 |
38 | extern "C" int DollDllHelloWorld();
39 |
40 | #endif // DETOUR_PAYLOAD
41 |
42 | int main()
43 | {
44 | cout << "sizeof(UINT_PTR) = " << sizeof(UINT_PTR) << endl;
45 | cout << "&payload = " << &payload << endl;
46 |
47 | # ifdef DETOUR_PAYLOAD
48 | DollDllHelloWorld();
49 | # endif // DETOUR_PAYLOAD
50 |
51 | getchar();
52 |
53 | int ret = WinExec("ver", SW_SHOW);
54 | cout << "ret = " << ret << endl;
55 |
56 | return 0;
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/Dummy/Dummy.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 源文件
20 |
21 |
22 |
--------------------------------------------------------------------------------
/GenerateRelease.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 |
4 | set "RELEASEDIR=%tmp%\PEDollRelease"
5 |
6 |
7 | :main
8 | pushd %~dp0
9 | msbuild -ver >nul 2>nul
10 | if %ERRORLEVEL% neq 0 (
11 | echo Run this batch file from a Developer Command Prompt!
12 | goto :eof
13 | )
14 |
15 | if exist "%RELEASEDIR%" (
16 | rd /s /q "%RELEASEDIR%"
17 | )
18 |
19 | md %RELEASEDIR%
20 |
21 | ::call :buildAll Debug
22 | call :buildAll Release
23 |
24 | start explorer %RELEASEDIR%
25 | popd
26 | goto :eof
27 |
28 |
29 | :: call :buildAll Debug
30 | :buildAll
31 | call :buildController %1 ^
32 | && call :buildMonitor x86 %1 ^
33 | && call :buildMonitor x64 %1
34 | goto :eof
35 |
36 |
37 | :: call :buildController Debug
38 | :buildController
39 | set PLATFORMDIR=PEDollController\bin
40 |
41 | msbuild PEDoll.sln -t:PEDollController -p:Platform="Any CPU";Configuration=%1
42 | if %ERRORLEVEL% neq 0 (
43 | goto :eof
44 | )
45 |
46 | if not exist "%RELEASEDIR%\%1" (
47 | md "%RELEASEDIR%\%1"
48 | )
49 |
50 | xcopy /e %PLATFORMDIR%\%1 "%RELEASEDIR%\%1\"
51 | xcopy /e /i Scripts "%RELEASEDIR%\%1\Scripts"
52 |
53 | :: Generate x64 API script (Scripts\API\*64.txt) from x86 scripts
54 | pushd "%RELEASEDIR%\%1\Scripts\API"
55 | powershell -Command "ls *.txt | foreach { (cat $_.FullName -Raw) -Replace ' --stack=\d+','' > ($_.BaseName + '64.txt') }"
56 | popd
57 | goto :eof
58 |
59 |
60 | :: call :buildMonitor x64 Debug
61 | :buildMonitor
62 |
63 | if %1 equ x86 (
64 | set PLATFORMDIR=.
65 | ) else (
66 | set PLATFORMDIR=x64
67 | )
68 |
69 | msbuild PEDoll.sln -t:PEDollMonitor,libDoll -p:Platform=%1;Configuration=%2
70 | if %ERRORLEVEL% neq 0 (
71 | goto :eof
72 | )
73 |
74 | if not exist "%RELEASEDIR%\%2" (
75 | md "%RELEASEDIR%\%2"
76 | )
77 |
78 | md "%RELEASEDIR%\%2\Monitor_%1"
79 |
80 | copy %PLATFORMDIR%\%2\PEDollMonitor.exe "%RELEASEDIR%\%2\Monitor_%1\"
81 | copy %PLATFORMDIR%\%2\PEDollMonitor.pdb "%RELEASEDIR%\%2\Monitor_%1\"
82 | copy %PLATFORMDIR%\%2\libDoll.dll "%RELEASEDIR%\%2\Monitor_%1\"
83 | copy %PLATFORMDIR%\%2\libDoll.pdb "%RELEASEDIR%\%2\Monitor_%1\"
84 |
85 | goto :eof
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright © 2020 Eric Zhang (EZForever), https://github.com/EZForever
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
9 |
--------------------------------------------------------------------------------
/PEDoll.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29613.14
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libDoll", "libDoll\libDoll.vcxproj", "{2EFB5550-99ED-473C-9132-CA2A04042D15}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libPuppet", "libPuppet\libPuppet.vcxproj", "{781B8BAD-43A7-42D1-B9B6-678943F3DFA4}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PEDollController", "PEDollController\PEDollController.csproj", "{EEEC10F7-451A-43AF-B230-DAE937660EAF}"
11 | EndProject
12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dummy", "Dummy\Dummy.vcxproj", "{AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}"
13 | EndProject
14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Detours", "Detours\Detours.vcxproj", "{C8D2C05E-499B-4E6E-9813-EDDEAFC02931}"
15 | EndProject
16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PEDollMonitor", "PEDollMonitor\PEDollMonitor.vcxproj", "{E137C13A-D394-4500-AADE-0A1443CBB1F9}"
17 | EndProject
18 | Global
19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
20 | Debug|Any CPU = Debug|Any CPU
21 | Debug|x64 = Debug|x64
22 | Debug|x86 = Debug|x86
23 | Release|Any CPU = Release|Any CPU
24 | Release|x64 = Release|x64
25 | Release|x86 = Release|x86
26 | EndGlobalSection
27 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
28 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Debug|Any CPU.ActiveCfg = Debug|Win32
29 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Debug|x64.ActiveCfg = Debug|x64
30 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Debug|x64.Build.0 = Debug|x64
31 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Debug|x86.ActiveCfg = Debug|Win32
32 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Debug|x86.Build.0 = Debug|Win32
33 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Release|Any CPU.ActiveCfg = Release|Win32
34 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Release|x64.ActiveCfg = Release|x64
35 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Release|x64.Build.0 = Release|x64
36 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Release|x86.ActiveCfg = Release|Win32
37 | {2EFB5550-99ED-473C-9132-CA2A04042D15}.Release|x86.Build.0 = Release|Win32
38 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Debug|Any CPU.ActiveCfg = Debug|Win32
39 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Debug|x64.ActiveCfg = Debug|x64
40 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Debug|x64.Build.0 = Debug|x64
41 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Debug|x86.ActiveCfg = Debug|Win32
42 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Debug|x86.Build.0 = Debug|Win32
43 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Release|Any CPU.ActiveCfg = Release|Win32
44 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Release|x64.ActiveCfg = Release|x64
45 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Release|x64.Build.0 = Release|x64
46 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Release|x86.ActiveCfg = Release|Win32
47 | {781B8BAD-43A7-42D1-B9B6-678943F3DFA4}.Release|x86.Build.0 = Release|Win32
48 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
49 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
50 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Debug|x64.ActiveCfg = Debug|Any CPU
51 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Debug|x64.Build.0 = Debug|Any CPU
52 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Debug|x86.ActiveCfg = Debug|Any CPU
53 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Debug|x86.Build.0 = Debug|Any CPU
54 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
55 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Release|Any CPU.Build.0 = Release|Any CPU
56 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Release|x64.ActiveCfg = Release|Any CPU
57 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Release|x64.Build.0 = Release|Any CPU
58 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Release|x86.ActiveCfg = Release|Any CPU
59 | {EEEC10F7-451A-43AF-B230-DAE937660EAF}.Release|x86.Build.0 = Release|Any CPU
60 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Debug|Any CPU.ActiveCfg = Debug|Win32
61 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Debug|x64.ActiveCfg = Debug|x64
62 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Debug|x64.Build.0 = Debug|x64
63 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Debug|x86.ActiveCfg = Debug|Win32
64 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Debug|x86.Build.0 = Debug|Win32
65 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Release|Any CPU.ActiveCfg = Release|Win32
66 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Release|x64.ActiveCfg = Release|x64
67 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Release|x64.Build.0 = Release|x64
68 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Release|x86.ActiveCfg = Release|Win32
69 | {AF9DEB43-3AFE-4E77-8BEC-D4A0CC7074FB}.Release|x86.Build.0 = Release|Win32
70 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Debug|Any CPU.ActiveCfg = Debug|Win32
71 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Debug|x64.ActiveCfg = Debug|x64
72 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Debug|x64.Build.0 = Debug|x64
73 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Debug|x86.ActiveCfg = Debug|Win32
74 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Debug|x86.Build.0 = Debug|Win32
75 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Release|Any CPU.ActiveCfg = Release|Win32
76 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Release|x64.ActiveCfg = Release|x64
77 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Release|x64.Build.0 = Release|x64
78 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Release|x86.ActiveCfg = Release|Win32
79 | {C8D2C05E-499B-4E6E-9813-EDDEAFC02931}.Release|x86.Build.0 = Release|Win32
80 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Debug|Any CPU.ActiveCfg = Debug|Win32
81 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Debug|x64.ActiveCfg = Debug|x64
82 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Debug|x64.Build.0 = Debug|x64
83 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Debug|x86.ActiveCfg = Debug|Win32
84 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Debug|x86.Build.0 = Debug|Win32
85 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Release|Any CPU.ActiveCfg = Release|Win32
86 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Release|x64.ActiveCfg = Release|x64
87 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Release|x64.Build.0 = Release|x64
88 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Release|x86.ActiveCfg = Release|Win32
89 | {E137C13A-D394-4500-AADE-0A1443CBB1F9}.Release|x86.Build.0 = Release|Win32
90 | EndGlobalSection
91 | GlobalSection(SolutionProperties) = preSolution
92 | HideSolutionNode = FALSE
93 | EndGlobalSection
94 | GlobalSection(ExtensibilityGlobals) = postSolution
95 | SolutionGuid = {BC9C3864-6F12-46BE-B9E1-27E9381BAE2F}
96 | EndGlobalSection
97 | EndGlobal
98 |
--------------------------------------------------------------------------------
/PEDollController/BlobFormatters/FmtHex.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | namespace PEDollController.BlobFormatters
5 | {
6 | class FmtHex : IBlobFormatter
7 | {
8 | string PieceToRaw(byte[] blob, int offset)
9 | {
10 | int pieceLen = Math.Min(blob.Length - offset, 16);
11 |
12 | // Similar to FmtRaw.ToScreen(), but convert any control characters (not just '\r') to '.'.
13 | StringBuilder ret = new StringBuilder();
14 |
15 | for(int i = 0; i < pieceLen; i++)
16 | {
17 | char c = (char)blob[offset + i];
18 | // Excluded characters:
19 | // 1. Non-ASCII characters
20 | // 2. Control characters
21 | ret.Append((blob[offset + i] > 0x7f || Char.IsControl(c)) ? '.' : c);
22 | }
23 |
24 | return ret.ToString();
25 | }
26 |
27 | string PieceToHex(byte[] blob, ref int offset)
28 | {
29 | int pieceLen = Math.Min(blob.Length - offset, 8);
30 | string ret = (pieceLen > 0) ? BitConverter.ToString(blob, offset, pieceLen) : String.Empty;
31 | ret = ret.PadRight(3 * 8 - 1).Replace('-', ' ');
32 |
33 | offset += pieceLen;
34 | return ret;
35 | }
36 |
37 | public string ToScreen(byte[] blob)
38 | {
39 | StringBuilder ret = new StringBuilder();
40 |
41 | int offset = 0;
42 | while (offset < blob.Length)
43 | {
44 | // Offset
45 | ret.Append(offset.ToString("x8"));
46 | ret.Append(" ");
47 |
48 | // Divide a line of 16 bytes as two pieces of 8 bytes
49 | int offsetNew = offset;
50 | ret.Append(PieceToHex(blob, ref offsetNew));
51 | ret.Append(" ");
52 | ret.Append(PieceToHex(blob, ref offsetNew));
53 | ret.Append(" ");
54 |
55 | // ASCII
56 | ret.Append(PieceToRaw(blob, offset));
57 | ret.Append(Environment.NewLine);
58 |
59 | offset = offsetNew;
60 | }
61 |
62 | // Blob size at the last line
63 | ret.Append(offset.ToString("x8"));
64 | ret.Append(Environment.NewLine);
65 |
66 | return ret.ToString();
67 | }
68 |
69 | public byte[] ToFile(byte[] blob)
70 | {
71 | return Encoding.UTF8.GetBytes(ToScreen(blob));
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/PEDollController/BlobFormatters/FmtRaw.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | namespace PEDollController.BlobFormatters
5 | {
6 | class FmtRaw : IBlobFormatter
7 | {
8 | public string ToScreen(byte[] blob)
9 | {
10 | StringBuilder ret = new StringBuilder();
11 |
12 | foreach (byte b in blob)
13 | {
14 | char c = (char)b;
15 | // Excluded characters:
16 | // 1. Non-ASCII characters
17 | // 2. '\r' (Will cause characters being overwritten if displayed on console)
18 | // 3. Other non-whitespace control characters
19 | if (b > 0x7f || c == '\r' || (Char.IsControl(c) && !Char.IsWhiteSpace(c)))
20 | ret.Append('.');
21 | else
22 | ret.Append(c);
23 | }
24 |
25 | return ret.ToString();
26 | }
27 |
28 | public byte[] ToFile(byte[] blob)
29 | {
30 | return blob;
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/PEDollController/BlobFormatters/FmtText.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | namespace PEDollController.BlobFormatters
5 | {
6 | class FmtText : IBlobFormatter
7 | {
8 | Encoding encoding;
9 |
10 | public FmtText(Encoding encoding)
11 | {
12 | this.encoding = encoding;
13 | }
14 |
15 | public string ToScreen(byte[] blob)
16 | {
17 | try
18 | {
19 | return encoding.GetString(blob);
20 | }
21 | catch(Exception e)
22 | {
23 | if (e is ArgumentException || e is DecoderFallbackException)
24 | throw new ArgumentException(e.Message);
25 | else
26 | throw;
27 | }
28 | }
29 |
30 | public byte[] ToFile(byte[] blob)
31 | {
32 | return Encoding.UTF8.GetBytes(ToScreen(blob));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/PEDollController/BlobFormatters/FmtX86.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 |
4 | using Gee.External.Capstone;
5 | using Gee.External.Capstone.X86;
6 |
7 | namespace PEDollController.BlobFormatters
8 | {
9 | class FmtX86 : IBlobFormatter
10 | {
11 | CapstoneX86Disassembler disassembler;
12 |
13 | public FmtX86(X86DisassembleMode mode)
14 | {
15 | disassembler = CapstoneDisassembler.CreateX86Disassembler(mode);
16 | disassembler.DisassembleSyntax = DisassembleSyntax.Intel;
17 |
18 | // Represent invalid instructions as "db 0x.."
19 | disassembler.EnableSkipDataMode = true;
20 | disassembler.SkipDataInstructionMnemonic = "db";
21 | }
22 |
23 | ~FmtX86()
24 | {
25 | if (disassembler != null)
26 | disassembler.Dispose();
27 | }
28 |
29 | public string ToScreen(byte[] blob)
30 | {
31 | StringBuilder ret = new StringBuilder();
32 | X86Instruction[] instructions = disassembler.Disassemble(blob, 0);
33 |
34 | int maxbytes = 0;
35 | foreach (X86Instruction instruction in instructions)
36 | {
37 | maxbytes = Math.Max(maxbytes, instruction.Bytes.Length);
38 |
39 | // About 98.5% of IA32 instructions are shorter than 8 bytes
40 | // Reference: Fig.2 from https://www.strchr.com/x86_machine_code_statistics
41 | if (maxbytes > 8)
42 | {
43 | maxbytes = 8;
44 | break;
45 | }
46 | }
47 |
48 | foreach (X86Instruction instruction in instructions)
49 | {
50 | int bytesLen = instruction.Bytes.Length;
51 | string bytesStr;
52 | if (bytesLen > maxbytes)
53 | {
54 | bytesStr = BitConverter.ToString(instruction.Bytes, 0, maxbytes - 1) + " ..";
55 | }
56 | else
57 | {
58 | bytesStr = BitConverter.ToString(instruction.Bytes).PadRight(3 * maxbytes - 1);
59 | }
60 | bytesStr = bytesStr.Replace("-", " ");
61 |
62 | // if (!instruction.IsSkippedData) { ...}
63 | //ret.Append(String.Format("{0:x8} {1} {2}\t{3}", instruction.Address, bytesStr, instruction.Mnemonic, instruction.Operand));
64 | ret.Append(instruction.Address.ToString("x8"));
65 | ret.Append(" ");
66 | ret.Append(bytesStr);
67 | ret.Append(" ");
68 | ret.Append(instruction.Mnemonic);
69 | ret.Append('\t');
70 | ret.Append(instruction.Operand);
71 | ret.Append(Environment.NewLine);
72 | }
73 |
74 | return ret.ToString();
75 | }
76 |
77 | public byte[] ToFile(byte[] blob)
78 | {
79 | return Encoding.UTF8.GetBytes(ToScreen(blob));
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/PEDollController/BlobFormatters/IBlobFormatter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace PEDollController.BlobFormatters
4 | {
5 | interface IBlobFormatter
6 | {
7 | string ToScreen(byte[] blob);
8 |
9 | byte[] ToFile(byte[] blob);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/PEDollController/BlobFormatters/Util.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.Collections.Generic;
4 |
5 | using Gee.External.Capstone.X86;
6 |
7 | namespace PEDollController.BlobFormatters
8 | {
9 | static class Util
10 | {
11 | public static readonly Dictionary Formatters = new Dictionary()
12 | {
13 | { "hex", new FmtHex() },
14 | { "raw", new FmtRaw() },
15 |
16 | { "ansi", new FmtText(Encoding.Default) },
17 | { "unicode", new FmtText(Encoding.Unicode) },
18 | { "utf8", new FmtText(Encoding.UTF8) },
19 |
20 | { "8086", new FmtX86(X86DisassembleMode.Bit16) },
21 | { "x86", new FmtX86(X86DisassembleMode.Bit32) },
22 | { "x64", new FmtX86(X86DisassembleMode.Bit64) },
23 | };
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/PEDollController/Commands/CmdBreak.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace PEDollController.Commands
5 | {
6 |
7 | // Command "break": Suspend/Resume all threads.
8 | // break
9 |
10 | class CmdBreak : ICommand
11 | {
12 | public string HelpResId() => "Commands.Help.Break";
13 | public string HelpShortResId() => "Commands.HelpShort.Break";
14 |
15 | public Dictionary Parse(string cmd)
16 | {
17 | // Ignores any arguments
18 |
19 | return new Dictionary()
20 | {
21 | { "verb", "break" }
22 | };
23 | }
24 |
25 | public void Invoke(Dictionary options)
26 | {
27 | Threads.Client client = Threads.CmdEngine.theInstance.GetTargetClient(false);
28 |
29 | // Does not allow suspending a hooked process
30 | if(client.hookOep != 0)
31 | throw new ArgumentException(Program.GetResourceString("Threads.CmdEngine.TargetNotApplicable"));
32 |
33 | // Send CMD_BREAK
34 | client.Send(Puppet.Util.Serialize(new Puppet.PACKET_CMD_BREAK(0)));
35 |
36 | // Expect ACK(0)
37 | Puppet.PACKET_ACK pktAck;
38 | pktAck = Puppet.Util.Deserialize(client.Expect(Puppet.PACKET_TYPE.ACK));
39 | if (pktAck.status != 0)
40 | throw new ArgumentException(Util.Win32ErrorToMessage((int)pktAck.status));
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/PEDollController/Commands/CmdDump.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Collections.Generic;
5 |
6 | using Mono.Options;
7 |
8 | namespace PEDollController.Commands
9 | {
10 |
11 | // Command "rem": Comment. Do nothing.
12 | // rem [anything]...
13 | // #[anything]...
14 |
15 | class CmdDump : ICommand
16 | {
17 | public string HelpResId() => "Commands.Help.Dump";
18 | public string HelpShortResId() => "Commands.HelpShort.Dump";
19 |
20 | public Dictionary Parse(string cmd)
21 | {
22 | int id = -1;
23 | string format = BlobFormatters.Util.Formatters.Keys.First();
24 | string save = null;
25 |
26 | OptionSet options = new OptionSet()
27 | {
28 | {
29 | "format=",
30 | x =>
31 | {
32 | if(!BlobFormatters.Util.Formatters.ContainsKey(x))
33 | throw new ArgumentException("format");
34 | format = x;
35 | }
36 | },
37 | {
38 | "save=",
39 | x =>
40 | {
41 | save = Util.RemoveQuotes(x);
42 | }
43 | },
44 | {
45 | "<>",
46 | (uint x) =>
47 | {
48 | if(x >= Threads.CmdEngine.theInstance.dumps.Count)
49 | throw new ArgumentException("id");
50 | id = (int)x;
51 | }
52 | }
53 | };
54 | Util.ParseOptions(cmd, options);
55 |
56 | return new Dictionary()
57 | {
58 | { "verb", "dump" },
59 | { "id", id },
60 | { "format", format },
61 | { "save", save }
62 | };
63 | }
64 |
65 | public void Invoke(Dictionary options)
66 | {
67 | int id = (int)options["id"];
68 | string format = (string)options["format"];
69 | string save = (string)options["save"];
70 |
71 | if(id < 0)
72 | {
73 | Logger.I(Program.GetResourceString("Commands.Dump.Header"));
74 |
75 | for (int i = 0; i < Threads.CmdEngine.theInstance.dumps.Count; i++)
76 | {
77 | Threads.DumpEntry entry = Threads.CmdEngine.theInstance.dumps[i];
78 |
79 | Logger.I(Program.GetResourceString("Commands.Dump.Format",
80 | i,
81 | entry.Data.Length,
82 | entry.Source
83 | ));
84 | }
85 | return;
86 | }
87 |
88 | BlobFormatters.IBlobFormatter formatter = BlobFormatters.Util.Formatters[format];
89 | Threads.DumpEntry dump = Threads.CmdEngine.theInstance.dumps[id];
90 |
91 | if(save == null)
92 | {
93 | Logger.I(Program.GetResourceString("Commands.Dump.Title", id, dump.Source, dump.Data.Length, format));
94 |
95 | string formatted = formatter.ToScreen(dump.Data);
96 | Logger.I(formatted);
97 | Threads.Gui.theInstance.InvokeOn((FMain Me) =>
98 | {
99 | Me.txtDumpContent.Text = formatted;
100 | });
101 | }
102 | else
103 | {
104 | BinaryWriter writer = null;
105 | try
106 | {
107 | writer = new BinaryWriter(File.Open(save, FileMode.Create));
108 | writer.Write(formatter.ToFile(dump.Data));
109 | writer.Close();
110 | }
111 | catch (Exception e)
112 | {
113 | throw new ArgumentException(Program.GetResourceString("Commands.IOError", e.GetType().Name, e.Message));
114 | }
115 | finally
116 | {
117 | if (writer != null)
118 | writer.Dispose();
119 | }
120 | }
121 | }
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/PEDollController/Commands/CmdEnd.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace PEDollController.Commands
5 | {
6 |
7 | // Command "end": Ends the client, stopping its process.
8 | // end
9 |
10 | class CmdEnd : ICommand
11 | {
12 | public string HelpResId() => "Commands.Help.End";
13 | public string HelpShortResId() => "Commands.HelpShort.End";
14 |
15 | public Dictionary Parse(string cmd)
16 | {
17 | // Ignores any arguments
18 |
19 | return new Dictionary()
20 | {
21 | { "verb", "end" }
22 | };
23 | }
24 |
25 | public void Invoke(Dictionary options)
26 | {
27 | Threads.Client client = Threads.CmdEngine.theInstance.GetTargetClient();
28 |
29 | // Send CMD_END
30 | client.Send(Puppet.Util.Serialize(new Puppet.PACKET_CMD_END(0)));
31 |
32 | // Expect ACK
33 | client.Expect(Puppet.PACKET_TYPE.ACK);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/PEDollController/Commands/CmdEval.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using Mono.Options;
5 |
6 | namespace PEDollController.Commands
7 | {
8 |
9 | // Command "eval": Manually call EvalEngine.
10 | // eval EXPR
11 |
12 | class CmdEval : ICommand
13 | {
14 |
15 | static string RemoveQuotes(string x)
16 | {
17 | return (x[0] == '"' && x[x.Length - 1] == '"') ? x.Substring(1, x.Length - 2) : x;
18 | }
19 |
20 | // ----------
21 |
22 | public string HelpResId() => "Commands.Help.Eval";
23 | public string HelpShortResId() => "Commands.HelpShort.Eval";
24 |
25 | public Dictionary Parse(string cmd)
26 | {
27 | string expr = null;
28 |
29 | OptionSet options = new OptionSet()
30 | {
31 | { "<>", x => expr = x }
32 | };
33 | Util.ParseOptions(cmd, options);
34 |
35 | if (expr == null)
36 | throw new ArgumentException("expr");
37 |
38 | return new Dictionary()
39 | {
40 | { "verb", "eval" },
41 | { "expr", RemoveQuotes(expr) }
42 | };
43 | }
44 |
45 | public void Invoke(Dictionary options)
46 | {
47 | Threads.Client client = Threads.CmdEngine.theInstance.GetTargetClient(false);
48 | if(client.hookOep == 0)
49 | throw new ArgumentException(Program.GetResourceString("Threads.CmdEngine.TargetNotApplicable"));
50 |
51 | string expr = (string)options["expr"];
52 | string result = Program.GetResourceString(
53 | "Threads.Client.Eval",
54 | expr,
55 | Threads.EvalEngine.EvalString(client, expr)
56 | );
57 | Logger.I(result);
58 | Threads.Gui.theInstance.InvokeOn((FMain Me) => Me.txtHookedResults.Text += (result + Environment.NewLine));
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/PEDollController/Commands/CmdExit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace PEDollController.Commands
5 | {
6 | // Command "exit": Quit Controller.
7 | // exit
8 |
9 | class CmdExit : ICommand
10 | {
11 | public string HelpResId() => "Commands.Help.Exit";
12 | public string HelpShortResId() => "Commands.HelpShort.Exit";
13 |
14 | public Dictionary Parse(string cmd)
15 | {
16 | // Ignores any arguments
17 |
18 | return new Dictionary()
19 | {
20 | { "verb", "exit" }
21 | };
22 | }
23 |
24 | public void Invoke(Dictionary options)
25 | {
26 | Threads.CmdEngine.theInstance.stopTaskEvent.Set();
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/PEDollController/Commands/CmdHelp.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using Mono.Options;
5 |
6 | namespace PEDollController.Commands
7 | {
8 |
9 | // Command "help": Show help message for all commands / specified command
10 | // help [command]
11 |
12 | class CmdHelp : ICommand
13 | {
14 | public string HelpResId() => "Commands.Help.Help";
15 | public string HelpShortResId() => "Commands.HelpShort.Help";
16 |
17 | public Dictionary Parse(string cmd)
18 | {
19 | string command = null;
20 |
21 | OptionSet options = new OptionSet()
22 | {
23 | { "<>", x => command = x }
24 | };
25 | Util.ParseOptions(cmd, options);
26 |
27 | return new Dictionary()
28 | {
29 | { "verb", "help" },
30 | { "command", command }
31 | };
32 | }
33 |
34 | public void Invoke(Dictionary options)
35 | {
36 | string command = (string)options["command"];
37 | if (String.IsNullOrEmpty(command))
38 | ShowHelpScreen();
39 | else if(Util.Commands.ContainsKey(command))
40 | Logger.I(Program.GetResourceString(Util.Commands[command].HelpResId()));
41 | else
42 | throw new ArgumentException(Program.GetResourceString("Commands.Unknown", command));
43 | }
44 |
45 | void ShowHelpScreen()
46 | {
47 | Logger.I(Program.GetResourceString("Commands.HelpShort.Header"));
48 |
49 | // A sorted list of help messages is more readable
50 | SortedSet commandNames = new SortedSet(Util.Commands.Keys);
51 | foreach (string commandName in commandNames)
52 | Logger.I(Program.GetResourceString(Util.Commands[commandName].HelpShortResId()));
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/PEDollController/Commands/CmdKill.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | using Mono.Options;
5 |
6 | namespace PEDollController.Commands
7 | {
8 |
9 | // Command "kill": `kill`/`killall` equivalent.
10 | // kill PID
11 | // kill --all NAME
12 |
13 | class CmdKill : ICommand
14 | {
15 | public string HelpResId() => "Commands.Help.Kill";
16 | public string HelpShortResId() => "Commands.HelpShort.Kill";
17 |
18 | public Dictionary Parse(string cmd)
19 | {
20 | bool killAll = false;
21 | string extras;
22 |
23 | OptionSet options = new OptionSet()
24 | {
25 | { "all", x => killAll = (x != null) }
26 | };
27 | extras = String.Join(" ", Util.ParseOptions(cmd, options));
28 |
29 | string name = null;
30 | int pid = 0;
31 |
32 | if (killAll)
33 | {
34 | name = extras;
35 | }
36 | else
37 | {
38 | try
39 | {
40 | pid = Convert.ToInt32(extras);
41 | }
42 | catch (Exception e)
43 | {
44 | throw new ArgumentException(e.Message);
45 | }
46 | }
47 |
48 | return new Dictionary()
49 | {
50 | { "verb", "kill" },
51 | { "killAll", killAll },
52 | { "name", name },
53 | { "pid", pid }
54 | };
55 | }
56 |
57 | public void Invoke(Dictionary options)
58 | {
59 | Threads.Client client = Threads.CmdEngine.theInstance.GetTargetClient(true);
60 |
61 | // Send CMD_KILL
62 | Puppet.PACKET_CMD_KILL pktKill = new Puppet.PACKET_CMD_KILL(0);
63 | pktKill.pid = (UInt32)(int)options["pid"];
64 | client.Send(Puppet.Util.Serialize(pktKill));
65 |
66 | if ((bool)options["killAll"])
67 | client.Send(Puppet.Util.SerializeString((string)options["name"]));
68 |
69 | // Expect ACK(0)
70 | Puppet.PACKET_ACK pktAck;
71 | pktAck = Puppet.Util.Deserialize(client.Expect(Puppet.PACKET_TYPE.ACK));
72 | if (pktAck.status != 0)
73 | throw new ArgumentException(Util.Win32ErrorToMessage((int)pktAck.status));
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/PEDollController/Commands/CmdListen.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.Net.Sockets;
4 | using System.Collections.Generic;
5 |
6 | using Mono.Options;
7 |
8 | namespace PEDollController.Commands
9 | {
10 | // Command "listen": Listen for clients.
11 | // listen [--ipv6] [PORT]
12 |
13 | class CmdListen : ICommand
14 | {
15 | public string HelpResId() => "Commands.Help.Listen";
16 | public string HelpShortResId() => "Commands.HelpShort.Listen";
17 |
18 | public Dictionary Parse(string cmd)
19 | {
20 | bool ipv6 = false;
21 | int port = Puppet.Util.DEFAULT_PORT;
22 |
23 | OptionSet options = new OptionSet()
24 | {
25 | { "ipv6", x => ipv6 = (x != null) },
26 | { "<>", (ushort x) => port = x }
27 | };
28 | Util.ParseOptions(cmd, options);
29 |
30 | return new Dictionary()
31 | {
32 | { "verb", "listen" },
33 | { "ipv6", ipv6 },
34 | { "port", port }
35 | };
36 | }
37 |
38 | public void Invoke(Dictionary options)
39 | {
40 | if (Threads.Listener.theInstance != null)
41 | throw new ArgumentException(Program.GetResourceString("Commands.Listen.AlreadyStarted"));
42 |
43 | bool ipv6 = (bool)options["ipv6"];
44 | int port = (int)options["port"];
45 |
46 | try
47 | {
48 | Threads.Listener.CreateInstance(ipv6, port);
49 | }
50 | catch(Exception e)
51 | {
52 | throw new ArgumentException(e.ToString());
53 | }
54 |
55 | Logger.I(Program.GetResourceString("Commands.Listen.AvailableAddresses"));
56 |
57 | List addresses = new List(Dns.GetHostAddresses(Dns.GetHostName()));
58 | addresses.Add(IPAddress.Loopback);
59 | addresses.Add(IPAddress.IPv6Loopback);
60 | foreach(IPAddress address in addresses)
61 | {
62 | if (address.AddressFamily != (ipv6 ? AddressFamily.InterNetworkV6 : AddressFamily.InterNetwork))
63 | continue;
64 |
65 | if(port == Puppet.Util.DEFAULT_PORT)
66 | Logger.I(address.ToString());
67 | else
68 | Logger.I(ipv6 ? "[{0}]:{1}" : "{0}:{1}", address.ToString(), port);
69 | }
70 |
71 | Threads.Gui.theInstance.InvokeOn((FMain Me) =>
72 | {
73 | Me.pnlListenerStart.Enabled = false;
74 | });
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/PEDollController/Commands/CmdLoad.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using System.Linq;
4 | using System.Windows.Forms;
5 | using System.Collections.Generic;
6 |
7 | namespace PEDollController.Commands
8 | {
9 |
10 | // Command "load": Load commands from a script.
11 | // load