hasherezade / masm_shc

A helper utility for creating shellcodes. Cleans MASM file generated by MSVC, gives refactoring hints.
MIT License
156 stars 30 forks source link

Basic c++ code improvements #5

Closed Frago9876543210 closed 2 years ago

Frago9876543210 commented 2 years ago
Frago9876543210 commented 2 years ago

do we need IAT at all with decltype and casts?

Frago9876543210 commented 2 years ago

it works!

cl /c /GS- /FA knock.cpp
masm_shc.exe knock.asm knock_cleaned_file.asm
ml64 knock_cleaned_file.asm /link /entry:main /section:.text,ERW

.\knock_cleaned_file.exe

py .\knock_test.py --port 1337 --buf="9"
[+] Connecting to port: 1337
[+] Response: b'Y\x00\x00\x00'

py .\knock_test.py --port 1338 --buf="3"
[+] Connecting to port: 1338
[+] Response: b'E\x00\x00\x00'

py .\knock_test.py --port 1339 --buf="5"
[+] Connecting to port: 1339
[+] Response: b'S\x00\x00\x00'
Frago9876543210 commented 2 years ago

would be nice to update paper

hasherezade commented 2 years ago

Thank you for your work! Upgrading to Python 3 was surely needed, knock_test.py was my old script from some other project, and I forgot to change it. I have some mixed feelings about using decltype(&funcname). Sure it is good for production code, but it is a demo, and I wanted to show how everything works very explicitly, rather than hiding some logic behind autopointers, etc. But let it be, I will just update the paper, and show both examples.