Perfect Random String

« Older   Newer »
  Share  
paic
CAT_IMG Posted on 10/12/2011, 17:38     +1   -1




Ho creato di recente questa libreria, quasi senza difetti per creare stringhe a caso.
CODICE
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.6.1
Author:         =KiNg_P@Y€=

QUESTA LIBRERIA PERMETTERE DI GENERARE STRINGHE A CASO...
I COMANDI SONO SEMPLICI:
GenRandom($m,$min,$max,$m2 = 0,$s = 0)
$m = Tipo di caratteri con il quale verrà formata la stringa.
                      $m = 0 (lattere numeri e simboli)
                                          $m = 1 (lettere e numeri)
                                          $m = 2 (lettere)
                                          $m = 3 (numeri)
$min = Numero minimo di caratteri di linghezza.
$max = Numero massimo di caratteri di lunghezza.
$m2 = Specifiche della stringa creata.
                      $m2 = 0 (misto fra carettari in stampato e in minuscolo)
                                          $m2 = 1 (caratteri in stampato)
                                          $m3 = 2 (caratteri in minuscolo)
$s = Eseguire o meno un controllo per verificare che la scringa generata non sia uguale a un'altra generata in precedenza.
                                          $s = 0 (non verrà controllato)
                                          $s = 1 (verrà controllato) [creerà un file string.log]

                       {AVRAI IN RISPOSTA UNA STRINGA RANDOM CON LE SPECIFICHE CHE HAI SCIELTO}

