add: code example, readme stuff
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
# pasm
|
# pasm
|
||||||
PASM is a Scripting language that i made for fun with a few constraints :
|
PASM is a Scripting language that i made for fun with a few constraints :
|
||||||
- the interpreter should be as small as possible and written without the CRT (currently 17ko WITH CRT)
|
- the interpreter should be as small as possible and written without the CRT (currently ~22ko WITH CRT)
|
||||||
- the language should be able to call Windows API's
|
- the language should be able to call Windows API's
|
||||||
|
- the language should be able to execute scripts from a buffer without needing a file
|
||||||
|
- the language should be able to send the output of a script using sockets or stdout
|
||||||
|
|
||||||
PASM is meant for being used in C2 agents as its interpreter is small.<br>
|
PASM is meant for being used in C2 agents as its interpreter is small.<br>
|
||||||
It can be used with an interpreter to execute local files or as a library in another program to execute files or directly code inside buffers, see [Usage](#Usage).<br>
|
It can be used with an interpreter to execute local files or as a library in another program to execute files or directly code inside buffers, see [Usage](#Usage).<br>
|
||||||
@@ -10,7 +12,8 @@ It can be used with an interpreter to execute local files or as a library in ano
|
|||||||
PASM is not a language that you daily use, it is not meant for big projects but rather for scripting using existing API (here the Windows API's but it can get extended).
|
PASM is not a language that you daily use, it is not meant for big projects but rather for scripting using existing API (here the Windows API's but it can get extended).
|
||||||
|
|
||||||
# Current state
|
# Current state
|
||||||
PASM is in a working state, see [code examples](#code-examples).
|
PASM is in a working state (Windows/Linux, 32/64 bit), see [code examples](#code-examples).
|
||||||
|
PASM supports pointers and arrays.
|
||||||
The interpreter works for linux as well, but some API's are Windows only (for now).
|
The interpreter works for linux as well, but some API's are Windows only (for now).
|
||||||
|
|
||||||
TODO :
|
TODO :
|
||||||
@@ -33,6 +36,8 @@ make lib
|
|||||||
Then link the library to your program, see [this example](tests/lib_use.c).<br>
|
Then link the library to your program, see [this example](tests/lib_use.c).<br>
|
||||||
|
|
||||||
# Code examples
|
# Code examples
|
||||||
|
- [hello world and arrays tests](examples/array.pasm)
|
||||||
|
- [xor decryption of hello world](examples/xored_hello.pasm)
|
||||||
- [keylogger](examples/keylogger.pasm)
|
- [keylogger](examples/keylogger.pasm)
|
||||||
- [polynomial calculator](examples/poly.pasm)
|
- [polynomial calculator](examples/poly.pasm)
|
||||||
- [pointers usage example](examples/ptr.pasm)
|
- [pointers usage example](examples/ptr.pasm)
|
||||||
|
|||||||
24
examples/xored_hello.pasm
Normal file
24
examples/xored_hello.pasm
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
; Demonstration of printing a xored string, the same base can be used for decrypting shellcode,
|
||||||
|
; then, an api can be created that will execute the shellcode ig
|
||||||
|
|
||||||
|
; decryption key is at the end of the string because 42 ^ 42 = 0 and we need this null byte
|
||||||
|
; a decent way to not do this is to write only the size of the string if we know it beforehand
|
||||||
|
set hello 66, 79, 70, 70, 69, 6, 10, 93, 69, 88, 70, 78, 10, 11, 42
|
||||||
|
|
||||||
|
main:
|
||||||
|
mov a1, hello
|
||||||
|
|
||||||
|
loop:
|
||||||
|
mov a2, *a1
|
||||||
|
xor a2, 42 ; decryption key
|
||||||
|
mov a2, eax
|
||||||
|
push a2
|
||||||
|
push 1
|
||||||
|
call put
|
||||||
|
|
||||||
|
cmp a2, 0
|
||||||
|
jne 1
|
||||||
|
end
|
||||||
|
|
||||||
|
add a1, 8
|
||||||
|
jmp loop
|
||||||
Reference in New Issue
Block a user