1- basic understanding for assembly language
in this article i will be writing about the process of batching any binary by explaining a simple exe file example
we will be working with this game.exe file that expects input from the user and then validate (compare it with the licence ) this input and decides whether to open the game or not..
so for us to be able to play we should have a valid licence key , right?
but no we are hackers and by playing some of our dirty games we can break this :D ..
this is the last challenge from the Beginner Tutorial category
basically it is a programming skills test , in order to solve this challenge you must automate solving 500 math quiz , so lets start by analyzing the solution code.
we will be using pwn lib for this challenge , i recommend reading the documentation
1- at line 6 we initialize the connection to the remote host an then after that we retrieve two lines ,those fist two lines are not important for us because our numbers appear in the third line we retrive from the server
at the very beginning there is a struct defined called auth with two element
name( 32 bytes size ) from type char and auth with the type int ( by default on 32 and 64 bit machines the type int has a 4 bytes size )
at the next line we have two pointers auth ( pointer to the auth struct ) and struct
next inside the main function there is this while loop that prints the auth and service pointers and reads a line with a maximum of 128 bytes (this is a secure fgets) , next we…
assume you are writing some code and you wanted to use a certain function
well , there is two kinds of functions
look at this code below
now all what this program does is calling printf function , which is an external function in libc , now lets compile it and open it in a disassembler , in my case i will open it in Ghidra
1- The STACK
we can define the stack by saying it is a linear data structure , when every program or executable is running it is been loaded in the memory , as we know every program has data to process and has functions , we can divide the data into two main categories
1- GLOBAL data or variables
2- LOCAL data or variables
now the main difference between local and global variables is in declaration
local variables are declared inside functions and when the functions terminates the local variables inside of it disappears , the opposite is with global…
2. Ghidra has a built in decompiler which makes it easy for us to see the C code of the function , look to the decompiler’s window and you will see the code.
3.we see that there is int param_1 and long param_2 passed to main function , change them to int argc and char** argv
by right click and choose Edit Function Signiture , you will get the following window