代码拉取完成,页面将自动刷新
同步操作将从 InfoHunter/SEnginx 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/perl
use strict;
use warnings;
use Digest::MD5 qw(md5_hex);
use File::Find;
use Getopt::Std;
use vars qw($opt_d $opt_o $opt_v $opt_h);
use Cwd qw(abs_path);
no warnings 'File::Find';
getopts('d:o:vh');
my $usage = "Usage: $0 -d \"directories\" -o output_file [-v]";
if (defined $opt_h) {
print "$usage\n";
exit 0;
}
defined $opt_d or die "parameter error.\n$usage\n";
defined $opt_o or die "parameter error.\n$usage\n";
my @input_dir = split / /, $opt_d;
my @abs_input_dir = map {abs_path($_)} @input_dir;
my $output_file = abs_path($opt_o);
my $verbose = $opt_v;
my %result;
my $count = 0;
my @keys;
open OUTPUT, ">$output_file" or die "Can't open $output_file for write\n";
find(\&calc, @abs_input_dir);
@keys = keys %result;
foreach (@keys) {
print OUTPUT $_, "\x01", $result{$_}, "\n";
}
close OUTPUT;
print "Done: $count records have been written into $output_file.\n";
0;
sub calc {
my $file;
my $hash_value;
if (-d $_) {
return;
}
$file = $File::Find::name;
!defined $verbose or print "Processing: $file ... ";
# calc the md5sum of this file
if (!open READ, "<$file") {
!defined $verbose or print "Can't open this file, skip\n";
return;
}
$hash_value = md5_hex(<READ>);
if (defined($hash_value)) {
!defined $verbose or print "MD5: $hash_value\n";
} else {
!defined $verbose or print "Can't read this file, skip\n";
close READ;
return;
}
close READ;
$result{$file} = $hash_value;
$count++;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。