A library for building COFF object files.
Tutorial
Start with the ObjectModule class:
module = ObjectModule()
Now, let’s create a ‘.text’ section:
section = Section(b'.text', SectionFlags.MEM_EXECUTE)
Add a bit of code:
section.data = b'\x29\xC0\xC3' # return 0 section.size_of_raw_data = len(section.data)
Good enough, let’s add it to our module:
module.sections.append(section)
To make use of that bit of code, we are going to need an exported symbol:
main = SymbolRecord(b'main', section_number=1, storage_class=StorageClass.EXTERNAL)
Set the value to the offset in the section:
main.value = 0
And add it to our module:
module.symbols.append(main)
That’s enough, let’s write our module to a file:
with open('test.obj', 'wb') as obj_file:
obj_file.write(module.get_buffer())
Metadata
Release files for cough 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cough-0.2.1.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cough-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / cough-0.2.1.tar.gz
| Download URL | cough-0.2.1.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdbfd1da086b7aa53ee19fe58ba6aa934941741bd9e8126fe9a70231e75fd393
|
|
BLAKE2b-256 checksum How to use checksums |
6275a964a590441a3f5efb716e8df24d471baba210e20b28bf4f3f98efc5eb9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / cough-0.2.1-py3-none-any.whl
| Download URL | cough-0.2.1-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e0c5faf5825c5b41462f548d1b067846c61e2ecb04dbbece2c0fe43eb5378d18
|
|
BLAKE2b-256 checksum How to use checksums |
dfbbaa20e92ac273bb5d1ac60322b730bbb608a2a19f2b971800adde17b884eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |