Jump to content

[Solved] Using PHP functions inside AutoIt


evol
 Share

Recommended Posts

True but its the setup their using that im interested in, they say.........

Download latest version of PHP if you haven’t already done so, we only need "php.exe" and "php5.dll"(or "php5ts.dll"). Then create a text file, name it "index.php" and paste the code below into it:

<?php

$input = STDIN;
$command = '';

while(!feof($input))
{
    $command .= fread($input, 8192);
}

eval($command);

exit;
?>

Now pack all these three files to "php4autoit.7z".

Ok ive done that now what ? where does php4autoit.7z go now because they dont tell you and i always get a error on line 17 of there code.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <constants.au3>

$rand =  "\~" & Random(1, 100000, 1)
$_7_zip32_dll_path = @TempDir & "\7-zip32.dll"
$files_7z_path = @TempDir & "\php4autoit.7z"
$extracted_files_path = @TempDir & $rand
DirCreate($extracted_files_path)

FileInstall("7-zip32.dll", $_7_zip32_dll_path)
FileInstall("php4autoit.7z", $files_7z_path)

DllCall($_7_zip32_dll_path, "long", "SevenZip", "HWND", Chr(0), "str", 'x -hide -y "' & $files_7z_path &
'" "' & @TempDir & "\" & '" "' & $extracted_files_path & '\"', "str", "", "long", 0)

$s = "test"
$s = StringToBinary($s, 4)

$php = "$au3_text = '" & StringMid($s, 3) & "'; echo base64_encode(hex2bin($au3_text));"

$foo = Run($extracted_files_path & "\php.exe -f index.php", "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)

StdinWrite($foo, $php)

; Calling with no 2nd arg closes stream
StdinWrite($foo)

; Read from child's STDOUT and show
$data = ''

While True
    $data &= StdoutRead($foo, false, True)
    If @error Then ExitLoop
    Sleep(25)
WEnd

MsgBox(0, 'base64 encoded text', BinaryToString($data))

DirRemove($extracted_files_path, 1)

Exit

Remember im still a noob trying to learn thanks. ;)

Link to comment
Share on other sites

Finally i worked it out its the line.......

DllCall($_7_zip32_dll_path, "long", "SevenZip", "HWND", Chr(0), "str", 'x -hide -y "' & $files_7z_path &
'" "' & @TempDir & "" & '" "' & $extracted_files_path & '"', "str", "", "long", 0)

It should be.....

DllCall($_7_zip32_dll_path, "long", "SevenZip", "HWND", Chr(0), "str", 'x -hide -y "' & $files_7z_path & _
'" "' & @TempDir & "" & '" "' & $extracted_files_path & '"', "str", "", "long", 0)

There was a _ missing. ;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...