final commits, ready for next release!
This commit is contained in:
parent
f63bd97f71
commit
bc8ba90838
@ -52,8 +52,14 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
mainWindow = this;
|
||||
processCombo = mainWindow->findChild<QComboBox*>("processCombo");
|
||||
processCombo->lineEdit()->setAlignment(Qt::AlignHCenter);
|
||||
processCombo->lineEdit()->setReadOnly(true);
|
||||
ttCombo = mainWindow->findChild<QComboBox*>("ttCombo");
|
||||
ttCombo->lineEdit()->setAlignment(Qt::AlignHCenter);
|
||||
ttCombo->lineEdit()->setReadOnly(true);
|
||||
extenCombo = mainWindow->findChild<QComboBox*>("extenCombo");
|
||||
extenCombo->lineEdit()->setAlignment(Qt::AlignHCenter);
|
||||
extenCombo->lineEdit()->setReadOnly(true);
|
||||
textOutput = mainWindow->findChild<QPlainTextEdit*>("textOutput");
|
||||
|
||||
hostSignaller->Initialize();
|
||||
@ -65,6 +71,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
std::map<int, QString> extensions = LoadExtensions();
|
||||
for (auto i : extensions) extenCombo->addItem(QString::number(i.first) + ":" + i.second);
|
||||
Host::Open();
|
||||
Host::AddConsoleOutput(L"NextHooker beta v2.0.0 by Artikash\r\nSource code and more information available under GPLv3 at https://github.com/Artikash/NextHooker");
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -85,7 +92,11 @@ void MainWindow::AddProcess(unsigned int processId)
|
||||
{
|
||||
Sleep(50);
|
||||
QStringList hooks = allProcesses.at(i).split(" , ");
|
||||
for (int j = 1; j < hooks.length(); ++j) Host::InsertHook(processId, ParseHCode(hooks.at(j)));
|
||||
for (int j = 1; j < hooks.length(); ++j)
|
||||
{
|
||||
Sleep(10);
|
||||
Host::InsertHook(processId, ParseHCode(hooks.at(j)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -144,8 +155,11 @@ QVector<HookParam> MainWindow::GetAllHooks(DWORD processId)
|
||||
void MainWindow::on_attachButton_clicked()
|
||||
{
|
||||
bool ok;
|
||||
int processId = QInputDialog::getInt(this, "Attach Process", "Process ID?\r\nYou can find this under Task Manager -> Details", 0, 0, 100000, 1, &ok);
|
||||
if (ok) Host::InjectProcess(processId);
|
||||
QString process = QInputDialog::getItem(this, "Select Process",
|
||||
"If you don't see the process you want to inject, try running with admin rights",
|
||||
GetAllProcesses(), 0, true, &ok);
|
||||
if (!ok) return;
|
||||
if (!Host::InjectProcess(process.split(":")[1].toInt())) Host::AddConsoleOutput(L"Failed to attach");
|
||||
}
|
||||
|
||||
void MainWindow::on_detachButton_clicked()
|
||||
@ -160,7 +174,14 @@ void MainWindow::on_hookButton_clicked()
|
||||
"Enter hook code\r\n/H{A|B|W|S|Q}[N]data_offset[*drdo][:sub_offset[*drso]]@addr[:module]",
|
||||
QLineEdit::Normal, "/H", &ok
|
||||
);
|
||||
if (ok) Host::InsertHook(processCombo->currentText().split(":")[0].toInt(), ParseHCode(hookCode));
|
||||
if (!ok) return;
|
||||
HookParam toInsert = ParseHCode(hookCode);
|
||||
if (toInsert.type == 0 && toInsert.length_offset == 0)
|
||||
{
|
||||
Host::AddConsoleOutput(L"invalid /H code");
|
||||
return;
|
||||
}
|
||||
Host::InsertHook(processCombo->currentText().split(":")[0].toInt(), ParseHCode(hookCode));
|
||||
}
|
||||
|
||||
void MainWindow::on_unhookButton_clicked()
|
||||
|
@ -97,6 +97,9 @@
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="processCombo">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAtBottom</enum>
|
||||
</property>
|
||||
@ -181,7 +184,11 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="extenCombo"/>
|
||||
<widget class="QComboBox" name="extenCombo">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addExtenButton">
|
||||
@ -231,7 +238,14 @@
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QComboBox" name="ttCombo"/>
|
||||
<widget class="QComboBox" name="ttCombo">
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>50</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="textOutput">
|
||||
@ -265,18 +279,6 @@
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuOptions">
|
||||
<property name="title">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuAbout">
|
||||
<property name="title">
|
||||
<string>About</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menuOptions"/>
|
||||
<addaction name="menuAbout"/>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
|
16
GUI/misc.cpp
16
GUI/misc.cpp
@ -1,12 +1,13 @@
|
||||
#include "misc.h"
|
||||
#include "../vnrhook/include/const.h"
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#include <Psapi.h>
|
||||
|
||||
QString GetFullModuleName(DWORD processId, HMODULE module)
|
||||
{
|
||||
HANDLE handle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processId);
|
||||
wchar_t buffer[MAX_PATH];
|
||||
wchar_t buffer[MAX_PATH] = {};
|
||||
GetModuleFileNameExW(handle, module, buffer, MAX_PATH);
|
||||
CloseHandle(handle);
|
||||
return QString::fromWCharArray(buffer);
|
||||
@ -18,6 +19,19 @@ QString GetModuleName(DWORD processId, HMODULE module)
|
||||
return fullName.remove(0, fullName.lastIndexOf("\\") + 1);
|
||||
}
|
||||
|
||||
QStringList GetAllProcesses()
|
||||
{
|
||||
DWORD allProcessIds[0x1000];
|
||||
DWORD spaceUsed;
|
||||
QStringList ret;
|
||||
if (!EnumProcesses(allProcessIds, sizeof(allProcessIds), &spaceUsed)) return ret;
|
||||
for (int i = 0; i < spaceUsed / sizeof(DWORD); ++i)
|
||||
if (GetModuleName(allProcessIds[i]).size())
|
||||
ret.push_back(GetModuleName(allProcessIds[i]) + ": " + QString::number(allProcessIds[i]));
|
||||
ret.sort();
|
||||
return ret;
|
||||
}
|
||||
|
||||
DWORD Hash(QString module)
|
||||
{
|
||||
module = module.toLower();
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
QString GetFullModuleName(DWORD processId, HMODULE module = NULL);
|
||||
QString GetModuleName(DWORD processId, HMODULE module = NULL);
|
||||
QStringList GetAllProcesses();
|
||||
HookParam ParseHCode(QString HCode);
|
||||
QString GenerateHCode(HookParam hp, DWORD processId);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user