我忘记了其中一台服务器的密码。我保存了一个可用的连接,想从中获取密码。
来自 Remmina 常见问题解答:
问:我的密码是如何存储的?它们安全吗?
答:它们是使用 3DES 加密的,使用 256 位随机生成的密钥。您应该妥善保管密钥。
那么我从哪里获得密钥以及密码存储在哪里?
编辑:好的,发现它们就在 .remmina 下的用户主文件夹中。两个私钥都是 base64 格式的,解密时我似乎无法正确输入密码……
答案1
我能够使用 @michaelcochez 的 Go 解决方案通过 Python 对其进行解密:
Python 3:
首先pycryptodome
使用 pip 安装:
pip install pycryptodome
import base64
from Crypto.Cipher import DES3
secret = base64.b64decode(b'<STRING FROM remmina.prefs>')
password = base64.b64decode(b'<STRING FROM XXXXXXX.remminaa>')
print(DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password).decode('utf-8'))
原始 Python 2 答案
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)
答案2
它们存储在 Gnome-Keyring 中。
Dash->输入“keys”->密码和密钥。
在较新版本的 seahorse(又名“密码和密钥”)中,必须选择“查看”->“显示任意”才能查看密钥。搜索“remmina”。
答案3
我在一个名为的文件中找到了密钥~/.remmina/remmina.prefs
,加密的密码在中~/.remmina/nnnnnnnnnnn.remmina
。
我写了一个代码(在 Go 中)可用于解密:
//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。
答案4
我编写了一个脚本,可以自动解密你的密码文件。最新版本位于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]