Jump to content

Run command and string


Hasher
 Share

Recommended Posts

Quote

            $encoded = StringStripCR(_Base64Encode($Base64encode))
            $encoded = StringStripWS($encoded,8)
            $data = "https://www.test.com/get.php?order=" & $encoded & " -o C:\Users\USER\Desktop\Data\" & $c & ".txt"
            run(@ComSpec & ' /C ' &  "C:\Users\User\Desktop\Ripper\Curl\bin\curl.exe -L -I " & $data)

Hi All ,

 

Running a command window for Curl. When I pass it as a hardcorded string it works . Example"https://www.test.com/get.php?order=BuhbBUgug== -o C:\Users\USER\Desktop\Data\" & $c & ".txt

But when I use the Base64 variable it fails . Example https://www.test.com/get.php?order=" & $encoded & " -o C:\Users\USER\Desktop\Data\" & $c & ".txt"

 

Tried Stripping White spaces and Carriage returns .

Any suggestions ?

 

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Link to comment
Share on other sites

Quote

Func _Base64Encode($input)
 $input = Binary($input)

    Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]")

    DllStructSetData($struct, 1, $input)

    Local $strc = DllStructCreate("int")

    Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _
            "ptr", DllStructGetPtr($struct), _
            "int", DllStructGetSize($struct), _
            "int", 1, _
            "ptr", 0, _
            "ptr", DllStructGetPtr($strc))

    If @error Or Not $a_Call[0] Then
        Return SetError(1, 0, "") ; error calculating the length of the buffer needed
    EndIf

    Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]")

    $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _
            "ptr", DllStructGetPtr($struct), _
            "int", DllStructGetSize($struct), _
            "int", 1, _
            "ptr", DllStructGetPtr($a), _
            "ptr", DllStructGetPtr($strc))

    If @error Or Not $a_Call[0] Then
        Return SetError(2, 0, ""); error encoding
    EndIf

    Return DllStructGetData($a, 1)

EndFunc   ;==>_Base64Encode


Func _Base64Decode($input_string)

    Local $struct = DllStructCreate("int")

    $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
            "str", $input_string, _
            "int", 0, _
            "int", 1, _
            "ptr", 0, _
            "ptr", DllStructGetPtr($struct, 1), _
            "ptr", 0, _
            "ptr", 0)

    If @error Or Not $a_Call[0] Then
        Return SetError(1, 0, "") ; error calculating the length of the buffer needed
    EndIf

    Local $a = DllStructCreate("byte[" & DllStructGetData($struct, 1) & "]")

    $a_Call = DllCall("Crypt32.dll", "int", "CryptStringToBinary", _
            "str", $input_string, _
            "int", 0, _
            "int", 1, _
            "ptr", DllStructGetPtr($a), _
            "ptr", DllStructGetPtr($struct, 1), _
            "ptr", 0, _
            "ptr", 0)

    If @error Or Not $a_Call[0] Then
        Return SetError(2, 0, ""); error decoding
    EndIf

    Return DllStructGetData($a, 1)

EndFunc   ;==>_Base64Decode

 

Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...