mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 17:04:12 +08:00
extract more strings
This commit is contained in:
parent
62541968aa
commit
b218e241da
@ -1,8 +1,7 @@
|
||||
#include "extenwindow.h"
|
||||
#include "ui_extenwindow.h"
|
||||
#include "defs.h"
|
||||
#include "types.h"
|
||||
#include "text.h"
|
||||
#include "types.h"
|
||||
#include <QFileDialog>
|
||||
#include <QMimeData>
|
||||
#include <QUrl>
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define EXTENSIONS_H
|
||||
|
||||
#include "qtcommon.h"
|
||||
#include "defs.h"
|
||||
#include <shared_mutex>
|
||||
#include <QListWidget>
|
||||
#include <QDragEnterEvent>
|
||||
@ -34,7 +35,7 @@ private:
|
||||
void dropEvent(QDropEvent* event);
|
||||
|
||||
Ui::ExtenWindow* ui;
|
||||
QFile extenSaveFile = QFile("Extensions.txt");
|
||||
QFile extenSaveFile = QFile(EXTEN_SAVE_FILE);
|
||||
QListWidget* extenList;
|
||||
};
|
||||
|
||||
|
@ -30,8 +30,8 @@ namespace Host
|
||||
void AddConsoleOutput(std::wstring text);
|
||||
}
|
||||
|
||||
inline UINT DEFAULT_CODEPAGE = SHIFT_JIS;
|
||||
inline std::wstring StringToWideString(const std::string& text, UINT encoding = DEFAULT_CODEPAGE)
|
||||
inline UINT CURRENT_CODEPAGE = SHIFT_JIS;
|
||||
inline std::wstring StringToWideString(const std::string& text, UINT encoding = CURRENT_CODEPAGE)
|
||||
{
|
||||
std::wstring ret(text.size() + 1, 0);
|
||||
ret.resize(MultiByteToWideChar(encoding, 0, text.c_str(), -1, ret.data(), ret.capacity()) - 1);
|
||||
|
@ -38,7 +38,7 @@ void TextThread::Push(const BYTE* data, int len)
|
||||
LOCK(threadMutex);
|
||||
buffer += hp.type & USING_UNICODE
|
||||
? std::wstring((wchar_t*)data, len / 2)
|
||||
: StringToWideString(std::string((char*)data, len), hp.codepage != 0 ? hp.codepage : DEFAULT_CODEPAGE);
|
||||
: StringToWideString(std::string((char*)data, len), hp.codepage != 0 ? hp.codepage : CURRENT_CODEPAGE);
|
||||
if (std::all_of(buffer.begin(), buffer.end(), [&](wchar_t c) { return repeatingChars.count(c) > 0; })) buffer.clear();
|
||||
lastPushTime = GetTickCount();
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "defs.h"
|
||||
#include "text.h"
|
||||
#include "extenwindow.h"
|
||||
#include "misc.h"
|
||||
@ -17,11 +16,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
ttCombo = findChild<QComboBox*>("ttCombo");
|
||||
textOutput = findChild<QPlainTextEdit*>("textOutput");
|
||||
|
||||
if (settings.contains("Window")) this->setGeometry(settings.value("Window").toRect());
|
||||
if (settings.contains(WINDOW)) this->setGeometry(settings.value(WINDOW).toRect());
|
||||
// TODO: add GUI for changing these
|
||||
if (settings.contains("Default_Codepage")) DEFAULT_CODEPAGE = settings.value("Default_Codepage").toInt();
|
||||
if (settings.contains("Flush_Delay")) TextThread::flushDelay = settings.value("Flush_Delay").toInt();
|
||||
if (settings.contains("Max_Buffer_Size")) TextThread::maxBufferSize = settings.value("Max_Buffer_Size").toInt();
|
||||
if (settings.contains(DEFAULT_CODEPAGE)) CURRENT_CODEPAGE = settings.value(DEFAULT_CODEPAGE).toInt();
|
||||
if (settings.contains(FLUSH_DELAY)) TextThread::flushDelay = settings.value(FLUSH_DELAY).toInt();
|
||||
if (settings.contains(MAX_BUFFER_SIZE)) TextThread::maxBufferSize = settings.value(MAX_BUFFER_SIZE).toInt();
|
||||
|
||||
qRegisterMetaType<std::shared_ptr<TextThread>>();
|
||||
|
||||
@ -43,10 +42,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
settings.setValue("Window", this->geometry());
|
||||
settings.setValue("Default_Codepage", DEFAULT_CODEPAGE);
|
||||
settings.setValue("Flush_Delay", TextThread::flushDelay);
|
||||
settings.setValue("Max_Buffer_Size", TextThread::maxBufferSize);
|
||||
settings.setValue(WINDOW, this->geometry());
|
||||
settings.setValue(DEFAULT_CODEPAGE, CURRENT_CODEPAGE);
|
||||
settings.setValue(FLUSH_DELAY, TextThread::flushDelay);
|
||||
settings.setValue(MAX_BUFFER_SIZE, TextThread::maxBufferSize);
|
||||
settings.sync();
|
||||
delete ui;
|
||||
|
||||
@ -61,7 +60,7 @@ void MainWindow::closeEvent(QCloseEvent*)
|
||||
void MainWindow::AddProcess(unsigned processId)
|
||||
{
|
||||
processCombo->addItem(QString::number(processId, 16).toUpper() + ": " + GetModuleName(processId));
|
||||
QFile file("SavedHooks.txt");
|
||||
QFile file(HOOK_SAVE_FILE);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
QString processName = GetFullModuleName(processId);
|
||||
QStringList allProcesses = QString(file.readAll()).split("\r", QString::SkipEmptyParts);
|
||||
@ -223,7 +222,7 @@ void MainWindow::on_saveButton_clicked()
|
||||
for (auto hook : hooks)
|
||||
if (!(hook.type & HOOK_ENGINE))
|
||||
hookList += " , " + GenerateCode(hook, GetSelectedProcessId());
|
||||
QFile file("SavedHooks.txt");
|
||||
QFile file(HOOK_SAVE_FILE);
|
||||
file.open(QIODevice::Append);
|
||||
file.write((hookList + "\r\n").toUtf8());
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "qtcommon.h"
|
||||
#include "host/host.h"
|
||||
#include "defs.h"
|
||||
#include <QPlainTextEdit>
|
||||
#include <QComboBox>
|
||||
#include <QSettings>
|
||||
@ -53,7 +54,7 @@ private:
|
||||
void closeEvent(QCloseEvent*);
|
||||
|
||||
Ui::MainWindow* ui;
|
||||
QSettings settings = QSettings("Textractor.ini", QSettings::IniFormat);
|
||||
QSettings settings = QSettings(CONFIG_FILE, QSettings::IniFormat);
|
||||
QComboBox* processCombo;
|
||||
QComboBox* ttCombo;
|
||||
QPlainTextEdit* textOutput;
|
||||
|
@ -3,19 +3,32 @@
|
||||
// vnrhook/defs.h
|
||||
// 8/23/2013 jichi
|
||||
|
||||
#define ITH_DLL L"vnrhook"
|
||||
constexpr auto ITH_DLL = L"vnrhook";
|
||||
|
||||
// Pipes
|
||||
|
||||
#define HOOK_PIPE L"\\\\.\\pipe\\TEXTRACTOR_HOOK"
|
||||
#define HOST_PIPE L"\\\\.\\pipe\\TEXTRACTOR_HOST"
|
||||
constexpr auto HOOK_PIPE = L"\\\\.\\pipe\\TEXTRACTOR_HOOK";
|
||||
constexpr auto HOST_PIPE = L"\\\\.\\pipe\\TEXTRACTOR_HOST";
|
||||
|
||||
// Sections
|
||||
|
||||
#define ITH_SECTION_ L"VNR_SECTION_" // _%d
|
||||
constexpr auto ITH_SECTION_ = L"VNR_SECTION_"; // _%d
|
||||
|
||||
// Mutex
|
||||
|
||||
#define ITH_HOOKMAN_MUTEX_ L"VNR_HOOKMAN_" // ITH_HOOKMAN_%d
|
||||
constexpr auto ITH_HOOKMAN_MUTEX_ = L"VNR_HOOKMAN_"; // ITH_HOOKMAN_%d
|
||||
|
||||
// Files
|
||||
|
||||
constexpr auto CONFIG_FILE = u8"Textractor.ini";
|
||||
constexpr auto HOOK_SAVE_FILE = u8"SavedHooks.txt";
|
||||
constexpr auto EXTEN_SAVE_FILE = u8"Extensions.txt";
|
||||
|
||||
// Settings
|
||||
|
||||
constexpr auto WINDOW = u8"Window";
|
||||
constexpr auto DEFAULT_CODEPAGE = u8"Default_Codepage";
|
||||
constexpr auto FLUSH_DELAY = u8"Flush_Delay";
|
||||
constexpr auto MAX_BUFFER_SIZE = u8"Max_Buffer_Size";
|
||||
|
||||
// EOF
|
||||
|
@ -1,33 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
namespace
|
||||
{
|
||||
auto ABOUT = L"Textractor beta v3.4.0 by Artikash\r\n"
|
||||
"Source code and more information available under GPLv3 at https://github.com/Artikash/Textractor";
|
||||
auto SELECT_PROCESS = "Select Process";
|
||||
auto INJECT_INFO = "If you don't see the process you want to inject, try running with admin rights\r\n"
|
||||
"You can also type in the process id";
|
||||
auto ADD_HOOK = "Add hook";
|
||||
auto CODE_INFODUMP = "Enter hook code\r\n"
|
||||
"/H{A|B|W|S|Q|V}[N][codepage#]data_offset[*deref_offset1][:split_offset[*deref_offset2]]@addr[:module[:func]]\r\n"
|
||||
"OR\r\n"
|
||||
"Enter read code\r\n"
|
||||
"/R{S|Q|V}[codepage#][*deref_offset|0]@addr\r\n"
|
||||
"All numbers except codepage in hexadecimal\r\n"
|
||||
"A/B: Shift-JIS char little/big endian\r\n"
|
||||
"W: UTF-16 char\r\n"
|
||||
"S/Q/V: Shift-JIS/UTF-16/UTF-8 string\r\n"
|
||||
"Negatives for data_offset/sub_offset refer to registers\r\n"
|
||||
"-4 for EAX, -8 for ECX, -C for EDX, -10 for EBX, -14 for ESP, -18 for EBP, -1C for ESI, -20 for EDI\r\n"
|
||||
"* means dereference pointer+deref_offset";
|
||||
auto UNHOOK = "Unhook";
|
||||
auto REMOVE_HOOK = "Which hook to remove?";
|
||||
auto SELECT_EXTENSION = "Select Extension";
|
||||
auto EXTENSIONS = "Extensions (*.dll)";
|
||||
auto TOO_MANY_THREADS = L"Textractor: ERROR: too many text threads: can't create more";
|
||||
auto ALREADY_INJECTED = L"Textractor: ERROR: already injected";
|
||||
auto ARCHITECTURE_MISMATCH = L"Textractor: ERROR: architecture mismatch: try 32 bit Textractor instead";
|
||||
auto INJECT_FAILED = L"Textractor: ERROR: couldn't inject";
|
||||
auto INVALID_CODE = L"Textractor: invalid code";
|
||||
auto NO_HOOKS = :"Textractor: no hooks detected";
|
||||
}
|
||||
constexpr auto SELECT_PROCESS = u8"Select Process";
|
||||
constexpr auto INJECT_INFO = u8"If you don't see the process you want to inject, try running with admin rights\r\n"
|
||||
"You can also type in the process id";
|
||||
constexpr auto ADD_HOOK = u8"Add hook";
|
||||
constexpr auto CODE_INFODUMP = u8"Enter hook code\r\n"
|
||||
"/H{A|B|W|S|Q|V}[N][codepage#]data_offset[*deref_offset1][:split_offset[*deref_offset2]]@addr[:module[:func]]\r\n"
|
||||
"OR\r\n"
|
||||
"Enter read code\r\n"
|
||||
"/R{S|Q|V}[codepage#][*deref_offset|0]@addr\r\n"
|
||||
"All numbers except codepage in hexadecimal\r\n"
|
||||
"A/B: Shift-JIS char little/big endian\r\n"
|
||||
"W: UTF-16 char\r\n"
|
||||
"S/Q/V: Shift-JIS/UTF-16/UTF-8 string\r\n"
|
||||
"Negatives for data_offset/sub_offset refer to registers\r\n"
|
||||
"-4 for EAX, -8 for ECX, -C for EDX, -10 for EBX, -14 for ESP, -18 for EBP, -1C for ESI, -20 for EDI\r\n"
|
||||
"* means dereference pointer+deref_offset";
|
||||
constexpr auto UNHOOK = u8"Unhook";
|
||||
constexpr auto REMOVE_HOOK = u8"Which hook to remove?";
|
||||
constexpr auto SELECT_EXTENSION = u8"Select Extension";
|
||||
constexpr auto EXTENSIONS = u8"Extensions (*.dll)";
|
||||
constexpr auto ABOUT = L"Textractor beta v3.4.0 by Artikash\r\n"
|
||||
"Source code and more information available under GPLv3 at https://github.com/Artikash/Textractor";
|
||||
constexpr auto TOO_MANY_THREADS = L"Textractor: ERROR: too many text threads: can't create more";
|
||||
constexpr auto ALREADY_INJECTED = L"Textractor: ERROR: already injected";
|
||||
constexpr auto ARCHITECTURE_MISMATCH = L"Textractor: ERROR: architecture mismatch: try 32 bit Textractor instead";
|
||||
constexpr auto INJECT_FAILED = L"Textractor: ERROR: couldn't inject";
|
||||
constexpr auto INVALID_CODE = L"Textractor: invalid code";
|
||||
constexpr auto NO_HOOKS = L"Textractor: no hooks detected";
|
||||
|
Loading…
x
Reference in New Issue
Block a user