Web-Txt-Scrambler V2.0

  • Hallo,

    ausgehend von dem Problemchen hier:
    https://autoit.de/index.php?page=Thread&threadID=11829

    ein Script gebastelt das Texte aller Art für Web-Seiten verschlüsselt, im einfachsten Fall ohne JavaScript auskommt und validen HTML Code erzeugt der dann z.B so aussieht:

    Code
    &#x0041;n&#x004D;i&#x0063;&#x68;@<!-- IwrTY[uNrdQxd`Sf}aWW -->i&#x006E;&#x74;&#x0065;r&#x006E;e&#x74;<!-- uO -->.&#x6E;e<!-- YoiUsVLaOPEdNEYtwGwiNwD}h -->tz

    die Steigerungsform, für JavaScript und unescape:

    Code
    document.write(unescape(%41n\u004D%69&#x63;&#x0068;@%69n<!-- G^hP[\nBzE`WEPz\vb}[{kny -->t\u0065&#x72;\u006E<!-- ^pWOx -->e&#x0074;%2E&#x6E;\u0065&#x74;\u007A));

    einfach mal davon ausgehend, daß diese eMail und Adressen-Sammler nicht unendlich Rechleistung haben um solchen Müll auszusortieren.

    !!!
    * Nicht auf Seiten anwenden die von Suchmaschinen indexiert werden. Der Text der erzeugt wird ist im Endeffekt nur für den Leser der Seite sichtbar.
    * Ein Kopieren des Textes aus der Seite heraus ist ebenfalls nicht mehr möglich - bzw. das kopierte ist nur "Datenmüll"

    Um die Ausgabe noch "komplizierter" zu gestalten kann das de_DE Hunspell dictionary in das Programm-Verzeichnis kopiert werden.

    Hier das Script:

    Spoiler anzeigen
    [autoit]

    #region Includes
    #include <Array.au3>
    #include <File.au3>
    #endregion Includes
    ; =============================================================================
    ; Name ..........: Web-Txt-Scrambler
    ; Description ...: Makes your text in websites only readable for the user.
    ; Requirement ...: de-DE.dic (dictionary file of the de_DE Hunspell dictionary)
    ; AutoIt Version : V3.3.0.0
    ; Syntax ........: Text to scramble (commandline!)
    ; Parameter(s): .: $Texttoscramble -
    ; Return Value ..: Success - Scrambled text
    ; Failure - ""
    ; Author(s) .....: Thorsten Willert
    ; Date ..........: Thu Oct 29 10:35:02 CET 2009
    ; Version .......: 2.0
    ; ==============================================================================

    [/autoit] [autoit][/autoit] [autoit]

    Global $mail = $CmdLine[1]

    [/autoit] [autoit][/autoit] [autoit]

    Global $bJavaScript = False ; adding unicode excapes for JavaScript output
    Global $bEscape = False; works only with unescape in JavaScript or in URLs
    ; don't use this for URLs
    Global $bComments = True; Comments
    Global $bStyle = True; Comments and hidden CSS styles

    [/autoit] [autoit][/autoit] [autoit]

    Global $sWoerterbuch = @ScriptDir & "\de-DE.dic"

    [/autoit] [autoit][/autoit] [autoit]

    Global $iStart = 0
    Global $iEnd = 6
    If Not $bJavaScript Then $iStart = 1
    If Not $bEscape Then $iStart = 2
    If Not $bComments Then $iEnd = 4
    If Not $bStyle Then $iEnd = 5

    [/autoit] [autoit][/autoit] [autoit]

    Global $aMail = StringSplit($mail, "", 0)
    Global $rnd_alt = 10
    Global $rnd = 10
    Global $Start = 1
    Global $sRnd = ""
    Global $sID = ""
    Global $sDummySpan = ""
    Global $aWoerter

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If FileExists($sWoerterbuch) Then _FileReadToArray($sWoerterbuch, $aWoerter)

    [/autoit] [autoit][/autoit] [autoit]

    $sID = _RandomString(1)
    $sDummySpan = _RandomString(1)

    [/autoit] [autoit][/autoit] [autoit]

    Global $ret = '<style type="text/css">.' & $sID & "{display:none;}" & @crlf & "." & $sDummySpan & "{}</style>" & @CRLF & @CRLF & @CRLF

    [/autoit] [autoit][/autoit] [autoit]

    For $i = 1 To $aMail[0]
    $sRnd = ""
    If $aMail[$i] = " " Then
    $ret &= "&nbsp;"
    ContinueLoop
    EndIf
    If $aMail[$i] = "@" Then
    $ret &= "&#x40;"
    ContinueLoop
    EndIf
    While $rnd_alt = $rnd
    $rnd = Random($iStart, $iEnd, 1)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Switch $rnd
    Case 0
    $ret &= StringFormat("\\u%0000s", Hex(AscW($aMail[$i]), 4))
    Case 1
    $ret &= "%" & Hex(AscW($aMail[$i]), 2)
    Case 2
    $tmp = StringFormat("&#x%02s;", StringReplace(Hex(AscW($aMail[$i]), 2), "0", "F"))
    Switch Random(1,2,1)
    Case 1
    $ret &= $tmp
    Case 2
    $ret &= '<span class="' & $sDummySpan & '">' & $tmp & '</span>'
    EndSwitch
    Case 3
    $tmp = StringFormat("&#x%04s;", Hex(AscW($aMail[$i]), 4))
    Switch Random(1,2,1)
    Case 1
    $ret &= $tmp
    Case 2
    $ret &= '<span class="' & $sDummySpan & '">' & $tmp & '</span>'
    EndSwitch
    Case 4
    $tmp = "&#" & Asc($aMail[$i]) & ";"
    Switch Random(1,2,1)
    Case 1
    $ret &= $tmp
    Case 2
    $ret &= '<span class="' & $sDummySpan & '">' & $tmp & '</span>'
    EndSwitch
    Case 5
    $ret &= StringFormat("<!-- %s -->", _JustRandom(2) ) & $aMail[$i]
    Case 6
    $ret &= '<span class="' & $sID & '">' & _JustRandom() & '</span>' & $aMail[$i]
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    $rnd_alt = $rnd
    Next

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite($ret & @CRLF)

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    Func _RandomString($iMode, $iMin=10, $iMax=25)
    Local $t, $sReturn = ""
    Switch $iMode
    Case 1 ; 90-97
    For $j = 0 To Random($iMin, $iMax)
    Do
    $t = Random(65, 122)
    Until $t > 97 Or $t < 90
    $sReturn &= Chr($t)
    Next
    Case 2
    For $j = 0 To Random($iMin, $iMax)
    Do
    $t = Random(39, 126)
    Until ($t > 97 Or $t < 90) And ($t < 59 Or $t > 63)
    $sReturn &= Chr($t)
    Next
    EndSwitch

    [/autoit] [autoit][/autoit] [autoit]

    Return $sReturn
    EndFunc
    ;===============================================================================
    Func _RandomWord()
    If $aWoerter[0] > 500 Then
    Local $sWord = $aWoerter[ Random(20, $aWoerter[0],1) ]
    Return StringMid($sWord,1,StringInStr($sWord,"/")-1)
    Else
    Return _RandomString(1)
    EndIf
    EndFunc
    ;===============================================================================
    Func _RandomEncode($s)
    Switch Random(0,3,1)
    Case 0
    Return StringFormat("&#x%02s;", StringReplace(Hex(AscW($s), 2), "0", "F"))
    Case 1
    Return StringFormat("&#x%04s;", Hex(AscW($s), 4))
    Case 2
    Return "&#" & Asc($s) & ";"
    Case 3
    Return $s
    EndSwitch
    EndFunc
    ;===============================================================================
    Func _RandomWordEncode($sWord)
    Local $sReturn=""
    Local $aString = StringSplit($sWord, "")
    For $i = 1 To $aString[0]
    $sReturn &= _RandomEncode($aString[$i])
    Next
    Return $sReturn
    EndFunc
    ;===============================================================================
    Func _JustRandom($iMode=4)
    Switch Random(1,$iMode,1)
    Case 1
    Return _RandomWord()
    Case 2
    Return _RandomString(2, 0)
    Case 3
    Return _RandomWordEncode(_RandomWord())
    Case 4
    Return _RandomWordEncode(_RandomString(2))
    EndSwitch
    EndFunc

    [/autoit]

    Das Ganze ist momentan nur eine Commando-Zeilen Version, deren Parameter nicht beeinflußt werden können (das kommt evtl. noch bzw. eine PHP-Umsetzung)

    Viel Spaß damit!

    Grüße
    Stilgar

    5 Mal editiert, zuletzt von Stilgar (29. Oktober 2009 um 10:57)

  • Nochmal gesteigert:

    Code
    <style type="text/css">.IvEyAtLyLpWjEu{display:none;}</style>
    t<!-- FH -->h<span class="IvEyAtLyLpWjEu">mDKzj[S{Z</span>o&#x72;<span class="IvEyAtLyLpWjEu">Pj_GAbphaOqSk^Wru}bl</span>s<!-- WekmBRxmp_nhwa -->te&#x006E;<span class="IvEyAtLyLpWjEu">EkYWp^yNb_aLaBWa{FkMgOGk</span>.w<!-- _kgAtc -->i<span class="IvEyAtLyLpWjEu">JY_YPx\xtxSiPQzC{KuqVvwL</span>l&#x6C;&#x0065;<!-- |iYa}JbhxkLau_TviD -->r<span class="IvEyAtLyLpWjEu">}M</span>t@<!-- cs -->g&#x006D;<span class="IvEyAtLyLpWjEu">_jkgTdt]Y{oFx_chTohA|N</span>x<!-- GV|_aqKekEiui -->.&#x0064;&#x65;


    der CSS Abschnitt muß natürlich wo anderst hin.

  • Version 2:
    * diesmal als Commando-Zeilen Version zum Anbinden an Text-Editoren
    * noch "kompliziertere" Ausgabe
    * Unterstützung des "de_DE Hunspell dictionary"

    nein es wird kein Programm geben, das den Text wieder zurück wandelt, wer den "Quelltext" verliert ... :whistling: