Skip to main content

pybind11 extension

Project description

external_proc python module

External process memory manager

Installation

Ensure you have at least Python 3.6+

pip install external_proc
or
pip install git+

Usage examples

More examples in 'tests' directory

Open/Close process

from external_proc import *

p = ExtProcess.open(PROCESS_NAME or PROCESS_ID)
p.close()
### or ###
with ExtProcess.ctx_open(PROCESS_NAME or PROCESS_ID) as p:
  pass

Read/Write values

with ExtProcess.ctx_open(process_name) as p:
  # write
  p.write.list_bytes(address, [0x90, 0x90])
  p.write.bytes(address, b'\x90\x90')
  p.write.str(address, 'string')
  p.write.wstr(address, 'unicode string')
  p.write.uint8(address, 1)
  p.write.uint16(address, 1)
  p.write.uint32(address, 1)
  p.write.uint64(address, 1)
  p.write.int8(address, -1)
  p.write.int16(address, -1)
  p.write.int32(address, -1)
  p.write.int64(address, -1)
  p.write.float(address, 0.01)
  p.write.double(address, 0.01)
  # read
  v = p.read.list_bytes(address, BYTES_COUNT)
  v = p.read.bytes(address, BYTES_COUNT)
  v = p.read.str(address, MAX_BYTES_COUNT) # read string to first \x00
  v = p.read.wstr(address, MAX_BYTES_COUNT) # read string to first \x00
  v = p.read.uint8(address) # signed 1 byte value
  v = p.read.uint16(address) # signed 2 byte value
  v = p.read.uint32(address) # signed 4 byte value
  v = p.read.uint64(address) # signed 8 byte value
  v = p.read.int8(address) # unsigned 1 byte value
  v = p.read.int16(address) # unsigned 2 byte value
  v = p.read.int32(address) # unsigned 4 byte value
  v = p.read.int64(address) # unsigned 8 byte value
  v = p.read.float(address) # 4 byte
  v = p.read.double(address) # 8 byte

Pointers

# Pointer types:
#   ListBytes
#   Bytes
#   Str
#   Wstr
#   Uint8
#   Uint16
#   Uint32
#   Uint64
#   Int8
#   Int16
#   Int32
#   Int64
#   Float
#   Double
#   Invalid
ptr = p.make_ptr(address, PtrType.Int32)
address = ptr.get_address() # return current address
ptr.set_value(333)
value = ptr.get_value()

# get address from multilevel pointers
ptr = p.make_ptr(0x6426E0, core.PtrType.Uint32)\
            .go_ptr(0xC)\
            .go_ptr(0x14)\
            .go_ptr()\
            .go_ptr(0x18)

# PtrTypes: ListBytes, Bytes, Str, Wstr
#   require additional argument
#   for get_value(BYTES_COUNT or MAX_BYTES_COUNT for strings)

Simple dll injector x32/x64

with ExtProcess.ctx_open(process_name) as p:
  dll_path = os.path.abspath('lib.dll')
  loadlib_func = get_proc_address('kernel32', 'LoadLibraryA', x64=p.is_x64_process())
  param = p.alloc()
  p.write.str(param, dll_path)
  with p.ctx_create_thread(loadlib, param, wait_thread=True) as th_id:
      pass

Signature scanner. IDA Style

exe_module = p.get_module()
client_module = p.get_module('client.dll')

# .text:00428873 8D 4D F0          lea ecx, [ebp+var_10]
# .text:00428876 E8 05 4E FE FF    call 0x40D680

# E8 ? ? ? ? - it's instruction call 0x40D680
signature = "8D 4D F0 E8 ? ? ? ?" 

# equal: find_pattern(signature) + 3
sig_in_all_module: Ptr = client_module.find_pattern(signature, add_offset=3)
sig_in_code_section: Ptr = client_module.section('.text').find_pattern(signature, 3)

# for read relative offset from call instruction you can simple do this
adr = sig_in_code_section.go_call_ptr().get_address()
# same for jmp, je and etc inctructions: .go_jmp_ptr(), .go_jmp_short_ptr()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

