Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Tuesday, 23 June 2015

UniBot - A Complete Tutorial For Making A Functional Configuration

UniBot - Making A Functional Configuration- picateshackz.com

This is the only article giving you the complete UniBot tutorial for making a functional configuration, 
Don't know how else to start, so I'll start with FAQ about this tool:

What is UniBot?
- UniBot is a unique program that is used for quick and easy creation of HTTP bots, without knowledge of any programming language and without any torment from designing GUI. It can be found here: http://mikisoft.me/programs/unibot (Virus scan)

For what is it actually used?
- You can create whatever thing comes to your mind, but most of them are some simple bots on which you will substantially lose time creating it in some IDE.

Does that mean I can create any type of bot?
- Yes, if you are skilled enough. You can create for example bots for voting or commenting, or you can make some bot that will rip out specific content from pages on some site, etc.

I have opened the program and nothing seems to be clear to me.
- That's why I decided to make this tutorial because interface of the program looks complicated, but once you begin to understand everything that I have presented in the following, it should be much clearer (at least I hope so).

So, let's start...

--- User interface ---


As you have seen if you've already downloaded and run the program, the interface may seem a little hard to understand, but don't be afraid. The following picture should cover most of the things that you'll need to know:





index - each index contains of one HTTP request (GET or POST) or solving logical statements (If-Then)
strings - that is data which is gathered before or after the execution of the request, depending on where the string is actually used (on this topic I'll write most because it's very important to know)
If clauses - a place to test strings if they meet certain conditions, and on that basis to decide what next to do (ie. which is next index or to stop the execution of the process)
results - a place where the string results are shown (if that is enabled in their options)

--- Indexes ---


Like I said, indexes must contain at least one request or logical statement for solving. We'll focus on the first.
As you know, the definition of each Internet bot is to assemble and send a specific HTTP requests, in order to achieve a specific goal. So in this program there are indexes, that present a separate templates of certain requests by which program is headed. As can be seen, each index can have a name for easier orientation.
To complete the formation of a HTTP request, there are two important items: POST data and additional headers, which are starting to appear mostly from the second request by gathering the results of the strings. Don't be confused because I only mention HTTP requests - HTTPS is supported, too.

--- Strings ---


This is the key point of the program, so you should pay special attention in order to learn to make bots after finishing this.

We'll begin with the facts:
- strings usually occur after execution of the first request
- each string should contain at least one command
- command that determines what will be the result must be valid and in accordance with the request that was previously sent
- most of the strings are essential for the continuation of the process
- they're executed depending on where they are used - before or after sending request
- their usage is %name% (where "name" is a name of the string)
- the string will not be executed if it isn't public and if there is no place in the index where it is used


If you understand this then we go into analysis of a string that contains one command:

Code:
'Hey!'+rpl('Hello, world!','world','Miki')
Now let's analyze its parts:

'Hey!' - everything that is under normal apostrophe represents a constant, and this constant is located at the beginning of the string so that will be the first thing printed into it

+ - character for merging command with constant, or with another command

rpl('Hello, world!','world','Miki') - it can be assumed that this is the command for replacing specific text, so in this case in the text "Hello, world!" it replaces "world" with "Miki"

The overall result would be:

Hey!Hello, Miki!
These are actually some of the most basic things you need to know if you want to go into the world of programming, but I wouldn't call this real programming because you must know a lot more than working with strings. Anyway, moving on...

If you haven't heard of regular expressions, then you should first look at them because they are very important for the formation of the string result. I will not talk about that, because you have a lot of examples and explanations all over the Internet.
The basic command for executing them (which looks like previous) is as follows:

Code:
rg(source,regex,replacement)
Example:
Code:
rg('Hey!Hello, Miki!',', (.*?)!','$1')
Result:
Miki

Independent commands:

These are commands that are processed even if they're located in the constants ie. under apostrophes.

First and most important command is: [src]
In its place there will be a complete page source (after completing request of course), with response headers at the beginning.

Second important command is: [nl]
Considering that the commands and the constants are written only in one line, I had to find a way to print the constants in multiple lines, so in place of this command a new line separator will be printed.

Third: [rnd]
In its place will be put random generated characters (upper and/or lower case letters, numbers and symbols), or a number from a given range.
To determine the range of characters that will be included, between the last letter and ] you have to add some of these letters:
U - since the default setting is to include only lowercase letters, this command specifies that onlyuppercase letters are considered
M - mixed-case: mixed uppercase and lowercase letters
L - includes only letters
D - includes only numbers
S - includes only symbols
The last three letters that define a range of characters can be combined, so we have the following example to generate random email addresses:

'[rndLD]@gmail.com'
Result would be:
6g4fog9bdl1fajn@gmail.com
As you can see, there is a default number of characters to be printed, and it's 15. To change this, again at the end we add number of characters that we want to be printed:
'[rndLD8]@gmail.com'
Result:
q6pxd1hp@gmail.com
As I mentioned above, there is another thing about this command - and that is to generate a random number from the specified range. Its usage is very simple:
Code:
'[rnd5-10]'
Obviously, this will generate some number between 5 and 10.

Fourth: [inp]
In the place of this command will be the user input, which usage is equivalent to the command above (except the U and M letters that are unnecessary in this case), so I will not say anything more about this.


String options:

After defining the string, the button next to it ("...") will be enabled which represent the options for that string. Click on it to get the following little window, where we choose which options will be used:




Crucial - it is important for the continuation of the process
Public - it is available in the other indexes for modification and usage
Array - after processing the string, if more than one result occurs (when using regex or input), this option applies the template to each of them separately (by making sub-threads), but if the option is disabled then only the first result is used
Output - this is the option that will show the string results in the main window

--- If clauses ---


The next are If clauses, which of course are not required if there is a HTTP request in a given index. If both are included, then the request will be executed first with all the strings that are with it, and then the If clauses with its strings. (After that the public strings that haven't been put in the HTTP request nor the If clauses will be executed.)
It is a simple principle of making them, so everyone could understand it without explanation (even better if he knows the mathematical logic, ie. the basics of programming). What I will mention is the operation depending on the results of an entire If clause, which will of course be one of the two possible outcomes - in the case where the If clause is true and the case where it is false. For the both cases, the options are the same.
We see on the right side option "Change proxy" - if the seconds to wait are not defined, it changes current to the next proxy address before proceeding to the next index ("Go to") or finishing process ("Finish"). If there is no available proxy address and the seconds are defined, then the process will not be stopped because seconds to wait will be chosen as alternative.

And that's it.

--- Additional stuff ---

Removing indexes:

You don't have to manually modify configuration file to delete indexes, instead of that do this:
1. If a given index contains only a request, then delete the URL field and you will be asked whether you want to delete the entire index.
2. If a given index contains only an If clause, then delete it. If it contains more than one, in the very first field type [clear] and hit Enter.
3. If a given index contains both, then use ways from above to delete them.


Proxy and thread settings:




Same proxy for each thread - every thread will act independently with a proxy list
Do not retry with another proxy - do not retry request if proxy is bad


Other (dependent) string commands:

u(text) - converts the text to uppercase
l(text) - converts the text to lowercase
b64(text) - encrypts the text with Base64
md5(text) - encrypts the text with MD5
<file> - loads the given file as text (by positioning to the folder where is the program itself)


multipart/form-data POST requests with files:


Code:
POST /?action=analyze HTTP/1.1
Host: samplesite.org
Content-Type: multipart/form-data; boundary=------280841152422961
Content-Length: 6818
------280841152422961
Content-Disposition: form-data; name="DataType"

file
------280841152422961
Content-Disposition: form-data; name="ImageFile"; filename="picture.jpg"
Content-Type: image/jpeg

ÿØÿà(...)
For the request above, we type this into the Post field:
Code:
['DataType':'file';'ImageFile':<picture.jpg>]

String builder:


In the field for entering string commands, (if it's not blank then before everything) type [build]and hit Enter.


Tutorial for making a functional configuration


Note: You'll need Google Chrome or Mozilla Firefox browser.

Let's say we want to make a bot that will give a vote here:


Provide a Visual Basic 6 Community edition - to allow free download of the VB6 programming language – Visual Studio

First of all, we open UniBot and paste that URL into the first index:



Then we open the browser and go to incognito/private browsing mode to be sure that none of the cookes exist.
After that, we open developer console (Ctrl+Shift+I), select Network tab and then navigate to the above URL.
We'll see something like this:



Now, we go to the top of the list on the right where is developer window and select the first item. A new window will show below, so we select "Headers" tab and then focus on "Response Headers":



For us the important thing will be "Set-Cookie" parameters, so we see that they're two unusual (ID cookies):

__cfduid
_session_id


The response headers are also part of the [src], so we have to extract that two values from it using two regex commands below:

Code:
rg('[src]','__cfduid=(.*?);')
Code:
rg('[src]','_session_id=(.*?);')

We put these commands where they belong:

Then we have to make these strings to be public, because we'll use them in another index. For the each of them, go to options ("...") and check "Public":

Now we'll focus on the browser window and clear the items in the list by clicking here:


After that, we should give a vote and catch that request. Click on the "Vote" button on the page and select a number of votes. We will now see this:


You can see that the first item and after it another one in the list is a POST request. We click on the first and select again "Headers", but we now focus on the "Request Headers" and notice these things:


There is some another parameter (CSRF token) that we haven't catched, and it must be in the page source if it wasn't in the very first response header from above. We open up the page source (Ctrl+U) and find it's value:


We have now a problem with forming a command to extract that value from source. It can't be like this:

Code:
rg('[src]','<meta content="(.*?)"','$1')
Since there are two meta content tags, the result would be the first:
Code:
authenticity_token
We solve this by pointing out to start from the second result. Since the first result is 0 then for the second result command will be:
rg('[src]','<meta content="(.*?)"','$1',1)
We repeat the steps for making a public string from above, and we got now the current (but not final) look of the first index:

If you have done all of this, you can select the second index:


We'll now back to the browser window and right click on the first item from the list, and select to copy link address:


The URL is now copied into our clipboard. We paste it into the URL field in UniBot:


Now, we back on the "Request Headers" in the browser below list, to look for the POST data that was sent:


We'll form it like this for the Post field in UniBot and ignore "debug" parameters:

Code:
site2=1&forum_id=121579
It will now look like this:


Also, we must include as additional headers cookies (in strings "cfduid" and "sessionuid") that we have extracted earlier, and the CSRF token:


Now we'll back on the browser. We will focus on the "Response Headers", to see yet another unusual cookies (ID and for authentication):


Again, we repeat the previous steps for making public strings with these commands:

Code:
rg('[src]','_uservoice_uid=(.*?);')
Code:
rg('[src]','auth_token=(.*?);')
And after you have done all of that, the second index finally should look like this:


Now, we click in the browser on the "votes.json" item in the list and focus on its "Request Headers". We'll see this:


Again, we find it's content in page source:


We'll use this command to extract it:

Code:
rg('[src]','client_key: "(.*?)"','$1')
We back to the first index and put that command into a new string, so it should look like this:


Don't forget to make that string also to be public!

Now, we back on the browser window again and copy link address of the "votes.json" from the list, and then paste it into the third index:


Because it's also a POST request, me must fill the Post field too. In the browser we focus again on the "Form Data" (below "Request Headers"):


As we have seen eariler, we form request like this:

Code:
uninitialized=true&to=3&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=%oauthkey%
As usual, we fill the additional headers with needed data (but this time we add "uid" and "auth" string into the cookies), and we got this:


Note: You can make all strings to be Crucial, if you want to see if commands for them work correctly.

And that's it! You can now test the config or pass it to someone to do it for you if you don't want to search for proxy, since you've voted already from your IP (I don't know will it work if you remove the votes in the browser, since it's another session).

Sunday, 14 June 2015

Introdoction to Game Hacking: AssaultCube External Memory Hacks

AssaultCube External Memory Hacks- picateshackz.com

Today i am going to be showing you how to hack AssaultCube shooter game, in this tutorial you will learn how to create a simple external memory hack.

The concept of memory hacks is fairly easy to grasp especially with a demonstration. So the idea of a Memory hack is generally, to access the games process memory in order to change values therefore affecting the status of the player in game or to read values in order to gain an unfair advantage. Memory hacks can do things such as give health or ammo, change the players position, or give other players positions (depending on the game).

Things you need:


Good to have:

  • aadp4olly (for getting by anti debugging solutions that might be implemented on commercial games) 

Before we get started I would also recommend adding this to your arguments inside the assaultcube.bat file "-t -w 800 -h 600", just because we are going to be messing around with a bunch of windows.


Things you should probably know (not completely necessary I suppose)

Hacking AssaultCube:



The first step in creating a memory hack is to find the adressess that you need to write to. For this we are going to use Cheat Engine. So open up assault Cube and Cheat Engine then attach Cheat Engine to ac_client.exe. The first address I am going to show how to find is the adress for the variable holding your ammo count. To do this first start a new scan, then search for the amount of ammo you currently have. Next take two shots and do another search with your new ammo count(click next scan). Continue this process until you have narrowed it down to two addresses. Add the top value (double click on it). Change the value by double click on the value column of the memory record in the record window. Make this value some number and see if it changes your ammo ingame. If it does change ingame then the top one was the correct address otherwise add the bottom address from the search and try it with that address. Great we have found the address of the variable holding the ammo count. Unfortunately this address will constantly change because of how virtual memory works so now we have to find a permanent pointer to this value.

Cheat Engine makes finding this pointer relatively easy. Right click on the memory record and select find what access this address. There will be a couple of asm instructions in the debugger window but these are not what we are looking for these are just used for displaying the value. To find the value we want take a shot then return to the window. The decrement instruction is the one we are looking for. This instruction decrements your ammo when you take a shot double click on it. (As a side note record the address of the decrement instruction for later.) Cheat engine will find the value of a pointer to this address. So we search this value in Cheat Engine. Add the address manually and make sure to check the box designating it a pointer and add no offset because there is none in the instruction. Continue to repeat this process on the pointer until you reach a static address(green). Record the address and its offsets.

Now the process needs to be repeated for the health variable. Unfortunately assault cube dos not provide a command to hurt yourself so you have to hurt yourself by ingame means such as standing by a grenade. So do a first scan for 100 and then find a grenade on the map you were loaded into and hurt yourself with it. Do the next scan with your new health value. Continue to do this until you have two values once again add the top one and change the value.

Repeat the process of finding a static pointer.


Explained using pictures for visual learners:

First we search our starting value for ammo which if you are using the assault rifle is 20



Next in game take three shots and search the new ammo value with next scan.



In some cases you will need to repeat that process to get two results. Since we narrowed it down to two add the top one and change the ammo value, then see if it changes in game.



It did in this case if it had not we would have tried the other value.



Next right click the record then click find what accesses this address; do not select the instructions that appear. First take a couple of shots then select the decrement instruction. After doing that you will be presented with a screen like this. Notice that the offset for this address is 0 (nothing added to esi). Record the offset then copy the value that is needed to find the address.



Search the value, make sure to check the hex box.



Since there is only one add it as a pointer.



Now find what accesses this pointer, record the offset(14), and copy the value.



Search the value.



Since there are multiple addresses start by adding the top address with both offsets.



This pointer turned out to be a dead end.



Therefore we move on to the next address found.



Once again find what accesses it after shooting.



Record the offset in your list(374,14,0). Now search this new value.



Alright we have found a stable address.



0051E20C offsets: 374,14,0



Repeat this for health: 0x00509B74 offsets: F8 (yours will probably be different depending on architecture etcc).


Programming the Hack:


The first thing we need to do to gain control of the game is to gain a handle linked to the process. To do this I wrote a method called getHandle.

Code: C

  1. /*
  2. * Returns a Handle for process matching pname
  3. */
  4. HANDLE getHandle(char pname[])
  5. {
  6.     DWORD dwPid=0;
  7.     HANDLE proc, hProc;
  8.     PROCESSENTRY32 pe32 = {sizeof(PROCESSENTRY32)};
  9.         while(!dwPid)
  10.         {
  11.         printf("Searching for ac process...\n");
  12.         printf("Make sure the game is running!\n");
  13.         hProc=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
  14.         if(Process32First(hProc, &pe32))//place process in pe32
  15.         {
  16.             do
  17.             {
  18.                
  19.                 if(!strcmp(pe32.szExeFile,pname))//compare pe32 pname to the pname
  20.                 {
  21.                     dwPid=pe32.th32ProcessID;//set pid to the pid of the process if the process names matched
  22.                     break;
  23.                 }
  24.             }while(Process32Next(hProc,&pe32));//move to next process
  25.         }
  26.         sleep(10);
  27.     }
  28.     proc=OpenProcess (PROCESS_ALL_ACCESS,FALSE,dwPid);//open process Handle
  29.     return proc;//return the Handle
  30. }



After we have a handle of the process we will need to calculate the dynamic adressess for this I wrote the method offCalc.

Code: C

  1. DWORD offCalc(DWORD b, DWORD offs[], int size, HANDLE proc)
  2. {
  3.     DWORD base=b;
  4.     DWORD ptemp;
  5.     int i;
  6.     for(i=0;i<size;i++)//loops through offsets
  7.     {
  8.         ReadProcessMemory(proc, (LPCVOID)base,&ptemp,sizeof(ptemp),NULL);//reads the next adress into ptemp
  9.         base=ptemp+offs;//adds ptemp to the offset
  10.         printf("0x%x+%x=%x\n",ptemp, offs, base);//prints debugging info
  11.     }
  12.    
  13.     return base;//return address
  14. }



After we have the dynamic adressess all that is left is to write the values into their addresses.

Code: C

  1. int writeVal(HANDLE proc, DWORD addr,BYTE *val)
  2. {
  3.     return WriteProcessMemory(proc,(BYTE*)addr,val,4,NULL);//write the value to the proc at addr
  4. }


This is all tied together in main.

Code: C


  1. int main()
  2. {
  3.     BYTE setval[]={0x64,0x00,0x00,0x00};//100 in hex because of little endian
  4.     HANDLE proc=NULL;//handle for the process
  5.     DWORD health={0x00509B74};//static adress for health
  6.     DWORD haddr;
  7.     DWORD offh[]={0xF8};//offsets health
  8.     DWORD ammo={0x0051E20C};//static adress for ammo
  9.     DWORD aaddr;
  10.     DWORD offa[]={0x374, 0x14, 0x00};//offsets for ammo
  11.     char gameName[]="ac_client.exe";//name of the process
  12.     proc=getHandle(gameName);//set proc to the Handle gained by get Handle
  13.     if(proc!=0)//check if proc was retrieved
  14.     {
  15.         haddr=offCalc(health,offh,1,proc);//calculate  the dynamic address and set haddrr
  16.         aaddr=offCalc(ammo,offa,3,proc);//calculate the dynamic adress of and set aaddr
  17.         int check1;//bool for write status
  18.         int check2;//bool for write status
  19.     while(1==1)//infinite loop cause im lazy
  20.             {
  21.             check1=writeVal(proc,haddr,setval);//write the val for health and place the status in check 1
  22.             check2=writeVal(proc,aaddr,setval);//write the val for ammo and place the status in check 2
  23.             if(!check1&&!check2)//print error adressess if write returns 0
  24.             {
  25.                 if(!check1)
  26.                     printf("Error writing to 0x%x",haddr);
  27.                 if(!check2)
  28.                     printf("Error writing to 0x%x",aaddr);
  29.             }
  30.         }
  31.     }
  32. }



Final Code:

Code: C

  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <tlhelp32.h>
  6. //function prototypes
  7. DWORD offCalc(DWORD b, DWORD offs[], int size, HANDLE proc);
  8. HANDLE getHandle(char windowname[]);
  9. int writeVal(HANDLE proc, DWORD addr,BYTE *val);
  10. int main()
  11. {
  12.     BYTE setval[]={0x64,0x00,0x00,0x00};//100 in hex because of little endian
  13.     HANDLE proc=NULL;//handle for the process
  14.     DWORD health={0x00509B74};//static adress for health
  15.     DWORD haddr;
  16.     DWORD offh[]={0xF8};//offsets health
  17.     DWORD ammo={0x0051E20C};//static adress for ammo
  18.     DWORD aaddr;
  19.     DWORD offa[]={0x374, 0x14, 0x00};//offsets for ammo
  20.     char gameName[]="ac_client.exe";//name of the process
  21.     proc=getHandle(gameName);//set proc to the Handle gained by get Handle
  22.     if(proc!=0)//check if proc was retrieved
  23.     {
  24.         haddr=offCalc(health,offh,1,proc);//calculate  the dynamic address and set haddrr
  25.         aaddr=offCalc(ammo,offa,3,proc);//calculate the dynamic adress of and set aaddr
  26.         int check1;//bool for write status
  27.         int check2;//bool for write status
  28.     while(1==1)//infinite loop cause im lazy
  29.             {
  30.             check1=writeVal(proc,haddr,setval);//write the val for health and place the status in check 1
  31.             check2=writeVal(proc,aaddr,setval);//write the val for ammo and place the status in check 2
  32.             if(!check1&&!check2)//print error adressess if write returns 0
  33.             {
  34.                 if(!check1)
  35.                     printf("Error writing to 0x%x",haddr);
  36.                 if(!check2)
  37.                     printf("Error writing to 0x%x",aaddr);
  38.             }
  39.         }
  40.     }
  41. }
  42. int writeVal(HANDLE proc, DWORD addr,BYTE *val)
  43. {
  44.     return WriteProcessMemory(proc,(BYTE*)addr,val,4,NULL);//write the value to the proc at addr
  45. }
  46. /*
  47. * Returns a Handle for process matching pname
  48. */
  49. HANDLE getHandle(char pname[])
  50. {
  51.     DWORD dwPid=0;
  52.     HANDLE proc, hProc;
  53.     PROCESSENTRY32 pe32 = {sizeof(PROCESSENTRY32)};
  54.         while(!dwPid)
  55.         {
  56.         printf("Searching for ac process...\n");
  57.         printf("Make sure the game is running!\n");
  58.         hProc=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
  59.         if(Process32First(hProc, &pe32))//place process in pe32
  60.         {
  61.             do
  62.             {
  63.                
  64.                 if(!strcmp(pe32.szExeFile,pname))//compare pe32 pname to the pname
  65.                 {
  66.                     dwPid=pe32.th32ProcessID;//set pid to the pid of the process if the process names matched
  67.                     break;
  68.                 }
  69.             }while(Process32Next(hProc,&pe32));//move to next process
  70.         }
  71.         sleep(10);
  72.     }
  73.     proc=OpenProcess (PROCESS_ALL_ACCESS,FALSE,dwPid);//open process Handle
  74.     return proc;//return the Handle
  75. }
  76. /*
  77. * Returns the adress with calculated offsets
  78. */
  79. DWORD offCalc(DWORD b, DWORD offs[], int size, HANDLE proc)
  80. {
  81.     DWORD base=b;
  82.     DWORD ptemp;
  83.     int i;
  84.     for(i=0;i<size;i++)//loops through offsets
  85.     {
  86.         ReadProcessMemory(proc, (LPCVOID)base,&ptemp,sizeof(ptemp),NULL);//reads the next adress into ptemp
  87.         base=ptemp+offs;//adds ptemp to the offset
  88.         printf("0x%x+%x=%x\n",ptemp, offs, base);//prints debugging info
  89.     }
  90.    
  91.     return base;//return address
  92. }



You are done, Thanks for reading.