如何从Remmina提取保存的密码?


32

我不记得我的一台服务器的密码。我保存了有效的连接,并希望从中获取密码。

来自Remmina常见问题解答:

问:我的密码如何存储?他们安全吗?
答:它们是使用带有随机生成的256位密钥的3DES加密的。您应该保持密钥安全。

那么,我在哪里获取密钥以及密码将存储在哪里?

编辑:确定发现它们只是位于.remmina下的用户主文件夹中。两个私钥都在base64中,解密时似乎无法正确获取密码……

Answers:


51

我能够使用@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)

3
对于原因,让我恨自己,我需要一个班轮:/: 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。下一次我可能会留在这里。
2013年

不错。.效果很好
user169015 '17

4
remmina的最新版本已更改这些文件的位置。现在,首选文件位于:$ HOME / .config / remmina /,并且单击连接时,连接文件在remmina的底部列出(例如:〜/ .local / share / remmina / 4823893432523.remmina)

3
谢谢你过去的自我,略作更新的单行代码需要两个参数的文件。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
凌晨

@admalledd您真的应该将其发布为答案!
迈克尔(Michael)

20

我在名为的文件中找到了密钥,~/.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。


14

它们存储在Gnome-Keyring中。

破折号->输入“密钥”->密码和密钥。

在较新版本的海马中(也称为“密码和密钥”),必须选择“查看”->“显示任意”以查看密钥。搜索“ remmina”。


1
已经尝试过了...我也正在使用lxde
linuxnewb

2
在某些情况下是这样。如果列出的密码~/.remmina/nnnnnnnnnnn.remmina仅为,请尝试此操作.
Kupiakos 2015年

11

我制作了一个脚本,该脚本会自动解密您的密码文件。最新版本位于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]

2

我创建了一个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_EDE3MIME::Base64File::Slurp

样本输出:

(名称,主机,用户,密码:制表符分隔)

Server1 192.168.1.25    administrator   jM822Azss2fake
Server2 192.168.1.88:2899   admin   JaxHaxFakez90

1

我需要反向操作并使用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
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.