# Game Hacking
## Meet 1
- **Setting up the Pwnie Adventure 3 Game** :
- Client : https://www.pwnadventure.com/
- Sever setup guide : https://hackmd.io/@codeIMperfect/rJQVjowbxl and https://docs.google.com/document/d/1u8OUS_gWtqCxrzFDz3qHHwZgAyFWtIfH1iakPPo5MvI/edit?usp=sharing
- **Compilation** : https://www.youtube.com/watch?v=ksJ9bdSX5Yo
- **Linking** : CSAPP(Computer Systems: A Programmer's Perspective Book) Ch-7 [Don't need to read all of it, just read stuff relevant to today's discussion]
## Meet 2
- **PLT** and **GOT**:
- https://docs.thecodeguardian.dev/operating-systems/linux-operating-system/understanding-plt-and-got
- **GDB**:
- https://ctf101.org/reverse-engineering/what-is-gdb/
- Try these **4 challenges**:
- https://play.picoctf.org/practice/challenge/395?category=3&page=1&search=GDB
- https://play.picoctf.org/practice/challenge/396?category=3&page=1&search=GDB
- https://play.picoctf.org/practice/challenge/397?category=3&page=1&search=GDB
- https://play.picoctf.org/practice/challenge/398?category=3&page=1&search=GDB
## Meet 3
**Topics**:
- **C++** : Aggregate Initialization, Structs and Classes, Inheritance, Polymorphism, Constructors, Virtual Functions, VTables
- Reversing, Assembly
**Resources**:
For all the **C++ stuff** covered in last 2 sessions, read following chapters from learncpp.com :
- Introduction to Classes, constructors etc. (chapter 14)
- Operator Overloading (chapter 21)
- Inheritance (chapter 24)
- Virtual Functions, VTables, vptr (chapter 25)
**Do attempt exercises from above chapters** to get a better hold of topics.
**Reversing 101** : https://hackmd.io/@rdksupe/B1bo2ixzlg
If you are interested you can also watch these videos (not relevant directly) just interesting :
- https://youtu.be/rlM9JGx81xk?si=1MIx0aiNnYA5R-uD
- https://youtu.be/suABtb8_2Zk?si=hDHIgwhl8Mx0NTrQ
To practice reversing, practicing challenges from following websites:
- [crackme](https://crackmes.one/)
- picoctf
- microcorruption
## Meet 4
Recording of 1st half : https://youtu.be/qUNIGp3HICU
Follow this for reversing libgamelogic.so and try to explore and figure out stuff that feels relevant, relevant classes, their methods and stuff
https://youtu.be/8wz2CM0483o
Resources for 2nd half :
- Challenges :
- https://play.picoctf.org/practice/challenge/115
- https://play.picoctf.org/practice/challenge/110
- https://play.picoctf.org/practice/challenge/286
- https://play.picoctf.org/practice/challenge/103
- Writeups:
- https://medium.com/@yousefalzayat02/picoctf-writeup-wireshark-doo-dooo-do-doo-066bf2614d06
- https://medium.com/@khamismohamed024/picoctf-wireshark-twoo-twooo-two-twoo-digital-forensics-0cffd8b6ab22
- https://medium.com/@quackquackquack/picoctf-trivial-flag-transfer-protocol-writeup-20c5d2d0dfdf
Wireshark Intro : https://youtu.be/qTaOZrDnMzQ?si=GfquPsfetNlN_KYl
---
### Assignment - https://github.com/pclubiitk/Game-Hacking-25/blob/main/Assignment-1/Assignment1.md
---
## Meet 5
dlsym - https://man7.org/linux/man-pages/man3/dlsym.3.html
Session codes : https://github.com/pclubiitk/Game-Hacking-25/tree/main/Session-Codes/Session%205 (main.cpp and gamelogic.h)
Hack done : Infinite Jump and Infinite Health Hack
Resources :
- https://www.youtube.com/watch?v=8wz2CM0483o&list=PLhixgUqwRTjzzBeFSHXrw9DnQtssdAwgG&index=4&pp=iAQB
- https://www.youtube.com/watch?v=W7MC05_JN68&list=PLhixgUqwRTjzzBeFSHXrw9DnQtssdAwgG&index=5&t=395s&pp=iAQB
- https://www.youtube.com/watch?v=VzZi2AGAsOY&list=PLhixgUqwRTjzzBeFSHXrw9DnQtssdAwgG&index=6&t=124s&pp=iAQB
---
## Meet 6
1. Cheat Engine - Finish Cheat Engine tutorial till 8th step (Multilevel pointers).. after it stuff is optional.
2. Using cheat engine on Assault Cube game.
3. **Windows api, Windows.h**
- https://learn.microsoft.com/en-us/windows/win32/apiindex/windows-api-list
- https://www.youtube.com/watch?v=S4lQwJawOzI&t=1s
- https://www.youtube.com/watch?v=zqi2KE6RA38
4. **String Encodings - Ascii, MBCS, Unicode**
- https://www.youtube.com/watch?v=MijmeoH9LT4
- http://www.cunningplanning.com/post/the-private-lives-of-strings/
- http://www.cunningplanning.com/post/unicode-and-windows/
- http://www.cunningplanning.com/post/unicode/
- https://www.codeproject.com/Articles/2995/The-Complete-Guide-to-C-Strings-Part-I-Win32-Chara
- http://utf8everywhere.org/
5. **External, Internal Hacks ; Getting Module Base Addresses, Getting Procids, ASLR, ImageBase in PE**
- https://tryhackme.com/room/dissectingpeheaders
- https://www.youtube.com/watch?v=SBqERAbDdAk
- https://devblogs.microsoft.com/oldnewthing/20141003-00/?p=43923
- ToolHelp32 : https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/ (to create snapshot)
- MODULEENTRY32 : https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/ns-tlhelp32-moduleentry32?redirectedfrom=MSDN
- CreateToolhelp32Snapshot : https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot?redirectedfrom=MSDN
- Module32First : https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-module32first?redirectedfrom=MSDN
- Module32Next : https://learn.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-module32next?redirectedfrom=MSDN
- strcmp, wcscmp, _mbscmp, _mbscmp_l : https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/strcmp-wcscmp-mbscmp?view=msvc-170&redirectedfrom=MSDN
- CloseHandle : https://learn.microsoft.com/en-us/windows/win32/api/handleapi/nf-handleapi-closehandle?redirectedfrom=MSDN
6. **Multilevel Pointers and FindDMAAddy**
- https://www.youtube.com/watch?v=_W0xdVO8-j4
- https://www.youtube.com/watch?v=e_Y1u1jpYLI
Session code :
https://github.com/pclubiitk/Game-Hacking-25/tree/main/Session-Codes/Session%206
---