File tree Expand file tree Collapse file tree 14 files changed +3946
-1
lines changed
Expand file tree Collapse file tree 14 files changed +3946
-1
lines changed Original file line number Diff line number Diff line change 1- build /
1+ build /
2+ .vs /
Original file line number Diff line number Diff line change 1+ {
2+ "configurations" : [
3+ {
4+ "name" : " Win32" ,
5+ "includePath" : [
6+ " ${default}" ,
7+ " ${workspaceFolder}/include"
8+ ],
9+ "defines" : [
10+ " _DEBUG" ,
11+ " UNICODE" ,
12+ " _UNICODE"
13+ ],
14+ "windowsSdkVersion" : " 10.0.19041.0" ,
15+ "compilerPath" : " C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe" ,
16+ "cStandard" : " c17" ,
17+ "cppStandard" : " c++17" ,
18+ "configurationProvider" : " ms-vscode.cmake-tools"
19+ }
20+ ],
21+ "version" : 4
22+ }
Original file line number Diff line number Diff line change 1+ {
2+ // Use IntelliSense to learn about possible attributes.
3+ // Hover to view descriptions of existing attributes.
4+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+ "version" : " 0.2.0" ,
6+ "configurations" : [
7+
8+ ]
9+ }
Original file line number Diff line number Diff line change 1+ {
2+ "version" : " 0.2.1" ,
3+ "defaults" : {},
4+ "configurations" : [
5+ {
6+ "projectTarget" : " main.exe" ,
7+ "name" : " mydemo.exe with args" ,
8+ "args" : [
9+ " -d mydll.dll -p notepad.exe"
10+ ]
11+ }
12+ ]
13+ }
Original file line number Diff line number Diff line change 1+ {
2+ "C_Cpp.default.configurationProvider" : " ms-vscode.cmake-tools" ,
3+ "files.associations" : {
4+ "**tq" : " cpp" ,
5+ "manfiest" : " properties" ,
6+ "any" : " cpp" ,
7+ "array" : " cpp" ,
8+ "atomic" : " cpp" ,
9+ "*.tcc" : " cpp" ,
10+ "bitset" : " cpp" ,
11+ "cctype" : " cpp" ,
12+ "chrono" : " cpp" ,
13+ "clocale" : " cpp" ,
14+ "cmath" : " cpp" ,
15+ "codecvt" : " cpp" ,
16+ "complex" : " cpp" ,
17+ "condition_variable" : " cpp" ,
18+ "csignal" : " cpp" ,
19+ "cstdarg" : " cpp" ,
20+ "cstddef" : " cpp" ,
21+ "cstdint" : " cpp" ,
22+ "cstdio" : " cpp" ,
23+ "cstdlib" : " cpp" ,
24+ "cstring" : " cpp" ,
25+ "ctime" : " cpp" ,
26+ "cwchar" : " cpp" ,
27+ "cwctype" : " cpp" ,
28+ "deque" : " cpp" ,
29+ "list" : " cpp" ,
30+ "unordered_map" : " cpp" ,
31+ "unordered_set" : " cpp" ,
32+ "vector" : " cpp" ,
33+ "exception" : " cpp" ,
34+ "algorithm" : " cpp" ,
35+ "functional" : " cpp" ,
36+ "iterator" : " cpp" ,
37+ "map" : " cpp" ,
38+ "memory" : " cpp" ,
39+ "memory_resource" : " cpp" ,
40+ "numeric" : " cpp" ,
41+ "optional" : " cpp" ,
42+ "ratio" : " cpp" ,
43+ "regex" : " cpp" ,
44+ "set" : " cpp" ,
45+ "string" : " cpp" ,
46+ "string_view" : " cpp" ,
47+ "system_error" : " cpp" ,
48+ "tuple" : " cpp" ,
49+ "type_traits" : " cpp" ,
50+ "utility" : " cpp" ,
51+ "fstream" : " cpp" ,
52+ "future" : " cpp" ,
53+ "initializer_list" : " cpp" ,
54+ "iomanip" : " cpp" ,
55+ "iosfwd" : " cpp" ,
56+ "iostream" : " cpp" ,
57+ "istream" : " cpp" ,
58+ "limits" : " cpp" ,
59+ "mutex" : " cpp" ,
60+ "new" : " cpp" ,
61+ "ostream" : " cpp" ,
62+ "sstream" : " cpp" ,
63+ "stdexcept" : " cpp" ,
64+ "streambuf" : " cpp" ,
65+ "thread" : " cpp" ,
66+ "cinttypes" : " cpp" ,
67+ "typeindex" : " cpp" ,
68+ "typeinfo" : " cpp" ,
69+ "variant" : " cpp" ,
70+ "filesystem" : " cpp" ,
71+ "xstring" : " cpp" ,
72+ "xtree" : " cpp"
73+ },
74+ "C_Cpp.default.includePath" : " C:/Users/ASD/Project/cplusplus/lib/vcpkg/installed/x86-windows/include/boost/"
75+ }
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.18)
2+ project ("CommandLineInjector" )
3+
4+ add_executable (main "src/main.cpp" "src/WinApiWrapper.cpp" "src/Util.cpp" )
5+ include_directories (main "include" )
6+ target_link_libraries (main "psapi.lib" "Wtsapi32.lib" )
7+
8+ set (Boost_USE_STATIC_LIBS ON )
9+ set (Boost_USE_MULTITHREADED ON )
10+ set (Boost_USE_STATIC_RUNTIME ON )
11+ set_property (TARGET main PROPERTY CXX_STANDARD 17)
12+ set_property (TARGET main PROPERTY CXX_EXTENSIONS ON )
13+
14+
15+ target_include_directories (main PUBLIC "include" )
16+ target_include_directories (main PUBLIC "C:/Users/ASD/Project/cplusplus/lib/vcpkg/installed/x64-windows/include" ) # set this as the vscode intelisense won't show the path unless I do this
17+ target_compile_definitions (main PUBLIC "UNICODE" )
18+
19+ if (NOT Boost_INCLUDE_DIR)
20+ SET (Boost_INCLUDE_DIR "C:/Users/ASD/Project/cplusplus/lib/vcpkg/installed/x64-windows/include" )
21+ endif ()
22+ FIND_PACKAGE (Boost)
23+ target_include_directories (main PUBLIC Boost_INCLUDE_DIR)
24+
25+ if (MSVC )
26+ add_compile_options ("/subsystem:console" )
27+ endif ()
Original file line number Diff line number Diff line change 1+ #pragma once
2+ #include < vector>
3+
4+ template <typename T>
5+ bool vector_include (std::vector<T> vec, T content);
Original file line number Diff line number Diff line change 1+ #pragma once
2+ #include < vector>
3+ #include < string>
4+ #include < windows.h>
5+ #include < filesystem>
6+ #include < Psapi.h>
7+ #include < Windows.h>
8+ #include < WtsApi32.h>
9+ #include < boost/foreach.hpp>
10+ #include < codecvt>
11+ #include < string>
12+ #include < Psapi.h>
13+ #include < functional>
14+ #include < thread>
15+
16+ std::wstring utf8ToUtf16 (std::string utf8Str);
17+
18+ std::string utf16ToUtf8 (std::wstring utf16Str);
19+
20+ struct process
21+ {
22+ /* *
23+ * The exe name of the process
24+ */
25+ std::wstring name;
26+ DWORD pid;
27+
28+ process (DWORD pid, std::wstring name)
29+ {
30+ this ->pid = pid;
31+ this ->name = name;
32+ }
33+
34+ static std::vector<process> enumAllProcess ();
35+ };
36+
37+ /* *
38+ * Wait for a program to be opened syncronously
39+ * @param toWatch the exe name of the program to wait to launch
40+ * @return The PID of the program that opened
41+ */
42+ DWORD waitForProgramLaunchSync (const std::wstring toWatch);
43+
44+ /* *
45+ * Wait for a program to be opened asyncronously
46+ * @param toWatch the exe name of the program to wait to launch
47+ * @param onLaunch an function to execute once the program find the program that launched
48+ * @return An thread to scheduele the program watcher
49+ */
50+ void waitForProgramLaunchAsync (const std::wstring toWatch, std::function<void (DWORD pid)> onLaunch);
51+
52+ enum class InjectDllReturnValue
53+ {
54+ AcessWindowHandleError,
55+ MemAlocationError,
56+ InjectionFail,
57+ InjectionSucess,
58+ InexistantDLL
59+ };
60+
61+ /* *
62+ * Inject a DLL
63+ * @param pid The process to inject the dll
64+ * @param path The path of the dll
65+ * @return Return false if there was a error while injecting
66+ */
67+ InjectDllReturnValue InjectDll (DWORD pid, std::string Path);
You can’t perform that action at this time.
0 commit comments