Password Generator

Commenti

Transcript

Password Generator
Generatore di Password
program PassGen(input,output,Passlist);
label z,z1;
var i,i1,i2,i3,i4,i5,i6,i7,i8,min,max,numcar:integer;
sc:char;
f:text;
s,t,u:string;
A:array[1..255] of char;
begin
writeln('=====================================================
==========================');
writeln('Generatore di Password v.1.0
-');writeln;
writeln('by
-');writeln;
writeln('Santiboom
-');
writeln('=====================================================
==========================');
writeln;
s:='c:\windows\desktop\passlist.txt';
assign(f,s);
rewrite(f);
flush(f);
writeln('Seleziona una opzione:');writeln;
writeln('1) Stampa tutte la permutazioni dei caratteri con ripetizione');
writeln('2) Stampa tutte le permutazioni dei caratteri senza ripetizione');writeln;
writeln('N.B. Entrambe le opzioni permettono di inserire una stringa iniziale cos il');
writeln('
risultato sar… del tipo: "stringa"+"permutazione". ');
writeln('-------------------------------------------------------------------------------');writeln;
z: write('Scegli: ');
readln(sc);
writeln;
if (sc>'2') or (sc<'1') then
begin
writeln('Devi premere "1" o "2"!');
writeln;
goto z;
end;
if sc='1' then
begin
write('Inserisci la stringa con cui iniziare (invio per non metterla): ');
readln(u);
writeln;
write('Inserisci i caratteri particolari da considerare (invio per non metterli): ');
read(t);
writeln;
if t='' then
begin
writeln('Per definire il range di caratteri da utilizzare, scrivi il codice ascii del');
write('carattere iniziale (es. 0-->48, 9-->57, a-->97, z-->122): ');
readln(min);writeln;
write('e quello del carattere finale: ');
readln(max);writeln;
write('I ',max-min+1,' caratteri verranno presi k a k scrivi il valore di k: ');
readln(numcar);writeln;
writeln;writeln;
for i:=min to max do A[i]:=chr(i);
end
else
begin
min:=1;
Santi Strati
1
Generatore di Password
write('I ',length(t),' caratteri verranno presi k a k scrivi il valore di k: ');
readln(numcar);
writeln;
max:=length(t);
for i:=min to max do A[i]:=t[i]
end;
end
else if sc='2' then goto z1;
writeln('Sono stati scelti i seguenti caratteri: ');writeln;
for i:=min to max do write(i,'--->',A[i],' ');writeln;writeln;
if numcar>9 then
begin
writeln('Non Š possibile l''elaborazione per un numero cos elevato di caratteri!');
writeln(f,'Non e'' possibile l''elaborazione per un numero cosi'' elevato di caratteri!');
writeln;
end
else
begin
case numcar of
1 : for i:=min to max do writeln(f,u,A[i]);
2 : for i:=min to max do for i1:=min to max do writeln(f,u,A[i],A[i1]);
3 : for i:=min to max do for i1:=min to max do for i2:=min to max do
writeln(f,u,A[i],A[i1],A[i2]);
4 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
writeln(f,u,A[i],A[i1],A[i2],A[i3]);
5 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do writeln(f,u,A[i],A[i1],A[i2],A[i3],A[i4]);
6 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do for i5:=min to max do
writeln(f,u,A[i],A[i1],A[i2],A[i3],A[i4],A[i5]);
7 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do for i5:=min to max do for i6:=min to max do
writeln(f,A[i],u,A[i1],A[i2],A[i3],A[i4],A[i5],A[i6]);
8 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do for i5:=min to max do for i6:=min to max do for i7:=min to
max do
writeln(f,u,A[i],A[i1],A[i2],A[i3],A[i4],A[i5],A[i6],A[i7]);
9 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do for i5:=min to max do for i6:=min to max do for i7:=min to
max do
for i8:=min to max do writeln(f,u,A[i],A[i1],A[i2],A[i3],A[i4],A[i5],A[i6],A[i7],A[i8]);
end;
writeln('File ''Passlist'' pronto sul desktop!');writeln;
i7:=max-min+1;
for i:=1 to numcar-1 do i7:=i7*(max-min+1);
writeln('Il numero di permutazoni con ripetizione generate di ',max-min+1,' caratteri
presi ');
writeln(numcar,' a ',numcar,' Š: ',i7);
writeln('--------------------------------------------------------------------------------');
close(f);
end;
exit;
Santi Strati
2
Generatore di Password
z1:
begin
write('Inserisci la stringa con cui iniziare (invio per non metterla): ');
readln(u);
writeln;
write('Inserisci i caratteri particolari da considerare: ');
read(t);
writeln;
min:=1;
numcar:=length(t);
if numcar>9 then
begin
writeln('Non Š possibile l''elaborazione per un numero cos elevato di caratteri!');
writeln(f,'Non e'' possibile l''elaborazione per un numero cosi'' elevato di caratteri!');
writeln;
close(f);
exit;
end
else
begin
max:=numcar;
for i:=min to max do A[i]:=t[i];
case numcar of
1 : for i:=min to max do writeln(f,u,A[i]);
2 : for i:=min to max do for i1:=min to max do if (i<>i1) then writeln(f,u,A[i],A[i1]);
3 : for i:=min to max do for i1:=min to max do for i2:=min to max do if (i<>i1) and
(i<>i2) and (i1<>i2) then writeln(f,u,A[i],A[i1],A[i2]);
4 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
if (i<>i1) and (i<>i2) and (i<>i3) and (i1<>i2) and (i1<>i3) and (i2<>i3)
then writeln(f,u,A[i],A[i1],A[i2],A[i3]);
5 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do
if (i<>i1) and (i<>i2) and (i<>i3) and (i<>i4) and (i1<>i2) and (i1<>i3) and
(i1<>i4) and (i2<>i3) and (i2<>i4) and (i3<>i4) then
writeln(f,u,A[i],A[i1],A[i2],A[i3],A[i4]);
6 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do for i5:=min to max do
if (i<>i1) and (i<>i2) and (i<>i3) and (i<>i4) and (i<>i5) and(i1<>i2) and
(i1<>i3) and (i1<>i4) and (i1<>i5) and (i2<>i3) and (i2<>i4) and (i2<>i5) and
(i3<>i4) and (i3<>i5) and (i4<>i5) then
writeln(f,u,A[i],A[i1],A[i2],A[i3],A[i4],A[i5]);
7 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do for i5:=min to max do for i6:=min to max do
if (i<>i1) and (i<>i2) and (i<>i3) and (i<>i4) and (i<>i5) and(i<>i6) and
(i1<>i2) and (i1<>i3) and (i1<>i4) and (i1<>i5) and (i1<>i6) and
(i2<>i3) and (i2<>i4) and (i2<>i5) and (i2<>i6) and (i3<>i4) and (i3<>i5) and
(i3<>i6) and (i4<>i5) and (i4<>i6) and (i5<>i6)
then writeln(f,u,A[i],A[i1],A[i2],A[i3],A[i4],A[i5],A[i6]);
8 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do for i5:=min to max do for i6:=min to max do for i7:=min to
max do
if (i<>i1) and (i<>i2) and (i<>i3) and (i<>i4) and (i<>i5) and(i<>i6) and
(i<>i7) and (i1<>i2) and (i1<>i3) and (i1<>i4) and (i1<>i5) and
Santi Strati
3
Generatore di Password
(i1<>i6) and (i1<>i7) and (i2<>i3) and (i2<>i4) and (i2<>i5) and (i2<>i6) and
(i2<>i7) and (i3<>i4) and (i3<>i5) and (i3<>i6) and (i3<>i7) and (i4<>i5) and
(i4<>i6) and (i4<>i7) and (i5<>i6) and (i5<>i7) and (i6<>i7) then
writeln(f,u,A[i],A[i1],A[i2],A[i3],A[i4],A[i5],A[i6],A[i7]);
9 : for i:=min to max do for i1:=min to max do for i2:=min to max do for i3:=min to
max do
for i4:=min to max do for i5:=min to max do for i6:=min to max do for i7:=min to
max do for i8:=min to max do
if (i<>i1) and (i<>i2) and (i<>i3) and (i<>i4) and (i<>i5) and(i<>i6) and
(i<>i7) and (i<>i8) and (i1<>i2) and (i1<>i3) and (i1<>i4) and (i1<>i5) and
(i1<>i6) and (i1<>i7) and (i1<>i8) and (i2<>i3) and (i2<>i4) and (i2<>i5) and
(i2<>i6) and (i2<>i7) and (i2<>i8)and (i3<>i4) and (i3<>i5) and (i3<>i6) and
(i3<>i7) and (i3<>i8) and (i4<>i5) and (i4<>i6) and (i4<>i7) and (i4<>i8) and
(i5<>i6) and (i5<>i7) and (i5<>i8)and (i6<>i7) and (i6<>i8) and (i7<>i8)
then writeln(f,u,A[i],A[i1],A[i2],A[i3],A[i4],A[i5],A[i6],A[i7],a[i8]);
end;
writeln('File ''Passlist'' pronto sul desktop!');writeln;
for i:=min to max do
begin
i7:=1;
for i6:=i downto 1 do i7:=i7*i6;
end;
writeln('Il numero di permutazoni senza ripetizione generate di ',max,' caratteri Š
',i7);
writeln('--------------------------------------------------------------------------------');
end;
end;
close(f);
end.
Santi Strati
4

Documenti analoghi

Newbies 4

Newbies 4 di raccogliere in un unico sito tutte le e-zine nostrane attinenti all'hacking e a tutte le varie forme di liberta' e

Dettagli

Newbies 4

Newbies 4 di raccogliere in un unico sito tutte le e-zine nostrane attinenti all'hacking e a tutte le varie forme di liberta' e

Dettagli