external_proc-0.0.2-cp39-cp39-win_amd64.whl (111.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

external_proc-0.0.2-cp39-cp39-win32.whl (100.3 kB view details)

Uploaded CPython 3.9 Windows x86

external_proc-0.0.2-cp38-cp38-win_amd64.whl (115.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

external_proc-0.0.2-cp38-cp38-win32.whl (100.3 kB view details)

Uploaded CPython 3.8 Windows x86

external_proc-0.0.2-cp37-cp37m-win_amd64.whl (115.1 kB view details)

Uploaded CPython 3.7m Windows x86-64

external_proc-0.0.2-cp37-cp37m-win32.whl (100.5 kB view details)

Uploaded CPython 3.7m Windows x86

external_proc-0.0.2-cp36-cp36m-win_amd64.whl (152.0 kB view details)

Uploaded CPython 3.6m Windows x86-64

external_proc-0.0.2-cp36-cp36m-win32.whl (128.9 kB view details)

Uploaded CPython 3.6m Windows x86

File details

Details for the file external_proc-0.0.2-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: external_proc-0.0.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 111.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for external_proc-0.0.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fc0c478e1f2354cec6637811b389b2085f87097a7dc7a55e1dc80558b1abfa89
MD5 87081c7033d18735bfca1cdab826edbc
BLAKE2b-256 748dee9460a02cd36516bf5954d3f181520a525dfa2ebca52393e0b5630e3178

See more details on using hashes here.

File details

Details for the file external_proc-0.0.2-cp39-cp39-win32.whl.

File metadata

  • Download URL: external_proc-0.0.2-cp39-cp39-win32.whl
  • Upload date:
  • Size: 100.3 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for external_proc-0.0.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 5e591f37a2ba87932e321815b65522d89a6cebb708643cce3c10be142d10552f
MD5 1dd5cb3fca3a27167107a44a61e52dee
BLAKE2b-256 1bd78b33ee23c49c30e059312deccdfda73ca0d10c61d9d092b8b0f6c6a638f5

See more details on using hashes here.

File details

Details for the file external_proc-0.0.2-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: external_proc-0.0.2-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 115.8 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for external_proc-0.0.2-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 c6c1ab91eaf7e838d15979e4b780612d2fc1ff2a3bfc3cb6d3ac54fa480e0cf3
MD5 0542c295e553bfb248e4e4f6da6f75fa
BLAKE2b-256 92aa2a4732c1a58e175bef1ba239119f474e2b8e3c1c352eed0245548b3a9e45

See more details on using hashes here.

File details

Details for the file external_proc-0.0.2-cp38-cp38-win32.whl.

File metadata

  • Download URL: external_proc-0.0.2-cp38-cp38-win32.whl
  • Upload date:
  • Size: 100.3 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for external_proc-0.0.2-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 9c999736516e186a1a75849d73a13bd82fd8bcc22b18c719a223bca4b4393fa5
MD5 6043df46def6527d867981516a76e282
BLAKE2b-256 58cc16733a73439244be3de521918cdaf56f45793e86b6444641e51105f5acdc

See more details on using hashes here.

File details

Details for the file external_proc-0.0.2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: external_proc-0.0.2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 115.1 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for external_proc-0.0.2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 5bafc2bb3f73d90db4b066fa38f168c6e63ee458a2909318c2717456648e6590
MD5 a9998a5a243a9f8df11059da51af57c0
BLAKE2b-256 23f38747ee429c0b23792ce61dceffd18514e98236b0f04b243be4547b2e477f

See more details on using hashes here.

File details

Details for the file external_proc-0.0.2-cp37-cp37m-win32.whl.

File metadata

  • Download URL: external_proc-0.0.2-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 100.5 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for external_proc-0.0.2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 c4218e381bf691de00225f61ad896a1418333d77fd93a2b7a241011fd7e165df
MD5 51e84b496e2889a49da425f3aee757c8
BLAKE2b-256 28f1aa22dce0f203c406e61fe13066b234625d87d4508c31537f15406f1d8881

See more details on using hashes here.

File details

Details for the file external_proc-0.0.2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: external_proc-0.0.2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 152.0 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for external_proc-0.0.2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 03bce6ba8c55de345ab660b10515cc712cd57f2530ac16bf372802b4d4ed3868
MD5 e66f81799369d81110448c1764109947
BLAKE2b-256 269bc253b5c49e5318da785e80adec614a223443d4174a80be55b2bcd2a380b3

See more details on using hashes here.

File details

Details for the file external_proc-0.0.2-cp36-cp36m-win32.whl.

File metadata

  • Download URL: external_proc-0.0.2-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 128.9 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for external_proc-0.0.2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 0e14cf8fdaecf903cbdd797a9541e3c7df8f49ec039c2bbc30b4210af9548472
MD5 b2368fbd5bd4f7ce463f0a523a2b498e
BLAKE2b-256 979e7b6ae4cbca2a976e91188e60c63ee76680dbc043f613c77721bbcfe69f9b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page