Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/29/2014 in all areas

  1. I have wrote a lot of binary code library for AutoIt before. I also discover many ways to generate binary code for AutoIt in the past. However, all of them have limitation or need some extra effort. Recently, I think I found the best and easiest way to generate the binary code. So I wrote this UDF, may be my last one about binary code. The Features:Both AutoIt x86 and x64 version are supported.Windows API and static variables can be use (code relocation supported).Decompression at run-time with smallest footprint LZMA decoder.Allocated memory blocks are released automatically.Most C source code works without modification.Two step or one step script generation, very easy to use.How It Works: The C source code must be compiled by MinGW GCC with "-S -masm=intel" option. Output is GAS syntax assembly file.BinaryCall Tool is able to convert the GAS syntax assembly file (*.s) to FASM syntax (*.asm). During the conversion, global symbols will be stored as "Symbol Jump Table" at the head of the file. The output file should be able to be assembled to binary file under command line by FASM.EXE. This syntax conversion is step 1.The step 2 is to assemble the file. BinaryCall Tool will use the embedded FASM to assemble every file twice to generate the relocation table. "BinaryCall.inc" will be included automatically before assembling to detect the Windows API and generate the "API Jump table". All the results will be compressed and converted to AutoIt script output.There are two major functions in the output script. _BinaryCall_Create() function allocates memorys, decompress the binary, relocates the address in memory, and fills the "API Jump Table"._BinaryCall_SymbolList() converts the "Symbol Jump Table" to memory addresses, and then store them as pointers in a DllStruct variable.Finally, we can use DllCallAddress() to call the memory address stored in the DllStruct.Step by Step Tutorial: Write C source code:#include <windows.h> void main() { MessageBox(0, "Hello", "Welcome Message", 1); }Use GCC MinGW 32/64 to compile the source code: gcc -S -masm=intel -m32 MessageBox.cUse BinaryCall Tool "GAS2AU3 Converter", select "MessageBox.s": If Not @AutoItX64 Then Local $Code = '...' Local $Reloc = '...' Local $Symbol[] = ["main"] Local $CodeBase = _BinaryCall_Create($Code, $Reloc) If @Error Then Exit Local $SymbolList = _BinaryCall_SymbolList($CodeBase, $Symbol) If @Error Then Exit EndIfPaste the output script, call the main() in AutoIt: #Include "BinaryCall.au3" ; Paste output here DllCallAddress("none:cdecl", DllStructGetData($SymbolList, "main"))Try to run it! Change Log:v1.0Initial release.v1.1A lot of improvement for GAS2ASM converter and FASM header file.Add many C Run-Time library as inline asm subroutines.Add command-line to argc/argv parser for easy calling main() function.Add ability to redirect stdio.More C source code can work without modification in this version. Following open source projects are tested. And Yes, they can run as binary code library in AutoIt now. SQLite 3.8.5 TCC 0.9.26 PuTTY beta 0.63 v1.2Dynamic-link library (DLL) calling is supported now. If the C program requires a DLL file to run, just put it together with the source file. BinaryCall Tool will searches *.dll and exports all the symbols in these DLL files automatically. Of course, you need these DLL files when run the output script. However, it also works if you loaded them by last version of MemoryDll UDF.To add more Windows API library easily by editing the ini file.Better error handling and more error messages in output script.Add zero padding to avoid short jumps that crash the relocation table.BinaryCall Tool accepts drag and drop files now.Some small bug fixed. BinaryCall 1.0.zip BinaryCall 1.1.zip BinaryCall 1.2.zip
    2 points
  2. (Y) thnx alot for u bro
    1 point
  3. The best way is to search MSDN using google. If you scroll down the first page link below, you will find SC_DRAGMOVE under the heading 'ommitted command'. http://msdn.microsoft.com/en-gb/library/windows/desktop/ms646360%28v=vs.85%29.aspx There is more information here: http://msdn.microsoft.com/en-gb/library/windows/desktop/ms644927%28v=vs.85%29
    1 point
  4. Something like this? #include <WinAPISys.au3> Global $WM_TIMER = 0x0113 Global $hTimerProc Global $iTimerID Global $MsgBox_Title Global $MsgBox_Text Global $MsgBox_X Global $MsgBox_Y Global $MsgBox_W Global $MsgBox_H ; _MessageBox(10, 10, Default, Default, 0, "Test", "This is just a test :)", 0) ;move the MsgBox to 10,10 ; Func _MessageBox($iMsgBox_X, $iMsgBox_Y, $iMsgBox_W, $iMsgBox_H, $iMsgBox_P1, $iMsgBox_P2, $iMsgBox_P3, $iMsgBox_P4 = 0, $iMsgBox_P5 = 0) $hTimerProc = DllCallbackRegister('_MoveMsgBox', 'none', 'hwnd;uint;uint_ptr;dword') $iTimerID = _WinAPI_SetTimer(0, 0, 50, DllCallbackGetPtr($hTimerProc)) $MsgBox_Title = $iMsgBox_P2 $MsgBox_Text = $iMsgBox_P3 $MsgBox_X = $iMsgBox_X $MsgBox_Y = $iMsgBox_Y $MsgBox_W = $iMsgBox_W $MsgBox_H = $iMsgBox_H MsgBox($iMsgBox_P1, $iMsgBox_P2, $iMsgBox_P3, $iMsgBox_P4, $iMsgBox_P5) ; kill timer in case still there. _WinAPI_KillTimer(0, $iTimerID) DllCallbackFree($hTimerProc) EndFunc ;==>_MessageBox ; Func _MoveMsgBox($hWnd, $iMsg, $iTimerID, $iTime) #forceref $hWnd, $iMsg, $iTimerId, $iTime $rc = WinMove($MsgBox_Title, $MsgBox_Text, $MsgBox_X, $MsgBox_Y, $MsgBox_W, $MsgBox_H) ; kill timer in case move was successfull. If $rc Then _WinAPI_KillTimer(0, $iTimerID) DllCallbackFree($hTimerProc) EndIf EndFunc ;==>_MoveMsgBox Jos
    1 point
  5. Good stuff, the lava Lamp was like a squidgy dna helix.
    1 point
  6. Global Const $SC_DRAGMOVE = 0xF012 Declares a binary variant used with the function _SendMessage(). The value 0xF012 is a message which enables you to drag the GUI around with the mouse. ; _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) This line does the actual dragging. The message is sent to windows to perform this action.
    1 point
  7. meomeo192, The page Jos suggested is this one - the #pragma compile directive is the one you want. M23
    1 point
  8. Use the correct #pragma statement. The helpfile is your friend. Jos
    1 point
  9. You're welcome regardless of whether you undestand yourself or not
    1 point
  10. Why use IE ? You have just to extract links from source and find the one you want (temporary or not) #include <Array.au3> $sSrc = BinaryToString ( InetRead ( 'http://www.bleepingcomputer.com/download/combofix/' ) ) $aLinks = StringRegExp ( $sSrc, '(?s)(?i)<a href="(.*?)"', 3 ) $iIndex = _ArraySearch ( $aLinks, 'download/combofix', 0, 0, 0, 1 ) ConsoleWrite ( '+ Link Download Page : ' & $aLinks[$iIndex] & @Crlf ) $sSrc = StringReplace ( BinaryToString ( InetRead ( $aLinks[$iIndex] ) ), "'", '"' ) $aLink = StringRegExp ( $sSrc, '(?s)(?i)<a href="(.*?)"', 3 ) $iIndex = _ArraySearch ( $aLink, 'ComboFix.exe', 0, 0, 0, 1 ) ConsoleWrite ( '! Link Download ComboFix.exe : ' & $aLink[$iIndex] & @Crlf )
    1 point
  11. Valuater

    Autoit Wrappers

    ; check file date to current date ; Author - Jdeb #include<date.au3> $n_tFile = "your file name" $n_Fdate = FileGetTime($n_tFile,1) $sdate=$n_Fdate[0] & "/" & $n_Fdate[1] & "/" & $n_Fdate[2] & " " & $n_Fdate[3] & ":" & $n_Fdate[4] & ":" & $n_Fdate[5] $edate=_NowCalc() If _DateDiff ('d',$sdate,$eDate) > 5 then ; EndIf 8)
    1 point
×
×
  • Create New...