/u is working
This commit is contained in:
parent
7dc08d0742
commit
f82196013f
18
II/Enc.pm
18
II/Enc.pm
@ -18,6 +18,24 @@ sub new {
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub decrypt {
|
||||
my ( $self, $file ) = @_;
|
||||
|
||||
open my $fh, "<", $file or die "Cannot open file $file: $!\n";
|
||||
my $message;
|
||||
while (<$fh>) {
|
||||
$message .= $_;
|
||||
}
|
||||
close $fh;
|
||||
|
||||
my @enc = split /:/, $message;
|
||||
|
||||
# Decrypt message
|
||||
my $dec = `echo "$enc[1]" | base64 -d`;
|
||||
|
||||
return $dec;
|
||||
}
|
||||
|
||||
sub encode {
|
||||
my ($self) = @_;
|
||||
my $config = $self->{_config};
|
||||
|
12
II/Get.pm
12
II/Get.pm
@ -2,6 +2,7 @@ package II::Get;
|
||||
use LWP::Simple;
|
||||
|
||||
use II::DB;
|
||||
use II::Enc;
|
||||
|
||||
use Data::Dumper;
|
||||
|
||||
@ -22,8 +23,8 @@ sub get_echo {
|
||||
|
||||
my $db = II::DB->new();
|
||||
|
||||
my $echo_url = 'e/';
|
||||
my $msg_url = 'm/';
|
||||
my $echo_url = 'u/e/';
|
||||
my $msg_url = 'u/m/';
|
||||
|
||||
my $msgs;
|
||||
foreach my $echo (@$echoareas) {
|
||||
@ -43,6 +44,7 @@ sub get_echo {
|
||||
or die "Cannot open file: $!\n";
|
||||
while (<$echo_fh>) {
|
||||
chomp($_);
|
||||
if ($_ =~ /.{20}/) {
|
||||
if ( !( -e "./msg/$_" ) ) {
|
||||
$msgs .= $_ . "\n";
|
||||
# @w_cmd = ( 'wget', '-O',
|
||||
@ -51,6 +53,7 @@ sub get_echo {
|
||||
# system(@w_cmd) == 0 or die "Cannot download file: $!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
close $echo_fh;
|
||||
|
||||
# }
|
||||
@ -62,7 +65,10 @@ sub get_echo {
|
||||
my @msg_list = split /\n/, $msgs;
|
||||
while (<@msg_list>) {
|
||||
my $mes_hash = $_;
|
||||
open my $m, "<", "./msg/$mes_hash"
|
||||
|
||||
my $text = II::Enc->decrypt("./msg/$mes_hash");
|
||||
|
||||
open my $m, "<", \$text
|
||||
or die "Cannot open message: $!\n";
|
||||
|
||||
my @mes;
|
||||
|
Loading…
Reference in New Issue
Block a user