Skip to content

bongbongco/PyCheat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

37 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

PyCheat

Another process's memory access and modulation on Windows (like Cheat Engine)

PyCheat ์†Œ์Šค ๋ถ„์„ํ•˜๊ธฐ

###์‚ฌ์šฉ ๋ชจ๋“ˆ

  • sys :

  • sys - platform : ํ”Œ๋žซํผ ์‹๋ณ„ ๊ฐ’์„ ๋ฐ˜ํ™˜

  • sys - maxsize : Integer ์ตœ๋Œ€ ๊ฐ’ ๋ฐ˜ํ™˜

  • sys - exit : ํ”„๋กœ์„ธ์Šค ์ข…๋ฃŒ

  • ctype :

  • ctypes - windll : ๊ณต์œ  ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋กœ๋“œ (stdcall)

  • ctypes - wintypes : ์œˆ๋„์šฐ ์ „์šฉ ๋ฐ์ดํ„ฐ ํƒ€์ž… ์‚ฌ์šฉ (ex. HWND, WPARAM, or DWORD)

  • ctypes - POINTER : ํฌ์ธํ„ฐ

  • ctypes - Structure : ๊ตฌ์กฐ์ฒด

  • ctypes - Union : ๊ณต์šฉ์ฒด

  • ctypes - addressof : integer ๊ฐ’์œผ๋กœ ์ฃผ์†Œ ๊ฐ’์„ ๋ฐ˜ํ™˜

  • ctypes - byref :

  • ctypes - cast :

  • ctypes - create_unicode_buffer :

  • ctypes - create_string_buffer :

  • ctypes - c_bool : _Bool / bool(1) (C Type / Python Type)

  • ctypes - c_char : char /

  • ctypes - c_ubyte : unsigned char /

  • ctypes - c_byte : char /

  • ctypes - c_short : short / int

  • ctypes - c_int : int / int

  • ctypes - c_uint16 : unsigned short / int

  • ctypes - c_uint32 : unsigned long /

  • ctypes - c_uint64 :

  • ctypes - c_long : long /

  • ctypes - c_longlong : __int64 or long long /

  • ctypes - c_ulong : unsigned long /

  • ctypes - c_ulonglong : unsigned long long / int

  • ctypes - c_ushort : unsigned short / int

  • ctypes - c_void_p : void * /

  • ctypes - c_char_p : char * /

  • ctypes - c_wchar_p : wchar_t * /

  • ctypes - c_size_t : size_t

  • ctypes - sizeof : ๋ฉ”๋ชจ๋ฆฌ ๋ฒ„ํผ์˜ ํฌ๊ธฐ๋ฅผ ๋ฐ”์ดํŠธ ํฌ๊ธฐ๋กœ ๋ฐ˜ํ™˜0

  • ctypes - c_ARRAY(ARRAY as c_ARRAY) : ๋ฐฐ์—ด

  • ctypes - WinError : ์œˆ๋„์šฐ ์—๋Ÿฌ ์ฒ˜๋ฆฌ

  • struct : ํŒŒ์ด์ฌ ๋ฌธ์ž์—ด์„ C ๊ตฌ์กฐ์ฒด๋กœ์˜ ๋ณ€ํ™˜์„ ์ œ๊ณต

  • time : ์‹œ๊ฐ„ ๋ชจ๋“ˆ

  • inspect : ๋Ÿฐํƒ€์ž„ Objectdml ์ •๋ณด๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ๊ฒŒ ๋„์™€์ฃผ๋Š” ๋ชจ๋“ˆ(Modules, classes, methods, functions..)

  • logging : ๋กœ๊ทธ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ ๋ชจ๋“ˆ

  • os : ์šด์˜์ฒด์ œ์—์„œ ์ œ๊ณตํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” ๋ชจ๋“ˆ

  • threading : ์Šค๋ ˆ๋“œ ํ”„๋กœ๊ทธ๋ž˜๋ฐ ๋ชจ๋“ˆ

  • binascii : ๋ฐ”์ด๋„ˆ๋ฆฌ ๋ฐ์ดํ„ฐ์™€ ASCII ๋ฐ์ดํ„ฐ์˜ ์ƒํ˜ธ๋ณ€ํ™˜์„ ์ œ๊ณตํ•˜๋Š” ๋ชจ๋“ˆ

  • re : ์ •๊ทœํ‘œํ˜„์‹ ๋ชจ๋“ˆ

