Answers:
我能够使用@michaelcochez的Go解决方案通过Python对其进行解密:
import base64
from Crypto.Cipher import DES3
secret = base64.decodestring('<STRING FROM remmina.prefs>')
password = base64.decodestring('<STRING FROM XXXXXXX.remmina>')
print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)
python -c "import base64,sys;from Crypto.Cipher import DES3;pc=open(sys.argv[1]).read();pci=pc.index('secret=');secret=pc[pci:pc.index('\n',pci)].split('=',1)[1];cc=open(sys.argv[2]).read();cci=cc.index('password');password=cc[cci:cc.index('\n',cci)].split('=',1)[1];secret,password=base64.decodestring(secret),base64.decodestring(password); print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)" /tmp/remmina/remmina.pref /tmp/remmina/00000000000.remmina
我在名为的文件中找到了密钥,~/.remmina/remmina.prefs
并且加密的密码在~/.remmina/nnnnnnnnnnn.remmina
。
我写了一个代码可用于解密(围棋):
//Decrypts obfuscated passwords by Remmina - The GTK+ Remote Desktop Client
//written by Michael Cochez
package main
import (
"crypto/cipher"
"crypto/des"
"encoding/base64"
"fmt"
"log"
)
//set the variables here
var base64secret = "yoursecret"
var base64password = "theconnectionpassword"
//The secret is used for encrypting the passwords. This can typically be found from ~/.remmina/remmina.pref on the line containing 'secret='.
//"The encrypted password used for the connection. This can typically be found from /.remmina/dddddddddddd.remmina " on the line containing 'password='.
//Copy everything after the '=' sign. Also include final '=' signs if they happen to be there.
//returns a function which can be used for decrypting passwords
func makeRemminaDecrypter(base64secret string) func(string) string {
//decode the secret
secret, err := base64.StdEncoding.DecodeString(base64secret)
if err != nil {
log.Fatal("Base 64 decoding failed:", err)
}
if len(secret) != 32 {
log.Fatal("the secret is not 32 bytes long")
}
//the key is the 24 first bits of the secret
key := secret[:24]
//3DES cipher
block, err := des.NewTripleDESCipher(key)
if err != nil {
log.Fatal("Failed creating the 3Des cipher block", err)
}
//the rest of the secret is the iv
iv := secret[24:]
decrypter := cipher.NewCBCDecrypter(block, iv)
return func(encodedEncryptedPassword string) string {
encryptedPassword, err := base64.StdEncoding.DecodeString(encodedEncryptedPassword)
if err != nil {
log.Fatal("Base 64 decoding failed:", err)
}
//in place decryption
decrypter.CryptBlocks(encryptedPassword, encryptedPassword)
return string(encryptedPassword)
}
}
func main() {
if base64secret == "yoursecret" || base64password == "theconnectionpassword" {
log.Fatal("both base64secret and base64password variables must be set")
}
decrypter := makeRemminaDecrypter(base64secret)
fmt.Printf("Passwd : %v\n", decrypter(base64password))
}
该代码可以在线运行,但是您信任golang.org。
它们存储在Gnome-Keyring中。
破折号->输入“密钥”->密码和密钥。
在较新版本的海马中(也称为“密码和密钥”),必须选择“查看”->“显示任意”以查看密钥。搜索“ remmina”。
~/.remmina/nnnnnnnnnnn.remmina
仅为,请尝试此操作.
。
我制作了一个脚本,该脚本会自动解密您的密码文件。最新版本位于https://github.com/peppelinux/remmina_password_exposer。
#!/usr/bin/python
from Crypto.Cipher import DES3
import base64
import os
import re
from os.path import expanduser
home = expanduser("~")
# costanti :)
REMMINA_FOLDER = os.getenv('REMMINA_FOLDER', home+'/'+'.remmina/')
REMMINA_PREF = 'remmina.pref'
REGEXP_ACCOUNTS = r'[0-9]{13}\.remmina(.swp)?'
REGEXP_PREF = r'remmina.pref'
diz = {}
fs = open(REMMINA_FOLDER+REMMINA_PREF)
fso = fs.readlines()
fs.close()
for i in fso:
if re.findall(r'secret=', i):
r_secret = i[len(r'secret='):][:-1]
print 'found secret', r_secret
for f in os.listdir(REMMINA_FOLDER):
if re.findall(REGEXP_ACCOUNTS, f):
o = open( REMMINA_FOLDER+f, 'r')
fo = o.readlines()
o.close()
for i in fo:
if re.findall(r'password=', i):
r_password = i[len(r'password='):][:-1]
if re.findall(r'^name=', i):
r_name = i.split('=')[1][:-1]
if re.findall(r'username=', i):
r_username = i.split('=')[1][:-1]
#~ print fo
#~ print 'found', f
password = base64.decodestring(r_password)
secret = base64.decodestring(r_secret)
diz[r_name] = DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)
# print the username and password of the last decryption
print r_name, r_username, diz[r_name]
我创建了一个perl脚本来解码remmina密码。它提取您的密钥并解码所有保存的密码(本地)。
https://github.com/lepe/scripts/blob/master/decode_remmina.pl(检查更新版本)
#!/usr/bin/perl
use strict;
use warnings;
use Crypt::CBC; #Crypt::DES_EDE3
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";
}
您将需要安装这些软件包(例如,使用cpan <PACKAGE>
): ,Crypt::CBC
,,Crypt::DES_EDE3
MIME::Base64
File::Slurp
(名称,主机,用户,密码:制表符分隔)
Server1 192.168.1.25 administrator jM822Azss2fake
Server2 192.168.1.88:2899 admin JaxHaxFakez90
我需要反向操作并使用Python脚本为Remmina加密密码。万一有人需要,这里是代码:
import base64
from Crypto.Cipher import DES3
REMMINAPREF_SECRET_B64=b'G5XKhImmX+3MaRAWU920B31AtQLDcWEq+Geq4L+7sES='
def encryptRemminaPass(plain):
plain = plain.encode('utf-8')
secret = base64.b64decode(REMMINAPREF_SECRET_B64)
key = secret[:24]
iv = secret[24:]
plain = plain + b"\0" * (8 - len(plain) % 8)
cipher = DES3.new(key, DES3.MODE_CBC, iv)
result = cipher.encrypt(plain)
result = base64.b64encode(result)
result = result.decode('utf-8')
return result
python -c "import base64,sys;from Crypto.Cipher import DES3;pc=open('/home/admalledd/.remmina/remmina.pref').read();pci=pc.index('secret=');secret=pc[pci:pc.index('\n',pci)].split('=',1)[1];cc=open(sys.argv[1]).read();cci=cc.index('password');password=cc[cci:cc.index('\n',cci)].split('=',1)[1];secret,password=base64.decodestring(secret),base64.decodestring(password); print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password)" .remmina/1474332312568.remmina
。下一次我可能会留在这里。