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
|
#!/usr/bin/perl -w
use lib '/usr/share/movabletype/extlib';
use MT::App::Comments;
use MT;
$mt = new MT;
sub usage {
print <<HERE;
Usage: sig-validate [email::name::nick::ts::token] [r::s]
[] brackets are optional
r and s are the fields of the signature
HERE
exit(1);
}
$ARGV[0] or usage();
$ARGV[1] or usage();
$ARGV[0] =~ s/^[(.*)]$/$1/;
$ARGV[1] =~ s/^[(.*)]$/$1/;
my ($email, $name, $nick, $ts, $token) = split '::', $ARGV[0];
my $validation = MT::App::Comments::_validate_signature($mt,
$ARGV[1],
email => $email,
name => $name,
nick => $nick,
ts => $ts,
token => $token);
print "The signature with timestamp together are: ",
$validation ? "VALID" : "invalid", "\n";
|