perl script for radon secure password
发布时间:2020-12-15 20:54:45 所属栏目:大数据 来源:网络整理
导读:This is my first Perl script used for daily work,record and make some explanation here. ? [code] ? #!/usr/bin/perl ? use strict; use warnings; use Getopt::Long; Getopt::Long::Configure ("bundling"); ? if ($#ARGV ? 0 || $#ARGV 0 || $ARGV[0]
This is my first Perl script used for daily work,record and make some explanation here.
?
[code]
?#!/usr/bin/perl
?
use strict;
use warnings;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
?
if ($#ARGV? > 0 || $#ARGV < 0 || $ARGV[0] !~ /^[0-9]+$/) {
??????? print "nUsage:tOnly 1 numberic argument is ok.nn";
??????? exit;
}
?
sub GetRandNum() {
??????? my $lower=33;
??????? my $upper=126;
??????? my $random = int(rand( $upper-$lower+1 )) + $lower;
??????? return $random;
}
?
my $pwdlen=$ARGV[0];
my $count=0;
my $password="";
?
while ($count < $pwdlen) {
my $num=GetRandNum();
$password=$password.chr($num);
$count ++;
}
?
print "$passwordn";
[/code]
?
Since this script is very simple,I won’t comment in it. Just list some points:
?
Some output paste here:
?
[user@host perl]$./test1.pl
Usage:? Only 1 numberic argument is ok. [user@host perl]$./test1.pl 8 jMe=aoM( [user@host perl]$./test1.pl 8 9 Usage:? Only 1 numberic argument is ok. [user@host perl]$./test1.pl a Usage:? Only 1 numberic argument is ok. ?
This script also has some points can be improved,such as choosing certain types of character not including in the password string. Anyway this is my first useful perl script and just version 1,I’ll update it if needed.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |