Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed May 28, 2022
1 parent bfe73cf commit a320c8f
Show file tree
Hide file tree
Showing 28 changed files with 23,839 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Jetbrains
*/.idea/*

# Visual Studio
*/.vs/*

# Cmake
*/CmakeLists.txt.user
*/cmake-build-debug/*
*/cmake-build-release/*
*/out/*

# Build output
build-cuteInjector-*
156 changes: 156 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<div id="top"></div>


<!-- PROJECT SHIELDS -->
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![Apache License][license-shield]][license-url]



<!-- PROJECT LOGO -->
<br />
<div align="center">
<a href="https://github.com/0verEngineer/cuteInjector">
<img src="resources/icon.png" alt="Logo">
</a>

<h3 align="center">cuteInjector</h3>

<p align="center">
Simple dll injector built with QT
<br />
<br />
<a href="https://github.com/0verEngineer/cuteInjector/issues">Report Bug</a>
·
<a href="https://github.com/0verEngineer/cuteInjector/issues">Request Feature</a>
</p>
</div>



<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#usage">Usage</a></li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#acknowledgments">Acknowledgments</a></li>
</ol>
</details>



<!-- ABOUT THE PROJECT -->
## About The Project

- The Injector and the x86Bridge are two different CMake Projects because of the different architecture
- The x86Bridge is only used to get the address of LoadLibraryA in a x86 Process but that will change in the future


<p align="right">(<a href="#top">back to top</a>)</p>



### Built With

- [QT](https://qt.io/)
- [nlohmann json](https://github.com/nlohmann/json)

<p align="right">(<a href="#top">back to top</a>)</p>



<!-- GETTING STARTED -->
## Getting Started

### Prerequisites
- QT

### Visual Studio
- Install the QT Extension
- Open the Directory with Visual Studio
- Change the CMakeSettings.json accordingly. The CMAKE_PREFIX_PATH should be the only one you need to set.

### CLion Setup
- Set the CMAKE_PREFIX_PATH in the Debug and Release Profiles of the CMake Settings. There is an Environment field.

### CMAKE_PREFIX_PATH
- Is the Path of the QT Installation that should be used. For Example: `C:\Qt\6.3.0\msvc2019_64`

### Release dependencies
- run `windeployqt.exe --release P:\ath\to\dir\with\cuteInjector.exe`



<p align="right">(<a href="#top">back to top</a>)</p>



<!-- ROADMAP -->
## Roadmap

- [x] LoadLibrary + CreateThread Injection
- [x] Process Icons
- [ ] (File-)Logging, Log-Window
- [ ] Rethink x86, x64 situation
- [ ] Add more injection methods
- [ ] Manual Mapping
- [ ] LdrLoadDll
- [ ] Add more thread-creation methods
- [ ] Kernel callback


<p align="right">(<a href="#top">back to top</a>)</p>



<!-- LICENSE -->
## License

Distributed under the Apache License 2.0. See `LICENSE` for more information.

<p align="right">(<a href="#top">back to top</a>)</p>



<!-- CONTACT -->
## Contact

Julian Hackinger - [email protected]

Project Link: [https://github.com/0verEngineer/cuteInjector](https://github.com/0verEngineer/cuteInjector)

<p align="right">(<a href="#top">back to top</a>)</p>



<!-- MARKDOWN LINKS & IMAGES -->
[contributors-shield]: https://img.shields.io/github/contributors/0verEngineer/cuteInjector.svg?style=for-the-badge
[contributors-url]: https://github.com/0verEngineer/cuteInjector/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/0verEngineer/cuteInjector.svg?style=for-the-badge
[forks-url]: https://github.com/0verEngineer/cuteInjector/network/members
[stars-shield]: https://img.shields.io/github/stars/0verEngineer/cuteInjector.svg?style=for-the-badge
[stars-url]: https://github.com/0verEngineer/cuteInjector/stargazers
[issues-shield]: https://img.shields.io/github/issues/0verEngineer/cuteInjector.svg?style=for-the-badge
[issues-url]: https://github.com/0verEngineer/cuteInjector/issues
[license-shield]: https://img.shields.io/github/license/0verEngineer/cuteInjector.svg?style=for-the-badge
[license-url]: https://github.com/0verEngineer/cuteInjector/blob/master/LICENSE.txt
66 changes: 66 additions & 0 deletions cuteInjector/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
cmake_minimum_required(VERSION 3.21)
project(cuteInjector VERSION 0.0.2 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)

set(SOURCES
src/main.cpp

src/helpers/jsonSerializer.h

src/ui/mainWindow.cpp
src/ui/mainWindow.h
src/ui/mainWindow.ui
src/ui/selectProcessDialog.cpp
src/ui/selectProcessDialog.h
src/ui/style.h
src/ui/textInfoWindow.cpp
src/ui/textInfoWindow.h

src/utils/dllFile.cpp
src/utils/dllFile.h

src/utils/injector/injector.cpp
src/utils/injector/injector.h

src/utils/process/process.cpp
src/utils/process/process.h
src/utils/process/processManager.cpp
src/utils/process/processManager.h
)


# Icon
enable_language("RC")
set(RC_FILE resources/cuteInjector.rc)


qt_add_executable(cuteInjector
MANUAL_FINALIZATION
${SOURCES}
${RC_FILE}
)

target_link_libraries(cuteInjector PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)

set_target_properties(cuteInjector PROPERTIES
WIN32_EXECUTABLE TRUE
LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS /MACHINE:X64"
)

if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(cuteInjector)
endif()
40 changes: 40 additions & 0 deletions cuteInjector/CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "CMAKE_INSTALL_PREFIX",
"value": "C:/Qt/6.3.0/msvc2019_64",
"type": "PATH"
}
]
},
{
"name": "x64-Release",
"generator": "Ninja",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": [
{
"name": "CMAKE_INSTALL_PREFIX",
"value": "C:/Qt/6.3.0/msvc2019_64",
"type": "PATH"
}
]
}
]
}
1 change: 1 addition & 0 deletions cuteInjector/resources/cuteInjector.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "icon.ico"
Binary file added cuteInjector/resources/icon.ico
Binary file not shown.
79 changes: 79 additions & 0 deletions cuteInjector/src/helpers/jsonSerializer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#ifndef JSONSERIALIZER_H
#define JSONSERIALIZER_H

#include "../utils/dllFile.h"
#include "../utils/process/process.h"

#include "../../vendor/nlohmann/json.hpp"

#include <fstream>
#include <iomanip>
#include <QDir>


using json = nlohmann::json;
using std::fstream;


namespace jsonSerializer
{
std::string path = QString(QDir::currentPath() + "/data.json").toStdString();

bool load(std::vector<DllFile> &dllFiles, Process &selectedProcess)
{
std::ifstream file(path);
if (file.fail())
return false;

json j;
file >> j;

if (j.empty())
{
file.close();
return false;
}

try
{
selectedProcess.name = QString::fromStdString(j["selectedProcess"]["name"].get<std::string>());

for (int i = 0; i < j["dllFiles"].size(); i++)
{
QString name = QString::fromStdString(j["dllFiles"][i]["name"].get<std::string>());
QString path = QString::fromStdString(j["dllFiles"][i]["path"].get<std::string>());
QString arch = QString::fromStdString(j["dllFiles"][i]["arch"].get<std::string>());

dllFiles.push_back(DllFile(path, name, arch));
}
}
catch (nlohmann::detail::type_error)
{
qDebug() << "ERROR: Unable to read json";
}

file.close();
return true;
}


void save(std::vector<DllFile> &dllFiles, Process &selectedProcess)
{
json j;

j["selectedProcess"]["name"] = selectedProcess.name.toStdString();

for (int i = 0; i < dllFiles.size(); i++)
{
j["dllFiles"][i]["name"] = dllFiles[i].name.toStdString();
j["dllFiles"][i]["path"] = dllFiles[i].path.toStdString();
j["dllFiles"][i]["arch"] = dllFiles[i].arch.toStdString();
}

std::ofstream outFile(path);
outFile << std::setw(4) << j << std::endl;
outFile.close();
}
}

#endif // JSONSERIALIZER_H
16 changes: 16 additions & 0 deletions cuteInjector/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "ui/mainWindow.h"
#include "ui/style.h"

#include <QApplication>


int main(int argc, char *argv[])
{
QApplication a(argc, argv);

ApplyStyle(&a);

MainWindow w;
w.show();
return a.exec();
}
Loading

0 comments on commit a320c8f

Please sign in to comment.