-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathdecode_remmina.pl
More file actions
executable file
·53 lines (49 loc) · 1.61 KB
/
decode_remmina.pl
File metadata and controls
executable file
·53 lines (49 loc) · 1.61 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl -w
# author: A.Lepe
# created: 2016-04-04
# Install (eg. using cpan):
# Crypt::CBC, Crypt::DES_EDE3, MIME::Base64, File::Slurp
use strict;
use warnings;
use Crypt::CBC;
use MIME::Base64;
use File::Slurp;
my $remmina_dir = $ENV{"HOME"} . "/.remmina";
my $remmina_cfg = $remmina_dir . "/remmina.pref";
my $content = read_file($remmina_cfg);
if($content) {
my ($secret) = $content =~ /^secret=(.*)/m;
if($secret) {
my $secret_bin = decode_base64($secret);
my ($key, $iv) = ( $secret_bin =~ /.{0,24}/gs );
my @files = <$remmina_dir/*.remmina>;
my $des = Crypt::CBC->new(
-cipher=>'DES_EDE3',
-key=>$key,
-iv=>$iv,
-header=>'none',
-literal_key=>1,
-padding=>'null'
);
if(@files > 0) {
foreach my $file (@files) {
my $config = read_file($file);
my ($password) = $config =~ /password=(.*)/m;
my ($name) = $config =~ /^name=(.*)/m;
my ($host) = $config =~ /^server=(.*)/m;
my ($user) = $config =~ /username=(.*)/m;
my $pass_bin = decode_base64($password);
my $pass_plain = $des->decrypt( $pass_bin );
if($pass_plain) {
print "$name $host $user $pass_plain\n";
}
}
} else {
print "Unable to find *.remmina files \n";
}
} else {
print "No secret key found...\n";
}
} else {
print "Unable to read content from remmina.pref\n";
}