###์„ธ๋ถ€ ๊ตฌ์กฐ

  • engine.common.process

    • def - type_unpack : ์ž๋ฃŒํ˜• ํ™•์ธ ํ›„, ์ž๋ฃŒํ˜• ํ‚ค์›Œ๋“œ์™€ ๋น„ํŠธ ์ˆ˜๋ฅผ ๋ฐ˜ํ™˜
    • class - process :
      • def - PELoad :
      • def - write_byte : VirtualProtectEx์˜ PAGE_EXECUTE_READWRITE ์†์„ฑ์„ ์ด์šฉํ•˜์—ฌ ์ฝ๊ณ  ์“ธ ์ˆ˜ ์žˆ๊ฒŒ ๋ฉ”๋ชจ๋ฆฌ ๋ณดํ˜ธ ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝํ•œ ํ›„ ๋ฉ”๋ชจ๋ฆฌ์— ๋ฌธ์ž์—ด ๊ฐ’์„ ๊ธฐ๋ก. OldProtect ์†์„ฑ์„ ์ด์šฉํ•˜์—ฌ ์›๋ž˜ ์ƒํƒœ๋กœ ๋ณ€๊ฒฝ. ์ฝ์–ด์˜จ ๋ฉ”๋ชจ๋ฆฌ ๊ฐ’ ๋ฐ˜ํ™˜
      • def - write_binary : c_type์˜ create_string_buffer ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์—ฌ ๊ธฐ๋กํ•  ๋ฐ”์ด๋„ˆ๋ฆฌ ๋ฐ์ดํ„ฐ ๋‹ด์€ ํ›„ VirtualProtectEx๋กœ ๋ฉ”๋ชจ๋ฆฌ ์ฃผ์†Œ ์ง€์ • ํ•˜์—ฌ WriteProcessMemory ํ•จ์ˆ˜๋กœ ๋ฐ”์ด๋„ˆ๋ฆฌ ๋ฐ์ดํ„ฐ ๊ธฐ๋ก.
      • def - read_byte : create_string_buffer ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์—ฌ ์ฝ์„ ๊ธธ์ด(๊ธฐ๋ณธ ๊ฐ’ 4) ์ง€์ • ํ›„ while๋ฌธ์„ ์ด์šฉํ•˜์—ฌ ReadProcessMemory ํ•จ์ˆ˜๋กœ ๋ฐ์ดํ„ฐ ์ฝ์Œ.
      • def - read_binary : create_string_buffer ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์—ฌ ์ฝ์„ ๊ธธ์ด(๊ธฐ๋ณธ ๊ฐ’ 4) ์ง€์ • ํ›„ ReadProcessMemory ํ•จ์ˆ˜๋กœ ๋ฐ์ดํ„ฐ ์ฝ์Œ.
      • def - read : ์ฝ์„ ๋ฐ์ดํ„ฐ๊ฐ€ 'string'('s') ์ผ ๊ฒฝ์šฐ ์ฃผ์†Œ๋ฅผ read_byte ํ•จ์ˆ˜๋กœ ์ „๋‹ฌํ•˜๊ณ  read_byte ํ•จ์ˆ˜๋กœ ๋ถ€ํ„ฐ ์ „๋‹ฌ๋ฐ›์€ ๋ฐ์ดํ„ฐ๋ฅผ for๋ฌธ์œผ๋กœ '\x00'๊นŒ์ง€ ์ฝ์–ด ๋ฐ˜ํ™˜. ์ฝ์„ ๋ฐ์ดํ„ฐ๊ฐ€ 'binary' ์ธ ๊ฒฝ์šฐ read_binary ํ•จ์ˆ˜๋กœ ์ฃผ์†Œ๋ฅผ ์ „๋‹ฌํ•˜๊ณ  ๋ฐ˜ํ™˜๋œ ๊ฐ’์„ ์ฒ˜๋ฆฌ ์—†์ด ๋ฐ˜ํ™˜. ์ฝ์„ ๋ฐ์ดํ„ฐ๊ฐ€ 'byte'('b')์ธ ๊ฒฝ์šฐ read_byte ํ•จ์ˆ˜๋กœ ์ฃผ์†Œ ์ „๋‹ฌ ํ›„ ๋ฐ˜ํ™˜๋œ ๊ฐ’์„ ์ฒ˜๋ฆฌ ์—†์ด ๋ฐ˜ํ™˜. ๊ทธ ๋ฐ–์˜ ๊ฒฝ์šฐ type_unpack ํ•จ์ˆ˜๋กœ ์ž๋ฃŒํ˜• ํ‚ค์›Œ๋“œ์™€ ๋น„ํŠธ ์ˆ˜๋ฅผ ๋ฐ˜ํ™˜ ๋ฐ›์€ ํ›„ read_byteํ•จ์ˆ˜๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์–ด ๋ฐ์ดํ„ฐ ์–ธํŒฉ(struct.unpack) ์ˆ˜ํ–‰.
      • def - write : ๊ธฐ๋กํ•  ๋ฐ์ดํ„ฐ๊ฐ€ 'binary' ์ธ ๊ฒฝ์šฐ write_binary ํ•จ์ˆ˜๋กœ ์ฃผ์†Œ ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌ ํ›„ ๋ฐ˜ํ™˜๋œ ๊ฐ’์„ ์ฒ˜๋ฆฌ์—†์ด ๋ฐ˜ํ™˜. ๊ธฐ๋กํ•  ๋ฐ์ดํ„ฐ๊ฐ€ ('binary' ๋ฐ)'bytes' ๊ฐ€ ์•„๋‹Œ ๊ฒฝ์šฐ type_unpack ํ•จ์ˆ˜๋กœ ์ž๋ฃŒํ˜• ํ‚ค์›Œ๋“œ์™€ ๋น„ํŠธ ์ˆ˜๋ฅผ ๋ฐ˜ํ™˜ ๋ฐ›์€ ํ›„ ํŒจํ‚น(struct.pack)ํ•˜์—ฌ write_bytes ํ•จ์ˆ˜ ์ˆ˜ํ–‰ ํ›„ ๋ฐ˜ํ™˜๋œ ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ ์—†์ด ๋ฐ˜ํ™˜. ๊ธฐ๋กํ•  ๋ฐ์ดํ„ฐ๊ฐ€ 'bytes' ์ธ ๊ฒฝ์šฐ write_bytes ํ•จ์ˆ˜์— ์ฃผ์†Œ์™€ ๋ฐ์ดํ„ฐ ์ „๋‹ฌ ํ›„ ๋ฐ˜ํ™˜๋œ ๋ฐ์ดํ„ฐ ์ฒ˜๋ฆฌ ์—†์ด ๋ฐ˜ํ™˜.
      • def - get_symbolic_name :
      • def - getInstruction : read_byte ํ•จ์ˆ˜์— ์ฃผ์†Œ๋ฅผ ์ „๋‹ฌํ•˜์—ฌ ๊ธธ์ด 32 ๋งŒํผ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ˜ํ™˜ ๋ฐ›์€ ํ›„ Distorm3Decoder(Maybee -https://github.com/gdabah/distorm) ํ•จ์ˆ˜๋กœ ๋””์Šค์–ด์…ˆ๋ธ”ํ•˜์—ฌ ๋ฐ˜ํ™˜
  • engine.common.util

    • def - thread : threading.Thread ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์—ฌ ์Šค๋ ˆ๋“œ ์ƒ์„ฑ ๋ฐ ์ž‘์—… ์‹œ์ž‘(Thread.start)ํ›„ Thread ๋ฐ˜ํ™˜
  • engine.common.address

    • def - hex_dump :
    • class - Address :

About

Another process's memory access and modulation on Windows (like Cheat Engine)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages