j'e n'arrive pas à convertir la commande cURL suivante (je le décompose ligne par ligne pour plus de lisibilité) :
Cette commande permet de flasher un firmware sur un routeur sans passer par l'interface web.curl -X POST http://192.168.1.1/modals/gateway-modal ... =upgradefw
-H "Cache-Control: no-cache"
-H "Content-Type: application/x-www-form-urlencoded"
-H "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW"
-F CSRFtoken=c67db7685f4661296149cf4081716849e956b269cee53b5d7985771195a59cd8
-F "upgradefile=@C:\AGTHP\AGTHP_1.0.3_CLOSED.rbi"
-b "sessionID=247c69c5f0771d4facd122a71498766cab1f19ccdf12cdb2c51a196899c42417"
La ou j'ai un probleme c'est sur le paramettre -F de cURL:
Code : Tout sélectionner
-F, --form CONTENT Specify HTTP multipart POST data (H)
--form-string STRING Specify HTTP multipart POST data (H)
--ftp-account DATA Account data string (F)
--ftp-alternative-to-user COMMAND String to replace "USER [name]" (F)
--ftp-create-dirs Create the remote dirs if not present (F)
--ftp-method [MULTICWD/NOCWD/SINGLECWD] Control CWD usage (F)
--ftp-pasv Use PASV/EPSV instead of PORT (F)
Code : Tout sélectionner
#include <WindowsConstants.au3>
Global $cookie, $ipdga4130, $CSRFtoken
$ipdga4130 = "192.168.1.1"
$CSRFtoken = "c67db7685f4661296149cf4081716849e956b269cee53b5d7985771195a59cd8"
$cookie = "sessionID=247c69c5f0771d4facd122a71498766cab1f19ccdf12cdb2c51a196899c42417"
$upgradefile = Fileread(@SCRIPTDIR & "\AGTHP_1.0.3_CLOSED.rbi")
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://" & $ipdga4130 & "/modals/gateway-modal.lp?action=upgradefw", False)
$oHTTP.SetRequestHeader("Cache-Control", 'no-cache')
$oHTTP.SetRequestHeader("Content-type ", "application/x-www-form-urlencoded")
$oHTTP.SetRequestHeader("Content-type ", "multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW")
$oHTTP.SetRequestHeader("Cookie", $Cookie)
$oHTTP.Send()
$oReceived = $oHTTP.ResponseText
msgbox (0,"",$oReceived)