Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Coding Releases
You last visited: Today at 02:59

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C++] simpler OOP patcher

Discussion on [C++] simpler OOP patcher within the Coding Releases forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2010
Posts: 35
Received Thanks: 4
Red face [C++] simpler OOP patcher

Mir war langweilig und es sollte eine kleine OOP übung werden.
heraus gekommen ist ein patcher der ein pattern sucht und
ggf. patcht ... für anfänger leicht abänderbar... wer mag baut sich eine
GUI... ich wollte nix erklären evtl. hilft es jemanden bzw ist trotzdem
zu gebrauchen. ... ich sag nur: wenigstens selbstgemacht und nicht geklaut.



myheader.h:
Code:
#ifndef _headerA_
#define _headerA_
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
#endif


main.cpp:
Code:
#include "myheader.h"

class dateioperationen
{
private:
	string inputpath;
	string outputpath;
	int filelength;
	char* buffer;
	char* bufferpointer;
public:
	void readbinary(string inputpath);
	void writebinary(string outputpath);
	void searchPattern(string searchpattern, string patch);
};



// Setter - readbinary
void dateioperationen::readbinary(string inputpath) 
{
	// openfile if exists:
	fstream openedfile(inputpath, ios::binary|ios::in);
	if(!openedfile) {cerr << "Could not read file " << inputpath << " or read error!" << endl; system("pause"); exit(2);}
	// get/set length of file:
	openedfile.seekg(0, ios::end);
	filelength = openedfile.tellg();
	openedfile.seekg(0, ios::beg);	
	// create buffer:
	buffer = new char [filelength];
	// read data as a block:
	openedfile.read (buffer,filelength);
	bufferpointer = buffer;
	openedfile.close();
// not in use:
//	cout << "Start search at address: " << hex << (void*)bufferpointer << endl;
//	cout << "Length in bytes (hex): " << hex << filelength << endl;
//	cout << "End search at address: " << hex << uppercase << (((int)(void*)bufferpointer)+filelength) << endl;
//
}


// setter - writebinary
void dateioperationen::writebinary(string outputpath) 
{
	fstream openedfile(outputpath, ios::binary|ios::out);
	if(!openedfile) {cerr << "Could not write file " << outputpath << " (May be write protected because its used by another program)" << endl; system("pause"); exit(2);}
	openedfile.write (buffer,filelength);
}

// getter hex-search & replace:
void dateioperationen::searchPattern(string searchpattern, string patch)
{
	int cmp, found = 0, patched = 0;
	char answer;

	bool allflag = 0;

	for(char* i = bufferpointer-1; i < bufferpointer-1+filelength; i++)
	{
		cmp=memcmp ( searchpattern.c_str(), i, searchpattern.size() );
		if(cmp==0) 
			{ 
				found++;
				if(!allflag)
					{
					cout << "Found at offset: " << hex << (int)((void*)i) - (int)((void*)buffer) << endl;
					cout << "Execute patch ? ( (y)es / (n)o / (a)ll ):";
					cin >> answer;
					cout << endl;
					switch(answer)
						{
						case 'a':
						case 'A':
							cout << "Patched offset: " << hex << (int)((void*)i) - (int)((void*)buffer) << endl;
							memcpy(i,patch.c_str(),patch.size());
							patched++; allflag = 1;
							continue;
						case 'y':
						case 'Y':
							cout << "Patched offset: " << hex << (int)((void*)i) - (int)((void*)buffer) << endl;
							memcpy(i,patch.c_str(),patch.size());
							patched++;
							continue;
						case 'n':
						case 'N':
							cout << "Not patched: " << hex << (int)((void*)i) - (int)((void*)buffer) << endl;
							continue;
						}
					}
					cout << "Patched offset: " << hex << (int)((void*)i) - (int)((void*)buffer)  << endl;
					memcpy(i,patch.c_str(),patch.size());
					patched++;
					
			}
	}
	cout << endl;
	cout << "----------- Patchprocess ended -----------" << endl;
	cout << "Results: Found pattern: " << found << endl;
	cout << "Number of patched pattern: " << patched << endl;
	cout << endl;

}


//main:
int main()
{
	// create object:
	dateioperationen datei;
	//some information:
	cout << endl;
	cout << "--- Simple OOP byte patcher V0.01 by WhiteLion ---" << endl;
	cout << "--- Credit me if you use my source code please ---" << endl;
	cout << endl;
	cout << "--------------------------------------------------" << endl;
	cout << "---             PaTcH iNfOrMaTiOn:             ---" << endl;
	cout << "---    IP - P*ro*filer V 5.30.124 and latest   ---" << endl;
	cout << "--------------------------------------------------" << endl;

	// read file + path:
	datei.readbinary("ipprofiler.exe");
	// backup file + path
	datei.writebinary("ipprofiler.bak");
	// search pattern position + new pattern to write:
	datei.searchPattern("\x74\x49\x8B\x45\xFC\x83\x78","\x90\x90");
	// save patched file + path
	datei.writebinary("ipprofiler.exe");
	system("pause");
	return 0;
}
WhiteLionATX is offline  
Old 09/21/2011, 17:18   #2


 
Jeoni's Avatar
 
elite*gold: 966
Join Date: Apr 2010
Posts: 1,105
Received Thanks: 681
Ist zwar schön, dass du das gemacht hast, allerdings finde ich, da es kein wirkliches Tutorial (mit Erklärungen usw. ist), sollte es nicht in diese Section. Daher:
#move request
Jeoni is offline  
Old 09/21/2011, 19:55   #3
 
elite*gold: 0
Join Date: Nov 2009
Posts: 343
Received Thanks: 45
Was soll das bringen? Das is doch kein Tutorial?

MfG
yihaaa is offline  
Old 09/22/2011, 15:38   #4
 
elite*gold: 0
Join Date: Nov 2010
Posts: 35
Received Thanks: 4
@yihaa

lies die code comments
WhiteLionATX is offline  
Reply

Tags
c++ oop patcher whitelion


Similar Threads Similar Threads
[09.06.11][NEW] Simpler Pickup Bot [NEW]
06/19/2011 - Metin2 Hacks, Bots, Cheats, Exploits & Macros - 18 Replies
Hallo epvp-Community, heute zeige ich euch meinen neuen und ersten Pickup Bot. Er ist ganz simpel und leicht zu bedienen. Hotkeys: F7 = Start F6 = Pause F8 = Ende Wenn ihr fragen habt fragt mich einfach.
simpler Macro Bot
01/27/2010 - Aion Hacks, Bots, Cheats & Exploits - 7 Replies
Heyho alle, hab mir aus langeweile mal nen Macro Bot gebaut hab den heute erst geschrieben, wollt mal sehn wie der so funzen würd weil bin jetzt neu bei Aion ^^ der funktioniert jetzt auch schon gut, nur hatte paar probleme mit postmessage und keybd_event :o How to use: Einfach wie in Aion die makros schreiben :D
Simpler Bot mit der Win API
06/21/2009 - Tutorials - 13 Replies
Welcome, Devil Boy! Mein erstes Tutorial wird ein wenig beschreiben, wie man sich einen simplen kleinen Bot zum Automatisieren verschiedener Abläufe in C basteln kann. Dies wird ein Pixel Bot. Also ein Programm, das nach vordefinierten Pixeln sucht, und auf bestimmte Ereignisse verschiedene Dinge vollbringt. Wir nehmen als Beispiel einmal ein MMORPG. Darin müssten verschiedene Kriterien erfüllt werden, um in den vollen Genuss eines funktionierenden Noob-Bots zu kommen: Die Monster müssen...
simpler Flaschenbot!!
05/25/2009 - Browsergames - 7 Replies
kann nicht einer von euch super genialen (ernst gemeint!) scripter einen simplen und gut laufenden flaschenbot erstellen..?? ich würde es ja selber gerne machen aber so schlau bin ich da auch nicht -.- z.B.: wie die alten flaschenbots für Hamburg... einfach einen für berlin scripten... Mfg brausebrocken..
Simpler Spam Bot
01/10/2009 - Metin2 Hacks, Bots, Cheats, Exploits & Macros - 4 Replies
Hier mein universal spambot funkt net nur bei metin2 einfach text eingeben und starten gechwindigkeitseinsellung 1000 entspricht 1 sekunde Ihr solltet den Spambot nur benutzen wenn ihr metin im fenstermodus spielt damit ihr jederzeit den stopbuton klicken könnt Bei einsellungen unter o,5 sekunden also unter 500 macht das das Siel nicht mehr mit und ihr fliegt vom server. http://renuwell.beepworld.de/files/Chat%20Spamer% 20lolomgwtf.exe



All times are GMT +1. The time now is 02:59.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.