Usa resetsec() per resettare il sistema di sicurezza per evitare che al riavvio del programma non usi più le stringhe usate prima.
{AVRAI IN RISPOSTA 1 SE E STATO ELIMINATO CORRETTAMENTE O 0 SE NON E' ANDATO A BUON FINE}

Usa infol() per ricevere tutti i dettagli riguardante il file log del sistema di sicurezza.
{AVRAI IN RISPOSTA UN "N 231,0,8kb" SE IL FILE LOG ESISTE ALTRIMENTI UN False SE NON EISTE}

Usa Found($name) per verificare se una stringa e stata generata (con sicurezza attiva).
                     $name= "sdhjk" (stringa da cercare)
{AVRAI IN RISPOSTA O IL NUMERO DELLA RIGA IN CUI SI TROVA LA STRINGA O UN False IN CASO DI ESITO DI RECERCA NEGATIVO}
#ce ----------------------------------------------------------------------------
#include <File.au3>
#RequireAdmin
$allc='1"2"3"4"5"6"7"8"9"0"ì"!"£"$"%"&"/"(")"="?"^"Q"W"E"R"T"Y"U"I"O"P"é"*"A"S"D"F"G"H"J"K"L"ç"°"§"<">"X"C"V"B"N"M";":"_","."-"ò"à"ù"è"+"@"#"{"}"["]'
$len='A"B"C"D"E"F"G"H"I"L"M"N"O"P"Q"R"S"T"U"V"Z"X"Y"K"W"J"1"2"3"4"5"6"7"8"9"0'
$letter='A"B"C"D"E"F"G"H"I"L"M"N"O"P"Q"R"S"T"U"V"Z"X"Y"K"W"J'
$num='1"2"3"4"5"6"7"8"9"0'

Func GenRandom($m,$min,$max,$m2 = 0,$s = 0)
       while 1
   $tot=""
        $long=Random($min,$max,1)

        if $m = 0 Then ;se 0 lettere numeri e simboli
                $st=StringSplit($allc,'"')
                $maxi=$st[0]
                $tot=""
                if $m2 = 0 Then ;se 0 = misto misto
                       For $n = 1 to $long step +1
                       $mom=$tot
                       if random(1,2,1) = 1 Then
                               $tot=$mom&StringLower($st[Random(1,$maxi,1)])
                       Else
                               $tot=$mom&$st[Random(1,$maxi,1)]
                               EndIf
           Next
                  ElseIf $m2 = 1 Then;se 1 = misto stampato
                          For $n = 1 to $long step +1
                       $mom=$tot
                       $tot=$mom&$st[Random(1,$maxi,1)]
           Next

                  ElseIf $m2 = 2 Then;se 2 = misto piccolo
                             For $n = 1 to $long step +1
                       $mom=$tot
                       $tot=$mom&StringLower($st[Random(1,$maxi,1)])
           Next

                EndIf
        ElseIf $m = 1 Then ;se 1 lettere e numeri
                 $st=StringSplit($len,'"')
                $maxi=$st[0]
                $tot=""
                if $m2 = 0 Then ;se 0 = misto misto
                       For $n = 1 to $long step +1
                       $mom=$tot
                       if random(1,2,1) = 1 Then
                               $tot=$mom&StringLower($st[Random(1,$maxi,1)])
                       Else
                               $tot=$mom&$st[Random(1,$maxi,1)]
                               EndIf
           Next

                  ElseIf $m2 = 1 Then;se 1 = misto stampato
                          For $n = 1 to $long step +1
                       $mom=$tot
                       $tot=$mom&$st[Random(1,$maxi,1)]
           Next

                  ElseIf $m2 = 2 Then;se 2 = misto piccolo
                             For $n = 1 to $long step +1
                       $mom=$tot
                       $tot=$mom&StringLower($st[Random(1,$maxi,1)])
           Next

                EndIf
    ElseIf $m = 2 Then ;se 2 solo lettere
                          $st=StringSplit($letter,'"')
                $maxi=$st[0]
                $tot=""
                if $m2 = 0 Then ;se 0 = misto misto
                       For $n = 1 to $long step +1
                       $mom=$tot
                       if random(1,2,1) = 1 Then
                               $tot=$mom&StringLower($st[Random(1,$maxi,1)])
                       Else
                               $tot=$mom&$st[Random(1,$maxi,1)]
                               EndIf
           Next

                  ElseIf $m2 = 1 Then;se 1 = misto stampato
                          For $n = 1 to $long step +1
                       $mom=$tot
                       $tot=$mom&$st[Random(1,$maxi,1)]
           Next

                  ElseIf $m2 = 2 Then;se 2 = misto piccolo
                             For $n = 1 to $long step +1
                       $mom=$tot
                       $tot=$mom&StringLower($st[Random(1,$maxi,1)])
           Next

                EndIf
        ElseIf $m = 3 Then ;se 3 solo numeri
                  $st=StringSplit($num,'"')
                $maxi=$st[0]
                $tot=""
                          For $n = 1 to $long step +1
                       $mom=$tot
                       $tot=$mom&$st[Random(1,$maxi,1)]
           Next
               EndIf

               if $s = 0 Then ;se il sistema di sicurezza è 'disarmato' = fine
                       ExitLoop
               Else           ;se è armato controlla
                       $line=_FileCountLines('string.log')
                       $n=1
                       $sict='no'
                       Do
             if $tot = FileReadLine('string.log',$n) Then
                                 $sict = 'si'
                                 $n=Execute($line+4)
                                 ;MsgBox(0,'trovato',$tot)
             Else
                                 $n+=1
                                  $sict='no'
                         EndIf

                         Until $n > $line
                       EndIf

if $sict = 'si' Then
Else
       FileWrite('string.log',$tot&@CRLF)
       ;$tested+=1
ExitLoop
EndIf
               ;        EndIf


       WEnd
       ;MsgBox(0,$long,$tot,1)
       ;ToolTip($tot)
       ;Sleep(200)
       Return $tot
EndFunc


Func resetsec()
       $del=FileDelete('string.log')
       Return $del
EndFunc

func infol()
       if FileExists ('string.log') Then
       $line=_FileCountLines('string.log')
       $size=FileGetSize('string.log')
       Return "N: "&$line&","&Execute($size/1000)&"kb"
Else
       Return 'False'
       EndIf
EndFunc

Func Found($name)
              $line=_FileCountLines('string.log')
                       $n=1
                       $sict='no'
                       Do
             if $name = FileReadLine('string.log',$n) Then
                                 $sict = 'si'
                                 $l=$n
                                 $n=Execute($line+4)
             Else
                                 $n+=1
                                  $sict='no'
                         EndIf

                         Until $n > $line
                         if $sict = 'si' Then
                                 Return $l
                         Else
                                 Return 'False'
                         EndIf

       EndFunc


Tutte le informazioni sono nel source
 
Top
»Master
CAT_IMG Posted on 10/12/2011, 17:46     +1   -1




interessante ^^ però credo che ti sei dato troppo da fare per fare una cosa semplice lol xd
 
Top
CAT_IMG Posted on 10/12/2011, 18:01     +1   -1

So implementare gli object

Group:
Admin
Posts:
1,215
Reputazione:
+150

Status:


CITAZIONE (»Master @ 10/12/2011, 17:46) 
però credo che ti sei dato troppo da fare per fare una cosa semplice lol xd

Tra l'altro bastava 1/4 del codice XD

Comunque bravo :)
 
