Search code examples
assemblyautoit

AutoIt assembly code to print a message


I'm making a program to show hello world using AutoIt. The assembly code was used in examples for other languages but not AutoIt. The code is:

char code[] =
"\xb8\x04\x00\x00\x00"
"\xbb\x01\x00\x00\x00"
"\xb9\x00\x00\x00\x00"
"\xba\x0f\x00\x00\x00"
"\xcd\x80\xb8\x01\x00"
"\x00\x00\xbb\x00\x00"
"\x00\x00\xcd\x80";

I will try using AutoIt so:

$pt = DLLStructCreate("byte[" & BinaryLen($YourShellcode) & "]")

DllStructSetData($pt, 1, $YourShellcode)

$y=DllStructGetPtr($pt)

_WinAPI_CallWindowProc($y, 0, 0, 0, 0)

But I am not sure how to include this assembly code to print hello world. How to do it? Only a small example of hello world using asm and AutoIt.


Solution

  • You tried to do this?

    #include <WinAPI.au3>
    Global $YourShellcode = "0xb804000000bb01000000b900000000ba0f000000cd80b801000000bb00000000cd80"
    
    $pt = DLLStructCreate("byte[" & BinaryLen($YourShellcode) & "]")
    
    DllStructSetData($pt, 1, $YourShellcode)
    
    $y=DllStructGetPtr($pt)
    
    _WinAPI_CallWindowProc($y, 0, 0, 0, 0)