Source WinToAu3.au3

Dieses Thema im Forum "Releases & Sources" wurde erstellt von Ingolf, 31. Juli 2017.

  1. Ingolf

    Ingolf New Member Ehrenmitglied

    Registriert seit:
    2. Juli 2017
    Beiträge:
    25
    Zustimmungen:
    13
    Punkte für Erfolge:
    3
    Geschlecht:
    männlich
    Ort:
    Hamburg
    Hier einmal ein nützliches Tool um Pakete die mit hilfe von LiveHttpHeader (dem Addon für Firefox) mitgeschnitten wurden zu filtern und gleichzeitig ein script erstellt das sich an der winhttp.au3 orientiert

    Script ist von suesKaninchen

    Code (AutoIt):

    #include 'winhttp.au3'
    #include <String.au3>
    #include <Array.au3>

    $zDebug = "-ja"
    $hFile = ''
    $winhttpCode = ""
    $aHost = ""
    $zMultypart = "False"
    $zHoastFiltrt = 'no'
    $hHoastFilters = ""
    Dim $ahFilter[20]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1_1 = GUICreate("Form1", 271, 341, 192, 124)
    $Button1 = GUICtrlCreateButton("Datei wählen", 8, 8, 75, 25)
    $Label1 = GUICtrlCreateLabel("Pfad:", 8, 48, 236, 17)
    $Button3 = GUICtrlCreateButton("Erstellen", 192, 8, 75, 25)
    $Label2 = GUICtrlCreateLabel("Filter:", 8, 72, 50, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $ahFilter[0] = GUICtrlCreateCheckbox(".png", 8, 104, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[1] = GUICtrlCreateCheckbox(".jpg", 8, 128, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[2] = GUICtrlCreateCheckbox(".css", 8, 152, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[3] = GUICtrlCreateCheckbox(".js", 8, 176, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[4] = GUICtrlCreateCheckbox(".xml", 8, 200, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[5] = GUICtrlCreateCheckbox(".gif", 144, 104, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[6] = GUICtrlCreateCheckbox(".swf", 144, 128, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[7] = GUICtrlCreateCheckbox(".ico", 144, 152, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[8] = GUICtrlCreateCheckbox("safebrowsing.", 144, 176, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[9] = GUICtrlCreateCheckbox("mozilla.com", 144, 200, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[10] = GUICtrlCreateCheckbox("ocsp.", 8, 224, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[11] = GUICtrlCreateCheckbox("symcd.com", 144, 224, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[12] = GUICtrlCreateCheckbox(".svg", 8, 248, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[13] = GUICtrlCreateCheckbox(".jpeg", 144, 248, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[14] = GUICtrlCreateCheckbox("twitter.com", 8, 272, 120, 17);+14
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[15] = GUICtrlCreateCheckbox("facebook.", 144, 272, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[16] = GUICtrlCreateCheckbox("google-analytics.com", 8, 296, 120, 17);+14
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[17] = GUICtrlCreateCheckbox("clients1.google.com", 144, 296, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[18] = GUICtrlCreateCheckbox("googleapis.com", 8, 320, 120, 17);+14
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[19] = GUICtrlCreateCheckbox("scorecardresearch.com", 144, 320, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $hHoasBotton = GUICtrlCreateButton("Hoast auswählen", 144, 72, 120, 17)
    ;~ GUICtrlSetState(-1, $GUI_CHECKED)
    $Input1 = GUICtrlCreateInput("NAME", 88, 8, 97, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ####include <ButtonConstants.au3>

    While 1
       $nMsg = GUIGetMsg($Form1_1)
       Switch $nMsg
           Case $GUI_EVENT_CLOSE
               Exit
           Case $Button1
               $hFile = FileOpenDialog("Ordner Wählen", @ScriptDir, "All (*.*)")
               $FileName = $hFile
               If StringLen($hFile) > 39 Then $FileName = StringTrimRight($hFile, StringLen($hFile) - 15) & '[' & StringLen($hFile) - 40 & ']' & StringTrimLeft($hFile, StringLen($hFile) - 25)
               GUICtrlSetData($Label1, $FileName)
               $aFilename = StringSplit($hFile, "\")
               If GUICtrlRead($Input1) = "NAME" Then GUICtrlSetData($Input1, $aFilename[UBound($aFilename) - 1])
           Case $Button3
               _FileErstellen($hFile)
           Case $hHoasBotton
               _addHoastToBlacklist($hFile)
       EndSwitch
    WEnd

    Func _CreateHead($File)
       $aUserAgent = StringRegExp($File, 'User-Agent: (.+?)' & @CRLF, 3)
       $aHost = StringRegExp($File, 'Host: (.+?)' & @CRLF, 3);Host lesen
       $aHost = _ArrayUnique($aHost)
       $sHost = 'Dim $aHosts[#ANZAHL#][2]' & @CRLF & _
               ';Host Array' & @CRLF
       If $zHoastFiltrt = "Ja" Then
           $aFilters = $hHoastFilters
       Else
           $aFilters = $ahFilter
       EndIf

       For $i = 0 To UBound($aHost) - 2
           If _Filter($aHost[$i + 1], $aFilters) <> "Weiter" Then
               _ArrayDelete($aHost, $i + 1)
               $i -= 1
           Else
               $sHost &= '$aHosts[' & $i & '][0] = "' & $aHost[$i + 1] & '"' & @CRLF & _
                       '$aHosts[' & $i & '][1] = _WinHttpConnect($hSession, $aHosts[' & $i & '][0])' & @CRLF
           EndIf
           If UBound($aHost) - 2 = $i Then ExitLoop
       Next
       $sHost = StringRegExpReplace($sHost, '#ANZAHL#', UBound($aHost) - 1)
       $winhttpCode = "#include <winhttp.au3>" & @CRLF & _
               "#include <Array.au3>" & @CRLF & _
               '$zWrite = 1' & @CRLF & _
               '$hSession = _WinHttpOpen("' & $aUserAgent[0] & '")' & @CRLF & _
               '#NoTrayIcon' & @CRLF & @CRLF & $sHost & @CRLF & _
               ';Pakete' & @CRLF
    EndFunc   ;==>_CreateHead

    Func _CreatePostGet($sPacket, $Bundaray = "False")
       If $zDebug = "ja" Then MsgBox(0, "", $sPacket)
       $aLink = StringRegExp($sPacket, '(GET) (.+?) HTTP/1.1|(POST) (.+?) HTTP/1.1', 3)
       If @error Then Return "False"
       ;link Filter
    ;~    If (StringInStr($aLink[UBound($aLink) - 1], '.png') = _Checked($Checkbox1)) Or (StringInStr($aLink[UBound($aLink) - 1], '.jpg') = _Checked($Checkbox2)) Or (StringInStr($aLink[UBound($aLink) - 1], '.css') = _Checked($Checkbox3)) Or (StringInStr($aLink[UBound($aLink) - 1], '.js') = _Checked($Checkbox4)) Or (StringInStr($aLink[UBound($aLink) - 1], '.xml') = _Checked($Checkbox5)) Or (StringInStr($aLink[UBound($aLink) - 1], '.gif') = _Checked($Checkbox6)) Or (StringInStr($aLink[UBound($aLink) - 1], '.swf') = _Checked($Checkbox7)) Or (StringInStr($aLink[UBound($aLink) - 1], '.ico') = _Checked($Checkbox8)) Then;Bilder und Java scripts ecetera überspringen
    ;~        Return "False"
       If _Filter($aLink[UBound($aLink) - 1]) <> "Weiter" Then
           Return "False"
       Else
           $aHostPaket = StringRegExp($sPacket, 'Host: (.+?)' & @CRLF, 3)
           If $zHoastFiltrt = "Ja" Then
               $aFilters = $hHoastFilters
           Else
               $aFilters = $ahFilter
           EndIf
           If _Filter($aHostPaket[0], $aFilters) <> "Weiter" Then Return "False"
    ;~        If (StringInStr($aHostPaket[0], 'safebrowsing.') = _Checked($Checkbox9)) Or (StringInStr($aHostPaket[0], 'mozilla.com') = _Checked($Checkbox10)) Or (StringInStr($aHostPaket[0], 'ocsp.') = _Checked($Checkbox11)) Then Return "False"
           $sHostPaket = _ArraySearch($aHost, $aHostPaket[0]) - 1
           $aAddedHeader = StringSplit($sPacket, @CRLF, 1)
           If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader)
    ;~        MsgBox(0,"","")
           $sPostData = 'Default'
           $zENDE = 1
           For $i = 0 To UBound($aAddedHeader) - 1
               If UBound($aAddedHeader) = $i Then ExitLoop
    ;~            If StringInStr($aAddedHeader[$i], 'Cache-Control: no-cache') Then
    ;~                If StringInStr($aAddedHeader[$i + 1], '"') Then
    ;~                    $sPostData = "'" & $aAddedHeader[$i + 1] & "'"
    ;~                Else
    ;~                    $sPostData = '"' & $aAddedHeader[$i + 1] & '"'
    ;~                EndIf
    ;~            EndIf
               If $zENDE = 1 Then
                   If StringRegExp($aAddedHeader[$i], '(GET) (.+?) HTTP/1.1|(POST) (.+?) HTTP/1.1') Then $zENDE = 0
                   _ArrayDelete($aAddedHeader, $i)
                   $i -= 1
                   ContinueLoop
               EndIf
               If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader)
               If $aAddedHeader[$i] = "" Or StringInStr($aAddedHeader[$i], 'Connection: keep-alive') Or StringInStr($aAddedHeader[$i], 'Pragma:') Or StringInStr($aAddedHeader[$i], 'Accept-Encoding:') Or StringInStr($aAddedHeader[$i], 'Host:') Or StringInStr($aAddedHeader[$i], 'boundary=----') Or StringInStr($aAddedHeader[$i], 'Accept-Language:') Or StringInStr($aAddedHeader[$i], 'Accept:') Or StringInStr($aAddedHeader[$i], 'Cookie:') Or StringInStr($aAddedHeader[$i], 'User-Agent:') Or StringInStr($aAddedHeader[$i], 'Referer:') Or StringInStr($aAddedHeader[$i], 'Content-Length:') Or StringInStr($aAddedHeader[$i], 'Content-Type:') Then
                   _ArrayDelete($aAddedHeader, $i)
                   $i -= 1
                   ContinueLoop
               EndIf
               If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader)
               If StringRegExp($aAddedHeader[$i], '^HTTP/') Or StringInStr($aAddedHeader[$i], 'Cache-Control: no-cache') Or StringInStr($aAddedHeader[$i], 'Date:') Or StringInStr($aAddedHeader[$i], 'Server:') Then
    ;~                If $aLink[UBound($aLink) - 2] = "POST" Then
    ;~                    If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader, "entfernen")
    ;~                    _ArrayDelete($aAddedHeader, $i-1)
    ;~                    $i -= 1
    ;~                EndIf
                   _ArrayDelete($aAddedHeader, $i)
                   If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader, "entfernen2")
                   $i -= 1
                   $zENDE = 1
                   ContinueLoop
               EndIf
               If Not StringInStr($aAddedHeader[$i], ':') Then
                   _ArrayDelete($aAddedHeader, $i)
                   $i -= 1
                   ContinueLoop
               EndIf
               If $zDebug = "ja" Then ConsoleWrite($aAddedHeader[$i] & @CRLF)
           Next
           If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader, "Ende")
    ;~        _ArrayDisplay($aAddedHeader, "Ende")
           $sAddGeader = ""
           For $iHeaderString = 0 To UBound($aAddedHeader) - 1
               $sAddGeader &= "'" & $aAddedHeader[$iHeaderString] & "' & " & '@CRLF & '
           Next
    ;~        MsgBox(0, "", $sAddGeader)
           $sAddGeader = StringTrimRight($sAddGeader, 11)
           If $sAddGeader = "" Then $sAddGeader = "Default"
    ;~        MsgBox(0, "", $sAddGeader)
           $aReferrer = StringRegExp($sPacket, 'Referer: (.+?)' & @CRLF, 3)
           If @error = 1 Then
               Dim $aReferrer[1]
               $aReferrer[0] = "Default"
           EndIf
           $aPostData = StringRegExp($sPacket, '(.+)\s+HTTP/\d+\.\d+', 3)
           If $zDebug = "ja" Then _ArrayDisplay($aPostData)
       EndIf
       If UBound($aPostData) <> 1 And StringInStr($sPacket, 'POST /', 1) Then
           If StringInStr($aPostData[1], '"') Then
               $sPostData = "'" & $aPostData[1] & "'"
           Else
               $sPostData = '"' & $aPostData[1] & '"'
           EndIf
       Else
           $sPostData = 'Default'
       EndIf
       If $zDebug = "ja" Then MsgBox(0, "POST", $sPostData)
       If StringInStr(StringTrimRight($sPacket, StringLen($sPacket) - 6), "https") Then
           If $Bundaray = "True" Then
               $winhttpCode = $winhttpCode & '$sHTML = _WinHttpSimpleSSLRequest( $aHosts[' & $sHostPaket & '][1]' & ', "' & $aLink[UBound($aLink) - 2] & '", "' & $aLink[UBound($aLink) - 1] & '", "' & $aReferrer[0] & '", $aMultiPart[1], ' & $sAddGeader & ' & @CRLF & "Content-Type: multipart/form-data; boundary=" & $aMultiPart[0])' & @CRLF & _
                       '_FileWrite($sHTML, "", $zWrite)' & @CRLF
           Else
               $winhttpCode = $winhttpCode & '$sHTML = _WinHttpSimpleSSLRequest( $aHosts[' & $sHostPaket & '][1]' & ', "' & $aLink[UBound($aLink) - 2] & '", "' & $aLink[UBound($aLink) - 1] & '", "' & $aReferrer[0] & '", ' & $sPostData & ', ' & $sAddGeader & ')' & @CRLF & _
                       '_FileWrite($sHTML, "", $zWrite)' & @CRLF
           EndIf
       Else
           If $Bundaray = "True" Then
               $winhttpCode = $winhttpCode & '$sHTML = _WinHttpSimpleRequest( $aHosts[' & $sHostPaket & '][1]' & ', "' & $aLink[UBound($aLink) - 2] & '", "' & $aLink[UBound($aLink) - 1] & '", "' & $aReferrer[0] & '"' & ", $aMultiPart[1], " & $sAddGeader & ' & @CRLF & "Content-Type: multipart/form-data; boundary=" & $aMultiPart[0])' & @CRLF & _
                       '_FileWrite($sHTML, "", $zWrite)' & @CRLF
           Else
               $winhttpCode = $winhttpCode & '$sHTML = _WinHttpSimpleRequest( $aHosts[' & $sHostPaket & '][1]' & ', "' & $aLink[UBound($aLink) - 2] & '", "' & $aLink[UBound($aLink) - 1] & '", "' & $aReferrer[0] & '", ' & $sPostData & ', ' & $sAddGeader & ')' & @CRLF & _
                       '_FileWrite($sHTML, "", $zWrite)' & @CRLF
           EndIf
       EndIf
       $winhttpCode = StringReplace($winhttpCode, ',  & @CRLF & ', ', ')
       Return "True" ;Zählen der Geholten Packete
    EndFunc   ;==>_CreatePostGet

    Func _Filter($sString, $ahFilterX = $ahFilter)
       For $i = 0 To UBound($ahFilterX) - 1
    ;~        MsgBox(0,"", GUICtrlRead($ahFilter[$i], 1))
           If _Checked($ahFilterX[$i]) Then
               If StringInStr($sString, GUICtrlRead($ahFilterX[$i], 1)) Then Return "False"
           EndIf
       Next
       Return "Weiter"
    EndFunc   ;==>_Filter

    Func _addHoastToBlacklist($hFile)
       $zHoastFiltrt = "Ja"
       $File = FileRead($hFile)
       $aHost = StringRegExp($File, 'Host: (.+?)' & @CRLF, 3);Host lesen
       $aHost = _ArrayUnique($aHost)
       $GUI2 = GUICreate("Hoast´s", 490, 30 + (UBound($aHost) / 3) * 24, -1, 10)
       GUICtrlCreateLabel("Wähle alle hoasts aus die NICHT bearbeiten werden sollen.", 5, 5)
       $iOfsetX = 0
       $iOfsetY = 0
       Dim $hHoastFilters[UBound($aHost)]
       For $i = 1 To UBound($aHost) - 1
           $hHoastFilters[$i] = GUICtrlCreateCheckbox($aHost[$i], 10 + $iOfsetX, 30 + $iOfsetY, 120, 17)
           GUICtrlSetState(-1, $GUI_CHECKED)
           If $iOfsetX <> 360 Then
               $iOfsetX += 120
           Else
               $iOfsetY += 24
               $iOfsetX = 0
           EndIf
       Next
       GUISetState(@SW_SHOW, $GUI2)
       While 1
           $nMsg = GUIGetMsg($GUI2)
           Switch $nMsg
               Case $GUI_EVENT_CLOSE
                   ExitLoop
           EndSwitch
       WEnd
       GUISetState(@SW_HIDE, $GUI2)
    EndFunc   ;==>_addHoastToBlacklist


    Func _CreateEnd()
       If $zMultypart = "True" Then
           $winhttpCode &= @CRLF & @CRLF & _
                   'Func __MIMEAssocString();Aus der WinHTTP.au3 :)' & @CRLF & _
                   'Return ";ai|application/postscript;aif|audio/x-aiff;aifc|audio/x-aiff;aiff|audio/x-aiff;asc|text/plain;atom|application/atom+xml;au|audio/basic;avi|video/x-msvideo;bcpio|application/x-bcpio;bin|application/octet-stream;bmp|image/bmp;cdf|application/x-netcdf;cgm|image/cgm;class|application/octet-stream;cpio|application/x-cpio;cpt|application/mac-compactpro;csh|application/x-csh;css|text/css;dcr|application/x-director;dif|video/x-dv;dir|application/x-director;djv|image/vnd.djvu;djvu|image/vnd.djvu;dll|application/octet-stream;dmg|application/octet-stream;dms|application/octet-stream;doc|application/msword;dtd|application/xml-dtd;dv|video/x-dv;dvi|application/x-dvi;dxr|application/x-director;eps|application/postscript;etx|text/x-setext;exe|application/octet-stream;ez|application/andrew-inset;gif|image/gif;gram|application/srgs;grxml|application/srgs+xml;gtar|application/x-gtar;hdf|application/x-hdf;hqx|application/mac-binhex40;htm|text/html;html|text/html;ice|x-conference/x-cooltalk;ico|image/x-icon;ics|text/calendar;ief|image/ief;ifb|text/calendar;iges|model/iges;igs|model/iges;jnlp|application/x-java-jnlp-file;jp2|image/jp2;jpe|image/jpeg;jpeg|image/jpeg;jpg|image/jpeg;js|application/x-javascript;kar|audio/midi;latex|application/x-latex;lha|application/octet-stream;lzh|application/octet-stream;m3u|audio/x-mpegurl;m4a|audio/mp4a-latm;m4b|audio/mp4a-latm;m4p|audio/mp4a-latm;m4u|video/vnd.mpegurl;m4v|video/x-m4v;mac|image/x-macpaint;man|application/x-troff-man;mathml|application/mathml+xml;me|application/x-troff-me;mesh|model/mesh;mid|audio/midi;midi|audio/midi;mif|application/vnd.mif;mov|video/quicktime;movie|video/x-sgi-movie;mp2|audio/mpeg;mp3|audio/mpeg;mp4|video/mp4;mpe|video/mpeg;mpeg|video/mpeg;mpg|video/mpeg;mpga|audio/mpeg;ms|application/x-troff-ms;msh|model/mesh;mxu|video/vnd.mpegurl;nc|application/x-netcdf;oda|application/oda;ogg|application/ogg;pbm|image/x-portable-bitmap;pct|image/pict;pdb|chemical/x-pdb;pdf|application/pdf;pgm|image/x-portable-graymap;pgn|application/x-chess-pgn;pic|image/pict;pict|image/pict;png|image/png;pnm|image/x-portable-anymap;pnt|image/x-macpaint;pntg|image/x-macpaint;ppm|image/x-portable-pixmap;ppt|application/vnd.ms-powerpoint;ps|application/postscript;qt|video/quicktime;qti|image/x-quicktime;qtif|image/x-quicktime;ra|audio/x-pn-realaudio;ram|audio/x-pn-realaudio;ras|image/x-cmu-raster;rdf|application/rdf+xml;rgb|image/x-rgb;rm|application/vnd.rn-realmedia;roff|application/x-troff;rtf|text/rtf;rtx|text/richtext;sgm|text/sgml;sgml|text/sgml;sh|application/x-sh;shar|application/x-shar;silo|model/mesh;sit|application/x-stuffit;skd|application/x-koan;skm|application/x-koan;skp|application/x-koan;skt|application/x-koan;smi|application/smil;smil|application/smil;snd|audio/basic;so|application/octet-stream;spl|application/x-futuresplash;src|application/x-wais-source;sv4cpio|application/x-sv4cpio;sv4crc|application/x-sv4crc;svg|image/svg+xml;swf|application/x-shockwave-flash;t|application/x-troff;tar|application/x-tar;tcl|application/x-tcl;tex|application/x-tex;texi|application/x-texinfo;texinfo|application/x-texinfo;tif|image/tiff;tiff|image/tiff;tr|application/x-troff;tsv|text/tab-separated-values;txt|text/plain;ustar|application/x-ustar;vcd|application/x-cdlink;vrml|model/vrml;vxml|application/voicexml+xml;wav|audio/x-wav;wbmp|image/vnd.wap.wbmp;wbmxl|application/vnd.wap.wbxml;wml|text/vnd.wap.wml;wmlc|application/vnd.wap.wmlc;wmls|text/vnd.wap.wmlscript;wmlsc|application/vnd.wap.wmlscriptc;wrl|model/vrml;xbm|image/x-xbitmap;xht|application/xhtml+xml;xhtml|application/xhtml+xml;xls|application/vnd.ms-excel;xml|application/xml;xpm|image/x-xpixmap;xsl|application/xml;xslt|application/xslt+xml;xul|application/vnd.mozilla.xul+xml;xwd|image/x-xwindowdump;xyz|chemical/x-xyz;zip|application/zip;"' & @CRLF & _
                   'EndFunc   ;==>__MIMEAssocString' & @CRLF & _
                   '' & @CRLF & _
                   '' & @CRLF & _
                   'Func __MIMEType($sFileName) ;Aus der WinHTTP.au3 :)' & @CRLF & _
                   '    Local $aArray = StringRegExp(__MIMEAssocString(), "(?i)\Q;" & StringRegExpReplace($sFileName, ".*\.", "") & "\E\|(.*?);", 3)' & @CRLF & _
                   '    If @error Then Return "application/octet-stream"' & @CRLF & _
                   '    Return $aArray[0]' & @CRLF & _
                   'EndFunc   ;==>__MIMEType' & @CRLF & _
                   '' & @CRLF & _
                   'Func __EncodeMultipartFormData($aFields)' & @CRLF & _
                   '    #cs Arrayaufbau:' & @CRLF & _
                   '        [x][0] = Name' & @CRLF & _
                   '        [x][1] = Content (normal: "")' & @CRLF & _
                   '        [x][2] = File (normal: "")' & @CRLF & _
                   '    #ce' & @CRLF & _
                   '    Local $sBoundary = StringFormat("%s%.5f", "-----------------------------", Random(10000, 99999))' & @CRLF & _
                   '    Local $sData, $hOpen, $sFile, $aTempArray' & @CRLF & _
                   '' & @CRLF & _
                   '    For $i = 0 To UBound($aFields, 1) - 1' & @CRLF & _
                   "        If $aFields[$i][2] <> '' Then" & @CRLF & _
                   '            $hOpen = FileOpen($aFields[$i][2], 0)' & @CRLF & _
                   '            $sFile = FileRead($hOpen)' & @CRLF & _
                   '            FileClose($hOpen)' & @CRLF & _
                   '            $sData &= "--" & $sBoundary & @CRLF & _' & @CRLF & _
                   "                    'Content-Disposition: form-data; name=" & '"' & "' & $aFields[$i][0] & '" & '"' & "; filename=" & '"' & " ' & StringRegExpReplace($aFields[$i][2], " & '"' & ".*" & '"' & ", " & '""' & ") & ' " & '"' & "' & @CRLF & _" & @CRLF & _
                   '                    "Content-Type: " & __MIMEType($aFields[$i][2]) & @CRLF & @CRLF & _' & @CRLF & _
                   '                    $sFile & @CRLF' & @CRLF & _
                   '        Else' & @CRLF & _
                   '            $sData &= "--" & $sBoundary & @CRLF & _' & @CRLF & _
                   "                    'Content-Disposition: form-data; name=" & '"' & "' & $aFields[$i][0] & '" & '"' & "' & @CRLF & @CRLF & _" & @CRLF & _
                   '                    $aFields[$i][1] & @CRLF' & @CRLF & _
                   '        EndIf' & @CRLF & _
                   '    Next' & @CRLF & _
                   '    $sData &= "--" & $sBoundary & "--"' & @CRLF & _
                   '    Dim $aTempArray[2] = [$sBoundary, $sData]' & @CRLF & _
                   '    Return $aTempArray' & @CRLF & _
                   'EndFunc   ;==>__EncodeMultipartFormData' & @CRLF
       EndIf

       $winhttpCode &= @CRLF & @CRLF & _
               'Func _FileWrite($sHTML, $Zusatz = "", $Write = 0)' & @CRLF & _
               '   If Not IsDeclared("c_Filewrite") Then Global $c_Filewrite = 1' & @CRLF & _
               '   ConsoleWrite(@ScriptDir & "\" & $c_Filewrite & "' & GUICtrlRead($Input1) & '" & $Zusatz & @CRLF)' & @CRLF & _
               '   If $Write = 1 Then' & @CRLF & _
               '       FileDelete(@ScriptDir & "\" & $c_Filewrite & "' & GUICtrlRead($Input1) & '" & $Zusatz & ".html")' & @CRLF & _
               '       FileWrite(@ScriptDir & "\" & $c_Filewrite & "' & GUICtrlRead($Input1) & '" & $Zusatz & ".html", $sHTML) ' & @CRLF & _
               '   EndIf' & @CRLF & _
               '   $c_Filewrite += 1' & @CRLF & _
               'EndFunc   ;==>_FileWrite' & @CRLF
    EndFunc   ;==>_CreateEnd

    Func _CreateBoundaray($sPacket)
       $aElementNames = StringRegExp($sPacket, 'form-data; name="(.+?)"' & @CRLF, 3)
       $aElementsContent = StringRegExp($sPacket, @CRLF & @CRLF & '(.+)' & @CRLF & '--------', 3)
       $cBundarayOffset = 0
       $sDimArray = 'Dim $aFields[' & UBound($aElementNames) & '][3] = ['
       If $zDebug = "ja" Then _ArrayDisplay($aElementNames)
       If $zDebug = "ja" Then _ArrayDisplay($aElementsContent)
       For $iBundaray = 0 To UBound($aElementNames) - 1
           If StringInStr($aElementNames[$iBundaray], '; filename="') Then
               $sDimArray &= '["' & StringReplace($aElementNames[$iBundaray], '"; filename="', "") & '", "", $FilePfad],'
               $cBundarayOffset += 1
           Else
               $sDimArray &= '["' & $aElementNames[$iBundaray] & '", "' & $aElementsContent[$iBundaray - $cBundarayOffset] & '"],'
           EndIf
       Next
       $sDimArray = StringTrimRight($sDimArray, 1) & ']'
       $winhttpCode &= ";Bitte setzte Die Varriablen, warscheinlich musst du eine mit Stringregex auslesen" & @CRLF & _
               $sDimArray & @CRLF & _
               '$aMultiPart = __EncodeMultipartFormData($aFields)' & @CRLF
    EndFunc   ;==>_CreateBoundaray


    Func _Arbeiten($hFile, $Speichern, $Erstellen = 0)
       $counter = 0
       $counter2 = 0
       $File = FileRead($hFile);Mitsch nitt auslesen
       _CreateHead($File)
       $aPosts = StringSplit($File, "----------------------------------------------------------" & @CRLF, 1);pakete trennen
       If $zDebug = "ja" Then _ArrayDisplay($aPosts)
       For $c = 1 To UBound($aPosts) - 1;Pakete durchlaufen [0] = anzahl, letzter leer - 1 wegen 0 anfang
           If Not StringInStr($aPosts[$c], 'boundary=----') Then
               If _CreatePostGet($aPosts[$c]) = "True" Then
                   $counter2 = $counter2 + 1 ;Zählen der Geholten Packete
               Else
                   $counter = $counter + 1 ;Zählen der Ausgelassenen Pakete
               EndIf
           Else
               $zMultypart = "True"
               _CreateBoundaray($aPosts[$c])
               If _CreatePostGet($aPosts[$c], "True") = "True" Then
                   $counter2 = $counter2 + 1 ;Zählen der Geholten Packete
               Else
                   $counter = $counter + 1 ;Zählen der Ausgelassenen Pakete
               EndIf
           EndIf
       Next;nächstes Packet
       _CreateEnd()
       If $hFile = '' Then
           MsgBox(0, 'ACHTUNG', "Bitte wähle zuerst eine Datei aus")
       Else
           MsgBox(0, "Resultat", $counter & " Pakete ausgelassen und " & $counter2 & " Pakete geholt von " & $counter2 + $counter & "Paketen")
       EndIf
       $sName = GUICtrlRead($Input1)
       FileDelete(@ScriptDir & '\' & $sName & '.au3')
       FileWrite(@ScriptDir & '\' & $sName & '.au3', $winhttpCode)
    EndFunc   ;==>_Arbeiten

    Func _FileErstellen($hFile)
       _Arbeiten($hFile, 0, 1)
    EndFunc   ;==>_FileErstellen

    Func _Checked($hCheckbox)
       If GUICtrlRead($hCheckbox) = $GUI_CHECKED Then
           Return True
       Else
           Return False
       EndIf
    EndFunc   ;==>_Checked

     
     
    SilverHazard und 3HMonkey gefällt das.
  2. hantoren

    hantoren New Member

    Registriert seit:
    3. Juli 2017
    Beiträge:
    25
    Zustimmungen:
    5
    Punkte für Erfolge:
    3
    Geschlecht:
    männlich
    Ist das Suseskaninchens Bot?
     
  3. Ingolf

    Ingolf New Member Ehrenmitglied

    Registriert seit:
    2. Juli 2017
    Beiträge:
    25
    Zustimmungen:
    13
    Punkte für Erfolge:
    3
    Geschlecht:
    männlich
    Ort:
    Hamburg
    wo in dem gesamten text steht das es ein bot ist ?
     
  4. w33dt4k3r

    w33dt4k3r Member

    Registriert seit:
    5. Juli 2017
    Beiträge:
    42
    Zustimmungen:
    9
    Punkte für Erfolge:
    8
    Geschlecht:
    männlich
    Ort:
    NRW
    es ist nur das tool um das schreiben von winhttp bots zu erleichtern.
    small but powerfull
     
  5. hantoren

    hantoren New Member

    Registriert seit:
    3. Juli 2017
    Beiträge:
    25
    Zustimmungen:
    5
    Punkte für Erfolge:
    3
    Geschlecht:
    männlich
    Aber das Script ist von Suseskaninchen, bin mir relativ sicher das du es davor nicht gekennzeichnet hattest
     
  6. Ingolf

    Ingolf New Member Ehrenmitglied

    Registriert seit:
    2. Juli 2017
    Beiträge:
    25
    Zustimmungen:
    13
    Punkte für Erfolge:
    3
    Geschlecht:
    männlich
    Ort:
    Hamburg
    naja und wenn es so wäre was soll man mit der aussage anfangen "Ist das Suseskaninchens Bot?" was fürn bot xD ich denke mal er hat mehr als 1 bot geschrieben xD
     
  7. SilverHazard

    SilverHazard Moderator Mitarbeiter Moderator

    Registriert seit:
    2. Juli 2017
    Beiträge:
    21
    Zustimmungen:
    22
    Punkte für Erfolge:
    3
    Geschlecht:
    männlich
    Das steht seit der Erstveröffentlichung so inklusive Tippfehler im Originalpost, der seitdem auch nicht bearbeitet wurde ;)

    Grundsätzlich ist es natürlich immer gut, vorher beim ursprünglichen Autor (besonders wenn er eh hier im Forum ist) nachzufragen. Es scheint so, als ob das entweder der Fall war oder suesesKaninchen zumindest nichts dagegen hat.
     
  8. susesKaninchen

    susesKaninchen New Member

    Registriert seit:
    3. Juli 2017
    Beiträge:
    2
    Zustimmungen:
    7
    Punkte für Erfolge:
    3
    Er hat mich bevor er es veröffentlicht hat gefragt und so lange gewartet bis ich ihm geantwortet habe, also alles inordnung.

    PS: ich werde gleich mal ein Update hochladen, einfach da der neue Forefox hinter alle Post ein default dahinter schriebt und desweegen Fehler auftreten.
    Desweiteren schriebe ich dann die bekannten Bugs dazu.
     
    w33dt4k3r, DaSHiFTeR und SilverHazard gefällt das.
  9. susesKaninchen

    susesKaninchen New Member

    Registriert seit:
    3. Juli 2017
    Beiträge:
    2
    Zustimmungen:
    7
    Punkte für Erfolge:
    3
    Code (AutoIt):

    ; Code by susesKaninchen

    #include <winhttp.au3>
    #include <String.au3>
    #include <Array.au3>

    $zDebug = "-ja" ; das - weg machen mehr infos zu bekommen
    $hFile = ''
    $winhttpCode = ""
    $aHost = ""
    $zMultypart = "False"
    $zHoastFiltrt = 'no'
    $hHoastFilters = ""
    Dim $ahFilter[20]

    #include <ButtonConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #Region ### START Koda GUI section ### Form=
    $Form1_1 = GUICreate("Form1", 271, 341, 192, 124)
    $Button1 = GUICtrlCreateButton("Datei wählen", 8, 8, 75, 25)
    $Label1 = GUICtrlCreateLabel("Pfad:", 8, 48, 236, 17)
    $Button3 = GUICtrlCreateButton("Erstellen", 192, 8, 75, 25)
    $Label2 = GUICtrlCreateLabel("Filter:", 8, 72, 50, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $ahFilter[0] = GUICtrlCreateCheckbox(".png", 8, 104, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[1] = GUICtrlCreateCheckbox(".jpg", 8, 128, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[2] = GUICtrlCreateCheckbox(".css", 8, 152, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[3] = GUICtrlCreateCheckbox(".js", 8, 176, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[4] = GUICtrlCreateCheckbox(".xml", 8, 200, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[5] = GUICtrlCreateCheckbox(".gif", 144, 104, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[6] = GUICtrlCreateCheckbox(".swf", 144, 128, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[7] = GUICtrlCreateCheckbox(".ico", 144, 152, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[8] = GUICtrlCreateCheckbox("safebrowsing.", 144, 176, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[9] = GUICtrlCreateCheckbox("mozilla.com", 144, 200, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[10] = GUICtrlCreateCheckbox("ocsp.", 8, 224, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[11] = GUICtrlCreateCheckbox("symcd.com", 144, 224, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[12] = GUICtrlCreateCheckbox(".svg", 8, 248, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[13] = GUICtrlCreateCheckbox(".jpeg", 144, 248, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[14] = GUICtrlCreateCheckbox("twitter.com", 8, 272, 120, 17);+14
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[15] = GUICtrlCreateCheckbox("facebook.", 144, 272, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[16] = GUICtrlCreateCheckbox("google-analytics.com", 8, 296, 120, 17);+14
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[17] = GUICtrlCreateCheckbox("clients1.google.com", 144, 296, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[18] = GUICtrlCreateCheckbox("googleapis.com", 8, 320, 120, 17);+14
    GUICtrlSetState(-1, $GUI_CHECKED)
    $ahFilter[19] = GUICtrlCreateCheckbox("scorecardresearch.com", 144, 320, 120, 17)
    GUICtrlSetState(-1, $GUI_CHECKED)
    $hHoasBotton = GUICtrlCreateButton("Hoast auswählen", 144, 72, 120, 17)
    ;~ GUICtrlSetState(-1, $GUI_CHECKED)
    $Input1 = GUICtrlCreateInput("NAME", 88, 8, 97, 21)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ####include <ButtonConstants.au3>

    While 1
       $nMsg = GUIGetMsg($Form1_1)
       Switch $nMsg
           Case $GUI_EVENT_CLOSE
               Exit
           Case $Button1
               $hFile = FileOpenDialog("Ordner Wählen", @ScriptDir, "All (*.*)")
               $FileName = $hFile
               If StringLen($hFile) > 39 Then $FileName = StringTrimRight($hFile, StringLen($hFile) - 15) & '[' & StringLen($hFile) - 40 & ']' & StringTrimLeft($hFile, StringLen($hFile) - 25)
               GUICtrlSetData($Label1, $FileName)
               $aFilename = StringSplit($hFile, "\")
               If GUICtrlRead($Input1) = "NAME" Then GUICtrlSetData($Input1, $aFilename[UBound($aFilename) - 1])
           Case $Button3
               _FileErstellen($hFile)
           Case $hHoasBotton
               _addHoastToBlacklist($hFile)
       EndSwitch
    WEnd

    Func _CreateHead($File)
       $aUserAgent = StringRegExp($File, 'User-Agent: (.+?)' & @CRLF, 3)
       $aHost = StringRegExp($File, 'Host: (.+?)' & @CRLF, 3);Host lesen
       $aHost = _ArrayUnique($aHost)
       $sHost = 'Dim $aHosts[#ANZAHL#][2]' & @CRLF & _
               ';Host Array' & @CRLF
       If $zHoastFiltrt = "Ja" Then
           $aFilters = $hHoastFilters
       Else
           $aFilters = $ahFilter
       EndIf

       For $i = 0 To UBound($aHost) - 2
           If _Filter($aHost[$i + 1], $aFilters) <> "Weiter" Then
               _ArrayDelete($aHost, $i + 1)
               $i -= 1
           Else
               $sHost &= '$aHosts[' & $i & '][0] = "' & $aHost[$i + 1] & '"' & @CRLF & _
                       '$aHosts[' & $i & '][1] = _WinHttpConnect($hSession, $aHosts[' & $i & '][0])' & @CRLF
           EndIf
           If UBound($aHost) - 2 = $i Then ExitLoop
       Next
       $sHost = StringRegExpReplace($sHost, '#ANZAHL#', UBound($aHost) - 1)
       $winhttpCode = "#include <winhttp.au3>" & @CRLF & _
               "#include <Array.au3>" & @CRLF & _
               '$zWrite = 1' & @CRLF & _
               '$hSession = _WinHttpOpen("' & $aUserAgent[0] & '")' & @CRLF & _
               '#NoTrayIcon' & @CRLF & @CRLF & $sHost & @CRLF & _
               ';Pakete' & @CRLF
    EndFunc   ;==>_CreateHead

    Func _CreatePostGet($sPacket, $Bundaray = "False")
       If $zDebug = "ja" Then MsgBox(0, "", $sPacket)
       $aLink = StringRegExp($sPacket, '(GET) (.+?) HTTP/1.1|(POST) (.+?) HTTP/1.1', 3)
       If @error Then Return "False"
       ;link Filter
    ;~    If (StringInStr($aLink[UBound($aLink) - 1], '.png') = _Checked($Checkbox1)) Or (StringInStr($aLink[UBound($aLink) - 1], '.jpg') = _Checked($Checkbox2)) Or (StringInStr($aLink[UBound($aLink) - 1], '.css') = _Checked($Checkbox3)) Or (StringInStr($aLink[UBound($aLink) - 1], '.js') = _Checked($Checkbox4)) Or (StringInStr($aLink[UBound($aLink) - 1], '.xml') = _Checked($Checkbox5)) Or (StringInStr($aLink[UBound($aLink) - 1], '.gif') = _Checked($Checkbox6)) Or (StringInStr($aLink[UBound($aLink) - 1], '.swf') = _Checked($Checkbox7)) Or (StringInStr($aLink[UBound($aLink) - 1], '.ico') = _Checked($Checkbox8)) Then;Bilder und Java scripts ecetera überspringen
    ;~        Return "False"
       If _Filter($aLink[UBound($aLink) - 1]) <> "Weiter" Then
           Return "False"
       Else
           $aHostPaket = StringRegExp($sPacket, 'Host: (.+?)' & @CRLF, 3)
           If $zHoastFiltrt = "Ja" Then
               $aFilters = $hHoastFilters
           Else
               $aFilters = $ahFilter
           EndIf
           If _Filter($aHostPaket[0], $aFilters) <> "Weiter" Then Return "False"
    ;~        If (StringInStr($aHostPaket[0], 'safebrowsing.') = _Checked($Checkbox9)) Or (StringInStr($aHostPaket[0], 'mozilla.com') = _Checked($Checkbox10)) Or (StringInStr($aHostPaket[0], 'ocsp.') = _Checked($Checkbox11)) Then Return "False"
           $sHostPaket = _ArraySearch($aHost, $aHostPaket[0]) - 1
           $aAddedHeader = StringSplit($sPacket, @CRLF, 1)
           If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader)
    ;~        MsgBox(0,"","")
           $sPostData = 'Default'
           $zENDE = 1
           For $i = 0 To UBound($aAddedHeader) - 1
               If UBound($aAddedHeader) = $i Then ExitLoop
    ;~            If StringInStr($aAddedHeader[$i], 'Cache-Control: no-cache') Then
    ;~                If StringInStr($aAddedHeader[$i + 1], '"') Then
    ;~                    $sPostData = "'" & $aAddedHeader[$i + 1] & "'"
    ;~                Else
    ;~                    $sPostData = '"' & $aAddedHeader[$i + 1] & '"'
    ;~                EndIf
    ;~            EndIf
               If $zENDE = 1 Then
                   If StringRegExp($aAddedHeader[$i], '(GET) (.+?) HTTP/1.1|(POST) (.+?) HTTP/1.1') Then $zENDE = 0
                   _ArrayDelete($aAddedHeader, $i)
                   $i -= 1
                   ContinueLoop
               EndIf
               If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader)
               If $aAddedHeader[$i] = "" Or StringInStr($aAddedHeader[$i], 'Upgrade-Insecure-Requests') Or StringInStr($aAddedHeader[$i], 'Connection: keep-alive') Or StringInStr($aAddedHeader[$i], 'Pragma:') Or StringInStr($aAddedHeader[$i], 'Accept-Encoding:') Or StringInStr($aAddedHeader[$i], 'Host:') Or StringInStr($aAddedHeader[$i], 'boundary=----') Or StringInStr($aAddedHeader[$i], 'Accept-Language:') Or StringInStr($aAddedHeader[$i], 'Accept:') Or StringInStr($aAddedHeader[$i], 'Cookie:') Or StringInStr($aAddedHeader[$i], 'User-Agent:') Or StringInStr($aAddedHeader[$i], 'Referer:') Or StringInStr($aAddedHeader[$i], 'Content-Length:') Or StringInStr($aAddedHeader[$i], 'Content-Type:') Then
                   _ArrayDelete($aAddedHeader, $i)
                   $i -= 1
                   ContinueLoop
               EndIf
               If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader)
               If StringRegExp($aAddedHeader[$i], '^HTTP/') Or StringInStr($aAddedHeader[$i], 'Cache-Control: no-cache') Or StringInStr($aAddedHeader[$i], 'Date:') Or StringInStr($aAddedHeader[$i], 'Server:') Then
    ;~                If $aLink[UBound($aLink) - 2] = "POST" Then
    ;~                    If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader, "entfernen")
    ;~                    _ArrayDelete($aAddedHeader, $i-1)
    ;~                    $i -= 1
    ;~                EndIf
                   _ArrayDelete($aAddedHeader, $i)
                   If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader, "entfernen2")
                   $i -= 1
                   $zENDE = 1
                   ContinueLoop
               EndIf
               If Not StringInStr($aAddedHeader[$i], ':') Then
                   _ArrayDelete($aAddedHeader, $i)
                   $i -= 1
                   ContinueLoop
               EndIf
               If $zDebug = "ja" Then ConsoleWrite($aAddedHeader[$i] & @CRLF)
           Next
           If $zDebug = "ja" Then _ArrayDisplay($aAddedHeader, "Ende")
    ;~        _ArrayDisplay($aAddedHeader, "Ende")
           $sAddGeader = ""
           For $iHeaderString = 0 To UBound($aAddedHeader) - 1
               $sAddGeader &= "'" & $aAddedHeader[$iHeaderString] & "' & " & '@CRLF & '
           Next
    ;~        MsgBox(0, "", $sAddGeader)
           $sAddGeader = StringTrimRight($sAddGeader, 11)
           If $sAddGeader = "" Then $sAddGeader = "Default"
    ;~        MsgBox(0, "", $sAddGeader)
           $aReferrer = StringRegExp($sPacket, 'Referer: (.+?)' & @CRLF, 3)
           If @error = 1 Then
               Dim $aReferrer[1]
               $aReferrer[0] = "Default"
           EndIf
           $aPostData = StringRegExp($sPacket, '(.+)\s+HTTP/\d+\.\d+', 3)
           If $zDebug = "ja" Then _ArrayDisplay($aPostData)
       EndIf
       If UBound($aPostData) <> 1 And StringInStr($sPacket, 'POST /', 1) Then
           If StringInStr($aPostData[1], ': undefined') Then
               $sPostData = "'" & StringReplace($aPostData[1], ': undefined', "") & "'"
           Else
               $sPostData = '"' & StringReplace($aPostData[1], ': undefined', "") & '"'
           EndIf
       Else
           $sPostData = 'Default'
       EndIf
       If $zDebug = "ja" Then MsgBox(0, "POST", $sPostData)
       If StringInStr(StringTrimRight($sPacket, StringLen($sPacket) - 6), "https") Then
           If $Bundaray = "True" Then
               $winhttpCode = $winhttpCode & '$sHTML = _WinHttpSimpleSSLRequest( $aHosts[' & $sHostPaket & '][1]' & ', "' & $aLink[UBound($aLink) - 2] & '", "' & $aLink[UBound($aLink) - 1] & '", "' & $aReferrer[0] & '", $aMultiPart[1], ' & $sAddGeader & ' & @CRLF & "Content-Type: multipart/form-data; boundary=" & $aMultiPart[0])' & @CRLF & _
                       '_FileWrite($sHTML, "", $zWrite)' & @CRLF
           Else
               $winhttpCode = $winhttpCode & '$sHTML = _WinHttpSimpleSSLRequest( $aHosts[' & $sHostPaket & '][1]' & ', "' & $aLink[UBound($aLink) - 2] & '", "' & $aLink[UBound($aLink) - 1] & '", "' & $aReferrer[0] & '", ' & $sPostData & ', ' & $sAddGeader & ')' & @CRLF & _
                       '_FileWrite($sHTML, "", $zWrite)' & @CRLF
           EndIf
       Else
           If $Bundaray = "True" Then
               $winhttpCode = $winhttpCode & '$sHTML = _WinHttpSimpleRequest( $aHosts[' & $sHostPaket & '][1]' & ', "' & $aLink[UBound($aLink) - 2] & '", "' & $aLink[UBound($aLink) - 1] & '", "' & $aReferrer[0] & '"' & ", $aMultiPart[1], " & $sAddGeader & ' & @CRLF & "Content-Type: multipart/form-data; boundary=" & $aMultiPart[0])' & @CRLF & _
                       '_FileWrite($sHTML, "", $zWrite)' & @CRLF
           Else
               $winhttpCode = $winhttpCode & '$sHTML = _WinHttpSimpleRequest( $aHosts[' & $sHostPaket & '][1]' & ', "' & $aLink[UBound($aLink) - 2] & '", "' & $aLink[UBound($aLink) - 1] & '", "' & $aReferrer[0] & '", ' & $sPostData & ', ' & $sAddGeader & ')' & @CRLF & _
                       '_FileWrite($sHTML, "", $zWrite)' & @CRLF
           EndIf
       EndIf
       $winhttpCode = StringReplace($winhttpCode, ',  & @CRLF & ', ', ')
       Return "True" ;Zählen der Geholten Packete
    EndFunc   ;==>_CreatePostGet

    Func _Filter($sString, $ahFilterX = $ahFilter)
       For $i = 0 To UBound($ahFilterX) - 1
    ;~        MsgBox(0,"", GUICtrlRead($ahFilter[$i], 1))
           If _Checked($ahFilterX[$i]) Then
               If StringInStr($sString, GUICtrlRead($ahFilterX[$i], 1)) Then Return "False"
           EndIf
       Next
       Return "Weiter"
    EndFunc   ;==>_Filter

    Func _addHoastToBlacklist($hFile)
       $zHoastFiltrt = "Ja"
       $File = FileRead($hFile)
       $aHost = StringRegExp($File, 'Host: (.+?)' & @CRLF, 3);Host lesen
       $aHost = _ArrayUnique($aHost)
       $GUI2 = GUICreate("Hoast´s", 490, 30 + (UBound($aHost) / 3) * 24, -1, 10)
       GUICtrlCreateLabel("Wähle alle hoasts aus die NICHT bearbeiten werden sollen.", 5, 5)
       $iOfsetX = 0
       $iOfsetY = 0
       Dim $hHoastFilters[UBound($aHost)]
       For $i = 1 To UBound($aHost) - 1
           $hHoastFilters[$i] = GUICtrlCreateCheckbox($aHost[$i], 10 + $iOfsetX, 30 + $iOfsetY, 120, 17)
           GUICtrlSetState(-1, $GUI_CHECKED)
           If $iOfsetX <> 360 Then
               $iOfsetX += 120
           Else
               $iOfsetY += 24
               $iOfsetX = 0
           EndIf
       Next
       GUISetState(@SW_SHOW, $GUI2)
       While 1
           $nMsg = GUIGetMsg($GUI2)
           Switch $nMsg
               Case $GUI_EVENT_CLOSE
                   ExitLoop
           EndSwitch
       WEnd
       GUISetState(@SW_HIDE, $GUI2)
    EndFunc   ;==>_addHoastToBlacklist


    Func _CreateEnd()
       If $zMultypart = "True" Then
           $winhttpCode &= @CRLF & @CRLF & _
                   'Func __MIMEAssocString();Aus der WinHTTP.au3 :)' & @CRLF & _
                   'Return ";ai|application/postscript;aif|audio/x-aiff;aifc|audio/x-aiff;aiff|audio/x-aiff;asc|text/plain;atom|application/atom+xml;au|audio/basic;avi|video/x-msvideo;bcpio|application/x-bcpio;bin|application/octet-stream;bmp|image/bmp;cdf|application/x-netcdf;cgm|image/cgm;class|application/octet-stream;cpio|application/x-cpio;cpt|application/mac-compactpro;csh|application/x-csh;css|text/css;dcr|application/x-director;dif|video/x-dv;dir|application/x-director;djv|image/vnd.djvu;djvu|image/vnd.djvu;dll|application/octet-stream;dmg|application/octet-stream;dms|application/octet-stream;doc|application/msword;dtd|application/xml-dtd;dv|video/x-dv;dvi|application/x-dvi;dxr|application/x-director;eps|application/postscript;etx|text/x-setext;exe|application/octet-stream;ez|application/andrew-inset;gif|image/gif;gram|application/srgs;grxml|application/srgs+xml;gtar|application/x-gtar;hdf|application/x-hdf;hqx|application/mac-binhex40;htm|text/html;html|text/html;ice|x-conference/x-cooltalk;ico|image/x-icon;ics|text/calendar;ief|image/ief;ifb|text/calendar;iges|model/iges;igs|model/iges;jnlp|application/x-java-jnlp-file;jp2|image/jp2;jpe|image/jpeg;jpeg|image/jpeg;jpg|image/jpeg;js|application/x-javascript;kar|audio/midi;latex|application/x-latex;lha|application/octet-stream;lzh|application/octet-stream;m3u|audio/x-mpegurl;m4a|audio/mp4a-latm;m4b|audio/mp4a-latm;m4p|audio/mp4a-latm;m4u|video/vnd.mpegurl;m4v|video/x-m4v;mac|image/x-macpaint;man|application/x-troff-man;mathml|application/mathml+xml;me|application/x-troff-me;mesh|model/mesh;mid|audio/midi;midi|audio/midi;mif|application/vnd.mif;mov|video/quicktime;movie|video/x-sgi-movie;mp2|audio/mpeg;mp3|audio/mpeg;mp4|video/mp4;mpe|video/mpeg;mpeg|video/mpeg;mpg|video/mpeg;mpga|audio/mpeg;ms|application/x-troff-ms;msh|model/mesh;mxu|video/vnd.mpegurl;nc|application/x-netcdf;oda|application/oda;ogg|application/ogg;pbm|image/x-portable-bitmap;pct|image/pict;pdb|chemical/x-pdb;pdf|application/pdf;pgm|image/x-portable-graymap;pgn|application/x-chess-pgn;pic|image/pict;pict|image/pict;png|image/png;pnm|image/x-portable-anymap;pnt|image/x-macpaint;pntg|image/x-macpaint;ppm|image/x-portable-pixmap;ppt|application/vnd.ms-powerpoint;ps|application/postscript;qt|video/quicktime;qti|image/x-quicktime;qtif|image/x-quicktime;ra|audio/x-pn-realaudio;ram|audio/x-pn-realaudio;ras|image/x-cmu-raster;rdf|application/rdf+xml;rgb|image/x-rgb;rm|application/vnd.rn-realmedia;roff|application/x-troff;rtf|text/rtf;rtx|text/richtext;sgm|text/sgml;sgml|text/sgml;sh|application/x-sh;shar|application/x-shar;silo|model/mesh;sit|application/x-stuffit;skd|application/x-koan;skm|application/x-koan;skp|application/x-koan;skt|application/x-koan;smi|application/smil;smil|application/smil;snd|audio/basic;so|application/octet-stream;spl|application/x-futuresplash;src|application/x-wais-source;sv4cpio|application/x-sv4cpio;sv4crc|application/x-sv4crc;svg|image/svg+xml;swf|application/x-shockwave-flash;t|application/x-troff;tar|application/x-tar;tcl|application/x-tcl;tex|application/x-tex;texi|application/x-texinfo;texinfo|application/x-texinfo;tif|image/tiff;tiff|image/tiff;tr|application/x-troff;tsv|text/tab-separated-values;txt|text/plain;ustar|application/x-ustar;vcd|application/x-cdlink;vrml|model/vrml;vxml|application/voicexml+xml;wav|audio/x-wav;wbmp|image/vnd.wap.wbmp;wbmxl|application/vnd.wap.wbxml;wml|text/vnd.wap.wml;wmlc|application/vnd.wap.wmlc;wmls|text/vnd.wap.wmlscript;wmlsc|application/vnd.wap.wmlscriptc;wrl|model/vrml;xbm|image/x-xbitmap;xht|application/xhtml+xml;xhtml|application/xhtml+xml;xls|application/vnd.ms-excel;xml|application/xml;xpm|image/x-xpixmap;xsl|application/xml;xslt|application/xslt+xml;xul|application/vnd.mozilla.xul+xml;xwd|image/x-xwindowdump;xyz|chemical/x-xyz;zip|application/zip;"' & @CRLF & _
                   'EndFunc   ;==>__MIMEAssocString' & @CRLF & _
                   '' & @CRLF & _
                   '' & @CRLF & _
                   'Func __MIMEType($sFileName) ;Aus der WinHTTP.au3 :)' & @CRLF & _
                   '    Local $aArray = StringRegExp(__MIMEAssocString(), "(?i)\Q;" & StringRegExpReplace($sFileName, ".*\.", "") & "\E\|(.*?);", 3)' & @CRLF & _
                   '    If @error Then Return "application/octet-stream"' & @CRLF & _
                   '    Return $aArray[0]' & @CRLF & _
                   'EndFunc   ;==>__MIMEType' & @CRLF & _
                   '' & @CRLF & _
                   'Func __EncodeMultipartFormData($aFields)' & @CRLF & _
                   '    #cs Arrayaufbau:' & @CRLF & _
                   '        [x][0] = Name' & @CRLF & _
                   '        [x][1] = Content (normal: "")' & @CRLF & _
                   '        [x][2] = File (normal: "")' & @CRLF & _
                   '    #ce' & @CRLF & _
                   '    Local $sBoundary = StringFormat("%s%.5f", "-----------------------------", Random(10000, 99999))' & @CRLF & _
                   '    Local $sData, $hOpen, $sFile, $aTempArray' & @CRLF & _
                   '' & @CRLF & _
                   '    For $i = 0 To UBound($aFields, 1) - 1' & @CRLF & _
                   "        If $aFields[$i][2] <> '' Then" & @CRLF & _
                   '            $hOpen = FileOpen($aFields[$i][2], 0)' & @CRLF & _
                   '            $sFile = FileRead($hOpen)' & @CRLF & _
                   '            FileClose($hOpen)' & @CRLF & _
                   '            $sData &= "--" & $sBoundary & @CRLF & _' & @CRLF & _
                   "                    'Content-Disposition: form-data; name=" & '"' & "' & $aFields[$i][0] & '" & '"' & "; filename=" & '"' & " ' & StringRegExpReplace($aFields[$i][2], " & '"' & ".*" & '"' & ", " & '""' & ") & ' " & '"' & "' & @CRLF & _" & @CRLF & _
                   '                    "Content-Type: " & __MIMEType($aFields[$i][2]) & @CRLF & @CRLF & _' & @CRLF & _
                   '                    $sFile & @CRLF' & @CRLF & _
                   '        Else' & @CRLF & _
                   '            $sData &= "--" & $sBoundary & @CRLF & _' & @CRLF & _
                   "                    'Content-Disposition: form-data; name=" & '"' & "' & $aFields[$i][0] & '" & '"' & "' & @CRLF & @CRLF & _" & @CRLF & _
                   '                    $aFields[$i][1] & @CRLF' & @CRLF & _
                   '        EndIf' & @CRLF & _
                   '    Next' & @CRLF & _
                   '    $sData &= "--" & $sBoundary & "--"' & @CRLF & _
                   '    Dim $aTempArray[2] = [$sBoundary, $sData]' & @CRLF & _
                   '    Return $aTempArray' & @CRLF & _
                   'EndFunc   ;==>__EncodeMultipartFormData' & @CRLF
       EndIf

       $winhttpCode &= @CRLF & @CRLF & _
               'Func _FileWrite($sHTML, $Zusatz = "", $Write = 0)' & @CRLF & _
               '   If Not IsDeclared("c_Filewrite") Then Global $c_Filewrite = 1' & @CRLF & _
               '   ConsoleWrite(@ScriptDir & "\" & $c_Filewrite & "' & GUICtrlRead($Input1) & '" & $Zusatz & @CRLF)' & @CRLF & _
               '   If $Write = 1 Then' & @CRLF & _
               '       FileDelete(@ScriptDir & "\" & $c_Filewrite & "' & GUICtrlRead($Input1) & '" & $Zusatz & ".html")' & @CRLF & _
               '       FileWrite(@ScriptDir & "\" & $c_Filewrite & "' & GUICtrlRead($Input1) & '" & $Zusatz & ".html", $sHTML) ' & @CRLF & _
               '   EndIf' & @CRLF & _
               '   $c_Filewrite += 1' & @CRLF & _
               'EndFunc   ;==>_FileWrite' & @CRLF
    EndFunc   ;==>_CreateEnd

    Func _CreateBoundaray($sPacket)
       $aElementNames = StringRegExp($sPacket, 'form-data; name="(.+?)"' & @CRLF, 3)
       $aElementsContent = StringRegExp($sPacket, @CRLF & @CRLF & '(.+)' & @CRLF & '--------', 3)
       $cBundarayOffset = 0
       $sDimArray = 'Dim $aFields[' & UBound($aElementNames) & '][3] = ['
       If $zDebug = "ja" Then _ArrayDisplay($aElementNames)
       If $zDebug = "ja" Then _ArrayDisplay($aElementsContent)
       For $iBundaray = 0 To UBound($aElementNames) - 1
           If StringInStr($aElementNames[$iBundaray], '; filename="') Then
               $sDimArray &= '["' & StringReplace($aElementNames[$iBundaray], '"; filename="', "") & '", "", $FilePfad],'
               $cBundarayOffset += 1
           Else
               $sDimArray &= '["' & $aElementNames[$iBundaray] & '", "' & $aElementsContent[$iBundaray - $cBundarayOffset] & '"],'
           EndIf
       Next
       $sDimArray = StringTrimRight($sDimArray, 1) & ']'
       $winhttpCode &= ";Bitte setzte Die Varriablen, warscheinlich musst du eine mit Stringregex auslesen" & @CRLF & _
               $sDimArray & @CRLF & _
               '$aMultiPart = __EncodeMultipartFormData($aFields)' & @CRLF
    EndFunc   ;==>_CreateBoundaray


    Func _Arbeiten($hFile, $Speichern, $Erstellen = 0)
       $counter = 0
       $counter2 = 0
       $File = FileRead($hFile);Mitsch nitt auslesen
       _CreateHead($File)
       $aPosts = StringSplit($File, "----------------------------------------------------------" & @CRLF, 1);pakete trennen
       If $zDebug = "ja" Then _ArrayDisplay($aPosts)
       For $c = 1 To UBound($aPosts) - 1;Pakete durchlaufen [0] = anzahl, letzter leer - 1 wegen 0 anfang
           If Not StringInStr($aPosts[$c], 'boundary=----') Then
               If _CreatePostGet($aPosts[$c]) = "True" Then
                   $counter2 = $counter2 + 1 ;Zählen der Geholten Packete
               Else
                   $counter = $counter + 1 ;Zählen der Ausgelassenen Pakete
               EndIf
           Else
               $zMultypart = "True"
               _CreateBoundaray($aPosts[$c])
               If _CreatePostGet($aPosts[$c], "True") = "True" Then
                   $counter2 = $counter2 + 1 ;Zählen der Geholten Packete
               Else
                   $counter = $counter + 1 ;Zählen der Ausgelassenen Pakete
               EndIf
           EndIf
       Next;nächstes Packet
       _CreateEnd()
       If $hFile = '' Then
           MsgBox(0, 'ACHTUNG', "Bitte wähle zuerst eine Datei aus")
       Else
           MsgBox(0, "Resultat", $counter & " Pakete ausgelassen und " & $counter2 & " Pakete geholt von " & $counter2 + $counter & "Paketen")
       EndIf
       $sName = GUICtrlRead($Input1)
       FileDelete(@ScriptDir & '\' & $sName & '.au3')
       FileWrite(@ScriptDir & '\' & $sName & '.au3', $winhttpCode)
    EndFunc   ;==>_Arbeiten

    Func _FileErstellen($hFile)
       _Arbeiten($hFile, 0, 1)
    EndFunc   ;==>_FileErstellen

    Func _Checked($hCheckbox)
       If GUICtrlRead($hCheckbox) = $GUI_CHECKED Then
           Return True
       Else
           Return False
       EndIf
    EndFunc   ;==>_Checked
     
     
    Zuletzt bearbeitet: 22. August 2017 um 15:08 Uhr
  10. 3HMonkey

    3HMonkey Administrator Mitarbeiter Administrator

    Registriert seit:
    28. Juni 2017
    Beiträge:
    40
    Zustimmungen:
    28
    Punkte für Erfolge:
    18
    Geschlecht:
    männlich
  11. DaSHiFTeR

    DaSHiFTeR New Member

    Registriert seit:
    1. Juli 2017
    Beiträge:
    29
    Zustimmungen:
    4
    Punkte für Erfolge:
    3
    Geschlecht:
    männlich
    Beruf:
    Key-Account-Manager
    Ort:
    Köln
    Wieder einmal Top Arbeit :)
    Ein herzliches Danke auch von meiner Seite.
     

Diese Seite empfehlen

Die Seite wird geladen...