Top
paic
CAT_IMG Posted on 10/12/2011, 20:29     +1   -1




Serve a tutti un generatore di stringhe, soprattutto per chi si diverte a fare dei bruteforce.
e non avevo altro da fare. :lool:
 
Top
CAT_IMG Posted on 10/12/2011, 21:42     +1   -1

So implementare gli object

Group:
Admin
Posts:
1,215
Reputazione:
+150

Status:


Un generatore di stringhe casuali è inutile per un bruteforce... Però è utile per generare password sicure o token o cose simili :D
 
Top
»Master
CAT_IMG Posted on 10/12/2011, 21:43     +1   -1




stringhe casuali non bastano, un bruteforce si basa sulla seguenza delle combinazioni delle stringhe, lol
 
Top
CAT_IMG Posted on 10/12/2011, 21:56     +1   -1

So implementare gli object

Group:
Admin
Posts:
1,215
Reputazione:
+150

Status:


CITAZIONE (»Master @ 10/12/2011, 21:43) 
stringhe casuali non bastano, un bruteforce si basa sulla seguenza delle combinazioni delle stringhe, lol

Infatti, quello che dicevo io... Fai prima a scaricare un dizionario da internet, se ne trovano di oltre 70GB se sai dove cercare.
 
Top
»Master
CAT_IMG Posted on 10/12/2011, 22:06     +1   +1   -1




eh si, se la tua connessione è più veloce che il tuo processore conviene xD
 
Top
*Sym98*
CAT_IMG Posted on 11/12/2011, 08:54     +1   -1




Tempo fa avevo sviluppato un algoritmo per i bruteforce, ma Autoit era troppo lento e impiegava mesi (forse anni) a scoprire una password...
 
Top
CAT_IMG Posted on 11/12/2011, 14:55     +1   -1

So implementare gli object

Group:
Admin
Posts:
1,215
Reputazione:
+150

Status:


CITAZIONE (»Master @ 10/12/2011, 22:06) 
eh si, se la tua connessione è più veloce che il tuo processore conviene xD

Ci metti di meno a scaricare 70GB di wordlist che generarla da zero, a meno che tu non abbia un supercomputer XD
 
Top
»Master
CAT_IMG Posted on 11/12/2011, 19:21     +1   -1




CITAZIONE (ƒritzer @ 11/12/2011, 14:55) 
CITAZIONE (»Master @ 10/12/2011, 22:06) 
eh si, se la tua connessione è più veloce che il tuo processore conviene xD

Ci metti di meno a scaricare 70GB di wordlist che generarla da zero, a meno che tu non abbia un supercomputer XD

sicuramente xD
aspetto ancora i computer quantici :yum: xD
 
Top
10 replies since 10/12/2011, 17:38   157 views
  Share