[Perl] birthday password dict v1.0

作者:reistlin 发布时间:June 30, 2010 分类:原创文章

作者: reistlin
来源: http://www.reistlin.com/blog/26
更新时间: 2010.06
版权声明: 原创文章.转载请保留作者信息和原文完整.谢绝任何方式的摘要

perl.gif

[下载] 1950年1月1日 - 2010年12月31日 [passwd.rar]

googlecode1.gifgooglecode2.gif
[https://reistlin.googlecode.com/svn/trunk/birthday_password_dict.pl]

#!/usr/bin/perl -w 
 
# Name: birthday password dict v1.0
# Author: reistlin
# Website: www.reistlin.com
# Hotfix: bigyong
# Website: www.bigyong.com
# Date: 2010.06.30
 
use strict;
use Data::Dumper;
 
# Debug Switch
my $debug = 0;
# start time
my $time_1 = time();
# clear
system "clear";
 
my $year_local;
my $year_start;
my @year_array;
 
# defined year revised (60 year ago) 
my $year_revised = 60;
# defined result file 
my $result_file = "passwd.lis";
# defined result count
my $result_count = 0;
 
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year_local = $year + 1900;
$year_start = $year_local - $year_revised;
 
# short year
my $year_short = substr $year_start, 2, 2;
for (; $year_short <= $year; $year_short++) {
	my $length = length ($year_short);
        if ($length > 2) {
		push (@year_array, (substr $year_short, $length - 2, 2));
	} else {
		push (@year_array, $year_short);
	}
}
 
# loop object
my @default_year = ("$year_start" .. "$year_local", @year_array);
my @default_month = ("1" .. "12", "01" .. "12");
my @default_day = ("1" .. "31", "01" .. "31");
 
# open result file
open (IN, "+>" . $result_file);
 
# save to result file
for (my $index_year=0; $index_year < @default_year; $index_year++) {
	for (my $index_month=0; $index_month < @default_month; $index_month++) {
		for (my $index_day=0; $index_day < @default_day; $index_day++) {
			print IN "$default_year[$index_year]$default_month[$index_month]$default_day[$index_day]\n";	
			$result_count++;
		}
	}
}
 
# check result file
if (-e $result_file) {
	print "[INFO] Success \[$result_file\] Saved ... \n";
}
 
# result file details
my @result_stat = stat ($result_file);
print "[INFO] Passwd Size: $result_stat[7] bytes \n";
print "[INFO] Passwd Count: $result_count \n";
 
# end time
my $time_2 = time();
my $time = $time_2 - $time_1;
# script runtime
print "[INFO] Runtime \[$time\] Second ... \n";
print "[INFO] End! Good Luck! :-) \n";

标签: perl

评论已关闭