Jump to content

mmfalcao

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by mmfalcao

  1. Thanks for CaptureIt, man I would like to suggest you could implement an customization on the option 'selected area', user can manipulate the coordinates (x,y) for catch the right measures of selected area. Today, I use the function WinMove() for doing this to me.
  2. it's possible Use the WinHTTP.udf for apply method post and send as a parameters the login and password and create a function to save the document. Remember you need check the navigation before that login, test many times, for you check how it works, some pages has changes in the access when you run every time, is that why you can expect timeout or another page, or the login again.
  3. Thanks man, I was trying o solved this, but now I understand the lib and made the post only with the upload stream
  4. I need help uploading an image to base64 and in the end get the token that sent the image... Please, anyone can help with this API?
  5. I changed the way how this gone works, trying connect with TCP using Send and Receive, still using the base64, so i created the header and data content, now I just need to do simple parse from the response o get the token Dim $datasize = StringLen($extra_commands) $command = "POST "&$page&" HTTP/1.1"&@CRLF $command &= "Accept: text/html, application/xhtml+xml, */*" & @CRLF $command &= "Referer:, http://:8080/.php" & @CRLF $command &= "Accept-Language: pt-BR"&@CRLF $command &= "User-Agent: "&$_HTTPUserAgent&@CRLF $command &= "Content-Type: multipart/form-data; boundary=---------------------------7dd2d702806ce"&@CRLF $command &= "Host: " &$host&@CRLF $command &= "Content-Length: "&$datasize&@CRLF $command &= "Connection: keep-alive"&@CRLF $command &= "Cache-Control: no-cache" & @CRLF $command &= ""&@CRLF $command &= "-----------------------------7dd2d702806ce"&@CRLF $command &= "MIME-Version: 1.0" & @CRLF $command &= "Content-Type: image/pjpeg; name=""1.jpg" & @CRLF $command &= "Content-Transfer-Encoding: base64" & @CRLF $command &= "Content-Disposition: form-data; name=file; filename=" & $filename &@CRLF $command &= ""&@CRLF $command &= $data&@CRLF $command &= "-----------------------------7dd2d702806ce"&@CRLF #cs Content-Disposition: form-data; name="submit" Submit -----------------------------7dd2d702806ce-- #ce ;debug info If FileExists("output.txt") Then FileDelete("output.txt") $file = FileOpen("output.txt", 1) FileWrite($file, $command) FileClose($file) ;end debug info Dim $bytessent = TCPSend($socket, $command)
  6. I'm trying use this UDF but it's not working right, when i get the Received.html returns a initial page for make upload
  7. I'm new here and already have a few months I'm working with autoit, I would ask for help. What I need: Transparency of access when I need to upload, send an image to a url and capture a token response that validates that the image was received. Requirement: url expects base64 content The user will not see the image uploading, so it receives the token. As to thinking: Rode with an HTTP POST method to simulate an access that url, I establish in a guy to see if he returns with status HTTP is 200 If so, he takes the token and returns pro user If not, it returns error message Down here has two functions for Post and Base64, it's not working I cut the url from Post methods #include "WinHttp.au3" $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $Error = ObjEvent("AutoIt.Error", "_Error") _POST() Func _POST() ; Method $oHTTP.Open("POST", "/", False) ;Add Accept $oHTTP.SetRequestHeader("Accept:","text/html", "application/xhtml+xml", "*/*") ; Add Referer $oHTTP.SetRequestHeader("Referer:", "") ;Add Accept-Language $oHTTP.SetRequestHeader("Accept-Language:","pt-BR") ;Add User-Agent $oHTTP.SetRequestHeader("User-Agent:", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)") ;Add Content Type $oHTTP.SetRequestHeader("Content-Type:","multipart/form-data") ;Add Host $oHTTP.SetRequestHeader("Host:", "") ;Add Content-Length $oHTTP.SetRequestHeader("Content-Length:" , "") ;Add Connection $oHTTP.SetRequestHeader("Connection:","Keep-Alive") ;Add Cache-Control $oHTTP.SetRequestHeader("Cache-Control:","no-cache" & @CRLF) ;Send $oHTTP.Send("DATATOSEND") ;Body $oReceived = $oHTTP.ResponseText ;Object status $oStatusCode = $oHTTP.Status ;Verifiy Status If $oStatusCode = 200 then SelectAll_and_Copy( 250, 300 ) ;SaveText( 250, 300, $output_file2 ) MsgBox(4096, "Response code", $oStatusCode) EndIf If $oStatusCode Not 200 Then Return 0 ConsoleWriteError ("Couldn't receive HTTP 200") EndIf ; Salva Resposta do Body, independente do codigo de Resposta ;O valor de 2 sobrescreve o arquivo se ele já existe $file = FileOpen("Received.html", 2) FileWrite($file, $oReceived) FileClose($file) EndFunc Func _Base64Encode($buf) Local $c = 0, $i = 1, $j = 0, $l = BinaryLen($buf), $m = Mod($l, 3) Local $dest = "" While $i <= $l - $m $c = BitOR(BitShift(BinaryMid($buf, $i, 1), -16), BitShift(BinaryMid($buf, $i + 1, 1), -8), BinaryMid($buf, $i + 2, 1)) $dest &= Chr($_BASE64_TABLE[BitShift(BitAND($c, 16515072), 18)]) $dest &= Chr($_BASE64_TABLE[BitShift(BitAND($c, 258048), 12)]) $dest &= Chr($_BASE64_TABLE[BitShift(BitAND($c, 4032), 6)]) $dest &= Chr($_BASE64_TABLE[BitAND($c, 63)]) $i += 3 $j += 4 WEnd If 1 = $m Then $dest &= Chr($_BASE64_TABLE[BitShift(BitAND(BinaryMid($buf, $i, 1), 252), 2)]) $dest &= Chr($_BASE64_TABLE[BitShift(BitAND(BinaryMid($buf, $i, 1), 3), -4)]) $dest &= Chr($_BASE64_TABLE[64]) $dest &= Chr($_BASE64_TABLE[64]) ElseIf 2 = $m Then $c = BitOR(BitShift(BinaryMid($buf, $i, 1), -8), BinaryMid($buf, $i + 1, 1)) $dest &= Chr($_BASE64_TABLE[BitShift(BitAND($c, 64512), 10)]) $dest &= Chr($_BASE64_TABLE[BitShift(BitAND($c, 1008), 4)]) $dest &= Chr($_BASE64_TABLE[BitShift(BitAND($c, 15), -2)]) $dest &= Chr($_BASE64_TABLE[64]) EndIf Return $dest EndFunc
×
×
  • Create New...