Jump to content



Photo

[Solved] Using PHP functions inside AutoIt

AutoIt PHP Functions

  • Please log in to reply
4 replies to this topic

#1 evol

evol

    Seeker

  • Active Members
  • 9 posts

Posted 23 April 2012 - 09:47 PM

Hi guys found this on a blog today and i was just wondering how this works as ive tried the example but i cant get it to work for myself ?

Here is the blog entry http://www.sadeghi85.info/articles/using-php-functions-inside-autoit/#more-189

If anyone has any ideas or pointer id appreciate it. ;)

Edited by evol, 27 April 2012 - 08:17 AM.








#2 CaptainClucks

CaptainClucks

    Unum Cavillator Spuria

  • Active Members
  • PipPipPipPipPipPip
  • 1,217 posts

Posted 23 April 2012 - 09:50 PM

I wouldn't bother with that, it's most likely that whatever you're looking to do will be "doable" in pure autoit script.
Spoiler
Warning: Posts by this user are subject to change or may disappear without notice.

#3 evol

evol

    Seeker

  • Active Members
  • 9 posts

Posted 25 April 2012 - 09:54 AM

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.

AutoIt         
#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. ;)

#4 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 930 posts

Posted 25 April 2012 - 01:25 PM

But you can read the code, right?
$files_7z_path = @TempDir & "php4autoit.7z"

Regards,Hannes
Spoiler

#5 evol

evol

    Seeker

  • Active Members
  • 9 posts

Posted 26 April 2012 - 01:25 PM

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. ;)





Also tagged with one or more of these keywords: AutoIt, PHP, Functions

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users