Generador de contraseñas en perl

Un simple generador de contraseñas


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!usr/bin/perl
#Gen Password (C) Doddy Hackman 2011
 
use Tk;
 
if ($^O eq 'MSWin32') {
use Win32::Console; 
Win32::Console::Free();
}
 
my $sin = MainWindow->new();
$sin->title("Gen Password (C) Doddy Hackman 2011");
$sin->geometry("530x80+20+20");
$sin->resizable(0,0);
 
$sin->Label(-text=>"Result : ",-font=>"Impact1")->place(-x=>30,-y=>20);
my $rex = $sin->Text(-width=>28,-height=>1)->place(-y=>24,-x=>90);
$sin->Label(-text=>"Length : ",-font=>"Impact1")->place(-x=>310,-y=>20);
my $leng = $sin->Entry(-width=>3,-text=>3)->place(-y=>24,-x=>370);
$sin->Button(-text=>"Generate",-command=>\&gen,-width=>12)->place(-y=>22,-x=>410);
 
MainLoop;
 
 
sub gen {
 
$rex->delete("0.0","end");
my $ala = $leng->get;
 
my @password = genpass($ala);
for $pass(@password) {
$rex->insert("end",$pass);
}}
 
sub genpass {
 
my $length = shift;
 
my @re;
 
my @mayus = (A..Z);
my @minus = (a..z);
my @number = (0..9);
my @op = (1..3);
 
for (1..$length) {
 
my $opt = @op[rand(@op)];
if ($opt eq 1) {
push(@re,@mayus[rand(@mayus)]);
}
elsif ($opt eq 2) {
push(@re,@minus[rand(@minus)]);
}
elsif ($opt eq 3) {
push(@re,@number[rand(@number)]);
}
}
return @re;
}
 
#Thanks to explorer (perlenespanol)
# ¿ The End ? 

0 comentarios: sobre Generador de contraseñas en perl

Publicar un comentario para Generador de contraseñas en perl

:a   :b   :c   :d   :e   :f   :g   :h   :i   :j   :k   :l   :m   :n   :o   :p   :q   :r   :s   :t

Calculando Tiempo
Alienspace Theme © Copyright 2017 By Proxor
Mi Ping en TotalPing.com FeedBurner FeedBurner FeedBurner FeedBurner FeedBurner