Advertisement
Guest User

Untitled

a guest
Nov 9th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5. use Crypt::CBC; #Crypt::DES_EDE3
  6. use MIME::Base64;
  7. use File::Slurp;
  8.  
  9. my $remmina_dir = $ENV{"HOME"} . "/.remmina";
  10. my $remmina_cfg = $remmina_dir . "/remmina.pref";
  11.  
  12. my $content = read_file($remmina_cfg);
  13. if($content) {
  14. my ($secret) = $content =~ /^secret=(.*)/m;
  15. if($secret) {
  16. my $secret_bin = decode_base64($secret);
  17. my ($key, $iv) = ( $secret_bin =~ /.{0,24}/gs );
  18. my @files = <$remmina_dir/*.remmina>;
  19.  
  20. my $des = Crypt::CBC->new(
  21. -cipher=>'DES_EDE3',
  22. -key=>$key,
  23. -iv=>$iv,
  24. -header=>'none',
  25. -literal_key=>1,
  26. -padding=>'null'
  27. );
  28. if(@files > 0) {
  29. foreach my $file (@files) {
  30. my $config = read_file($file);
  31. my ($password) = $config =~ /^password=(.*)/m;
  32. my ($name) = $config =~ /^name=(.*)/m;
  33. my ($host) = $config =~ /^server=(.*)/m;
  34. my ($user) = $config =~ /^username=(.*)/m;
  35. my $pass_bin = decode_base64($password);
  36. my $pass_plain = $des->decrypt( $pass_bin );
  37. if($pass_plain) {
  38. print "$name $host $user $pass_plain\n";
  39. }
  40. }
  41. } else {
  42. print "Unable to find *.remmina files \n";
  43. }
  44. } else {
  45. print "No secret key found...\n";
  46. }
  47. } else {
  48. print "Unable to read content from remmina.pref\n";
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement