This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
MajorTom
committed
Feb 22, 2016
0 parents
commit 6ed4eb8
Showing
14 changed files
with
356 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<CodeBlocks_project_file> | ||
<FileVersion major="1" minor="6" /> | ||
<Project> | ||
<Option title="MEGABOT" /> | ||
<Option pch_mode="2" /> | ||
<Option compiler="gcc" /> | ||
<Build> | ||
<Target title="Debug"> | ||
<Option output="bin/Debug/MEGABOT" prefix_auto="1" extension_auto="1" /> | ||
<Option object_output="obj/Debug/" /> | ||
<Option type="1" /> | ||
<Option compiler="gcc" /> | ||
<Compiler> | ||
<Add option="-g" /> | ||
</Compiler> | ||
</Target> | ||
<Target title="Release"> | ||
<Option output="bin/Release/MEGABOT" prefix_auto="1" extension_auto="1" /> | ||
<Option object_output="obj/Release/" /> | ||
<Option type="1" /> | ||
<Option compiler="gcc" /> | ||
<Compiler> | ||
<Add option="-O2" /> | ||
</Compiler> | ||
<Linker> | ||
<Add option="-s" /> | ||
</Linker> | ||
</Target> | ||
</Build> | ||
<Compiler> | ||
<Add option="-Wall" /> | ||
<Add option="-fexceptions" /> | ||
</Compiler> | ||
<Unit filename="./bot.cpp" /> | ||
<Unit filename="./bot.h" /> | ||
<Unit filename="main.cpp" /> | ||
<Unit filename="visual.cpp" /> | ||
<Unit filename="visual.h" /> | ||
<Extensions> | ||
<code_completion /> | ||
<envvars /> | ||
<debugger /> | ||
<lib_finder disable_auto="1" /> | ||
</Extensions> | ||
</Project> | ||
</CodeBlocks_project_file> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# depslib dependency file v1.0 | ||
1446231904 source:c:\users\majortom\documents\megabot\main.cpp | ||
<iostream> | ||
<windows.h> | ||
<time.h> | ||
"visual.h" | ||
"bot.h" | ||
|
||
1446160584 c:\users\majortom\documents\megabot\visual.h | ||
<iostream> | ||
<windows.h> | ||
|
||
1446160904 source:c:\users\majortom\documents\megabot\visual.cpp | ||
"visual.h" | ||
|
||
1446163738 c:\users\majortom\documents\megabot\bot.h | ||
<windows.h> | ||
|
||
1446474814 source:c:\users\majortom\documents\megabot\bot.cpp | ||
"bot.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> | ||
<CodeBlocks_layout_file> | ||
<FileVersion major="1" minor="0" /> | ||
<ActiveTarget name="Debug" /> | ||
<File name="bot.cpp" open="1" top="0" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="0" topLine="30" /> | ||
</Cursor> | ||
</File> | ||
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="3294" topLine="10" /> | ||
</Cursor> | ||
<Folding> | ||
<Collapse line="47" /> | ||
</Folding> | ||
</File> | ||
<File name="visual.cpp" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="576" topLine="0" /> | ||
</Cursor> | ||
</File> | ||
<File name="visual.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0"> | ||
<Cursor> | ||
<Cursor1 position="185" topLine="0" /> | ||
</Cursor> | ||
</File> | ||
</CodeBlocks_layout_file> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef BOT_INCLUDED | ||
#define BOT_INCLUDED | ||
|
||
|
||
|
||
#endif // BOT_INCLUDED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "bot.h" | ||
|
||
DWORD lifeBaseAdress = {0x08FCB398}; | ||
DWORD currentOffset = {0x4C}; | ||
DWORD totalOffset = {0x48}; | ||
|
||
void bot_action(INPUT ip) | ||
{ | ||
ip.ki.wVk = VK_SPACE; // virtual-key code for the "a" key | ||
ip.ki.dwFlags = 0; // 0 for key press | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
// Release the "A" key | ||
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
|
||
ip.ki.wVk = 0x58; // X | ||
ip.ki.dwFlags = 0; | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
/* | ||
ip.ki.wVk = 0x31; // 1 | ||
ip.ki.dwFlags = 0; | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.wVk = 0x32; // 2 | ||
ip.ki.dwFlags = 0; | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
/* | ||
ip.ki.wVk = 0x33; // 3 | ||
ip.ki.dwFlags = 0; | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.wVk = 0x34; // 4 | ||
ip.ki.dwFlags = 0; | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.wVk = 0x35; // 5 | ||
ip.ki.dwFlags = 0; | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
*/ | ||
} | ||
|
||
|
||
void read_memory(HANDLE hProcHandle, int *max_life, int *current_life) | ||
{ | ||
DWORD lifeTotalAddreToRead = lifeBaseAdress + totalOffset; | ||
ReadProcessMemory(hProcHandle,(BYTE*)lifeTotalAddreToRead,max_life,sizeof(max_life), NULL); | ||
DWORD lifeCurrentlAddreToRead = lifeBaseAdress + currentOffset; | ||
ReadProcessMemory(hProcHandle,(BYTE*)lifeCurrentlAddreToRead,current_life,sizeof(current_life), NULL); | ||
} | ||
|
||
void sit_down(INPUT ip) | ||
{ | ||
ip.ki.wVk = 0x43; // C | ||
ip.ki.dwFlags = 0; | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release | ||
SendInput(1, &ip, sizeof(INPUT)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef BOT_H_INCLUDED | ||
#define BOT_H_INCLUDED | ||
#define WINVER 0x0500 | ||
#include <windows.h> | ||
|
||
void bot_action(INPUT ip); | ||
void sit_down(INPUT ip); | ||
void read_memory(HANDLE hProcHandle, int *max_life, int *current_life); | ||
#endif // BOT_H_INCLUDED |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#include <iostream> | ||
#define WINVER 0x0500 | ||
#include <windows.h> | ||
//#include <winuser.h> | ||
#include <time.h> | ||
#include "visual.h" | ||
#include "bot.h" | ||
|
||
LPCSTR LGameWindow = "NosTale"; | ||
std::string GameStatus; | ||
bool updateNextRun; | ||
bool isGameAvail; | ||
|
||
int main() | ||
{ | ||
bool bot_status; | ||
int refreshTimer; | ||
int botTimer; | ||
int total_life; | ||
int current_life; | ||
INPUT ip; | ||
RECT r; | ||
|
||
HWND console = GetConsoleWindow(); | ||
GetWindowRect(console, &r); | ||
MoveWindow(console,r.left, r.top,400,512 ,true); | ||
|
||
bot_status = false; | ||
refreshTimer = clock(); | ||
botTimer = clock(); | ||
total_life = 0; | ||
current_life = 0; | ||
// Set up a generic keyboard event. | ||
ip.type = INPUT_KEYBOARD; | ||
ip.ki.wScan = 0; // hardware scan code for key | ||
ip.ki.time = 0; | ||
ip.ki.dwExtraInfo = 0; | ||
|
||
|
||
//Handle part | ||
HWND hGameWindow = NULL; | ||
DWORD dwProcID = NULL; | ||
HANDLE hProcHandle = NULL; | ||
int GameAvailTMR = clock(); | ||
|
||
//Main Loop | ||
while (!GetAsyncKeyState(VK_F12)) | ||
{ | ||
|
||
GameAvailTMR = clock(); | ||
isGameAvail = false; | ||
|
||
hGameWindow = FindWindow(NULL,LGameWindow); // trouver la fenetre | ||
if (hGameWindow) | ||
{ | ||
GetWindowThreadProcessId(hGameWindow, &dwProcID);//Get process ID | ||
if (dwProcID != 0) // Si process est ok | ||
{ | ||
hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID); | ||
if (hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL) | ||
{ | ||
if (hProcHandle == INVALID_HANDLE_VALUE) | ||
GameStatus = "INVALID_HANDLE_VALUE"; | ||
else | ||
GameStatus = "NULL"; | ||
if (GetLastError() == 5) | ||
GameStatus = "/!\\ ACCES DENIED /!\\ -> Redemarrer le BOT en Administrateur"; | ||
} | ||
else | ||
{ | ||
GameStatus = "Processus ok"; | ||
isGameAvail = true; | ||
} | ||
} | ||
else | ||
{ | ||
GameStatus = "Impossible de recuperer l'id de processus"; | ||
} | ||
} | ||
else | ||
{ | ||
GameStatus = "NosTale n'a pas ete trouver !"; | ||
} | ||
read_memory(hProcHandle, &total_life, ¤t_life); | ||
|
||
if (clock() - refreshTimer > 300) | ||
{ | ||
refreshTimer = clock(); | ||
align_name("Mega Bot by MajorTom"); | ||
std::cout << "Game Status: " << GameStatus << std::endl; | ||
show_bar(); | ||
show_help(); | ||
std::cout << "Life: " << current_life << "/" << total_life << "\t\t\t\t" << int(((float)current_life / (float)total_life)*100) << "%" << std::endl; | ||
std::cout << "BOT: "<< ((bot_status) ? "ON" : "OFF") << std::endl; | ||
} | ||
if (GetAsyncKeyState(VK_HOME) && bot_status == false) | ||
{ | ||
bot_status = true; | ||
botTimer = clock(); | ||
} | ||
if (GetAsyncKeyState(VK_END) && bot_status == true) | ||
{ | ||
bot_status = false; | ||
} | ||
|
||
if (bot_status == true) | ||
{ | ||
if (clock() - botTimer > 500) | ||
{ | ||
//bot | ||
/* | ||
if (int(((float)current_life / (float)total_life)*100) < 25) | ||
{ | ||
MessageBox(NULL,"Vie basse, faite une pause...","Vie Basse", 0); | ||
while (int(((float)current_life / (float)total_life)*100) != 100) | ||
read_memory(hProcHandle,&total_life, ¤t_life); | ||
MessageBox(NULL,"Reprise du Bot...","Vie Haute", 0); | ||
} | ||
else | ||
bot_action(ip);*/ | ||
bot_action(ip); | ||
botTimer = clock(); | ||
} | ||
} | ||
} | ||
return 0; | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "visual.h" | ||
|
||
void show_bar(void) | ||
{ | ||
CONSOLE_SCREEN_BUFFER_INFO csbi; | ||
int col; | ||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); | ||
col = csbi.srWindow.Right - csbi.srWindow.Left + 1; | ||
int i(-1); | ||
while (++i < col) | ||
std::cout << "#"; | ||
//std::cout << std::endl; | ||
} | ||
|
||
void align_name(char * appname) | ||
{ | ||
int lenght; | ||
int col; | ||
|
||
lenght = 0; | ||
while (appname[lenght] != '\0') | ||
lenght++; | ||
system("cls"); | ||
CONSOLE_SCREEN_BUFFER_INFO csbi; | ||
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); | ||
col = csbi.srWindow.Right - csbi.srWindow.Left + 1; | ||
int sizeBefore = (col - lenght) / 2; | ||
show_bar(); | ||
for (int i = 0;i <= sizeBefore; i++) | ||
std::cout << " "; | ||
std::cout << appname << std::endl; | ||
show_bar(); | ||
} | ||
|
||
void show_help(void) | ||
{ | ||
std::cout << "HOME: Start Bot\nEND: Pause Bot\nF12: Quit" << std::endl; | ||
show_bar(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#ifndef VISUAL_H_INCLUDED | ||
#define VISUAL_H_INCLUDED | ||
#include <iostream> | ||
#include <windows.h> | ||
|
||
void show_bar(void); | ||
void align_name(char * appname); | ||
void show_help(void); | ||
#endif // VISUAL_H_INCLUDED |