还原FinalShell已经保存的密码为明文

早上起来想在另外一个设备登录服务器,天塌了,服务器的连接密码完全记不起来了,因为平时都是软件保存了密码,密码设置得也比较复杂,久而久之完全不知道密码了,翻遍了所以记录密码的软件(bitwarden,手机记事本,聊天记录)都没有找到,无奈只能从连接工具(FinalShell)下手研究。

Tip

下面教程仅用于记录分享本次找回密码经历,方便遇到相同问题的人快速找到解决方法。

Note
  • 第一步
    先打开FinalShell导出选中的对应记录

  • 第二步
    导出后找到对应导出的文件,使用文件编辑器打开该json文件,复制password键对应的值。
    image
  • 第三部
    复制下面的java解密代码,把password值填到代码对应位置,然后运行该代码,如无异常控制台会打印出来你忘记的明文密码,记得把你忘记的密码多备份一下。
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Base64;
import java.util.Random;

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;

public class FinalShellDecodePass {
    public static void main(String[] args)throws Exception {
        System.out.println(decodePass("使用password值替换掉"));
    }
    public static byte[] desDecode(byte[] data, byte[] head) throws Exception {
        SecureRandom sr = new SecureRandom();
        DESKeySpec dks = new DESKeySpec(head);
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
        SecretKey securekey = keyFactory.generateSecret(dks);
        Cipher cipher = Cipher.getInstance("DES");
        cipher.init(2, securekey, sr);
        return cipher.doFinal(data);
    }
    public static String decodePass(String data) throws Exception {
        if (data == null) {
            return null;
        } else {
            String rs = "";
            byte[] buf = Base64.getDecoder().decode(data);
            byte[] head = new byte[8];
            System.arraycopy(buf, 0, head, 0, head.length);
            byte[] d = new byte[buf.length - head.length];
            System.arraycopy(buf, head.length, d, 0, d.length);
            byte[] bt = desDecode(d, ranDomKey(head));
            rs = new String(bt);

            return rs;
        }
    }
    static byte[] ranDomKey(byte[] head) {
        long ks = 3680984568597093857L / (long)(new Random((long)head[5])).nextInt(127);
        Random random = new Random(ks);
        int t = head[0];

        for(int i = 0; i < t; ++i) {
            random.nextLong();
        }

        long n = random.nextLong();
        Random r2 = new Random(n);
        long[] ld = new long[]{(long)head[4], r2.nextLong(), (long)head[7], (long)head[3], r2.nextLong(), (long)head[1], random.nextLong(), (long)head[2]};
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos);
        long[] var15 = ld;
        int var14 = ld.length;

        for(int var13 = 0; var13 < var14; ++var13) {
            long l = var15[var13];

            try {
                dos.writeLong(l);
            } catch (IOException var18) {
                var18.printStackTrace();
            }
        }

        try {
            dos.close();
        } catch (IOException var17) {
            var17.printStackTrace();
        }

        byte[] keyData = bos.toByteArray();
        keyData = md5(keyData);
        return keyData;
    }
    public static byte[] md5(byte[] data) {
        String ret = null;
        byte[] res=null;

        try {
            MessageDigest m;
            m = MessageDigest.getInstance("MD5");
            m.update(data, 0, data.length);
            res=m.digest();
            ret = new BigInteger(1, res).toString(16);
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return res;
    }
}

考虑到不是所有都安装了Java环境,下面提供一个菜鸟教程的在线运行的工具,主打一个方便快捷

原创文章,作者:mantou,如若转载,请注明出处:https://v2ez.com/1577.html

(0)
mantoumantou
上一篇 2025年11月29日
下一篇 2025年12月15日

相关推荐

  • 电话号码转 Emoji & Unicode 数字-在运营中巧妙的发送手机号码

    好消息,在某书🍠,某音🎶,某鱼🐟做营销发电话号码容易被风控怎么办? 快来试试我写的工具,好兄弟搞营销,或者嫂子弟妹做线上运营指定能用的到。 有其它需求欢迎留言,我有空了就喜欢写小玩…

    2023年8月23日
  • WordPress优化方案

    WordPress由于是国外团队开发的程序,所以在国内需要一些优化才能速度最快,这儿提供一些优化方案,帮助大家达到速度最快。 选择一个优化的主题 很多主题都有屏蔽的功能,例如本站开…

    2021年3月4日
  • 《随便扫》支持用户自定义跳转规则,打造专属扫码跳转工具

    《随便扫》简介 随便扫,一个智能二维码扫描跳转工具,根据扫描的二维码结果,跳转打开匹配的应用。 [极速扫描] 二维码一扫就开,无需等待。 [历史记录] 记录历史扫码记录。 [自定义…

    2023年9月15日
  • Windows 快捷启动工具

    软件是用 Electron 做的,轻喷。。。 闲来无事做的,正好自己有这个需求,就做个这么一个软件,我是做 Java 后端的,没搞过桌面端,所以用了 Electron ,开发速度确…

    2022年12月23日
  • Clibrary:基于Z-Library的电子书下载网站

    去年11月份的时候“Zlibrary”被美国警方查封,一度关停。 Zlibrary被美国警方查封,现官方所有地址无法访问 后来陆续开放网址,现在基本恢复访问 在“Zlibrary”…

    2023年3月31日
  • 如何做MTR双向测试

    雙向MTR測速: 去程(從你本地電腦到VPS):如果你是Windows電腦的話,請你下載 WinMTR: https://sourceforge.net/projects/winm…

    2025年7月26日
  • 视频播放器 PotPlayer 230905(1.7.21998) 去广告绿色版

    介绍 PotPlayer,免费全能影音播放器,Windows平台最强本地视频播放器。这款多媒体播放器支持硬件解码,内置强大的解码器、滤镜/分离器,对字幕的支持非常优秀,能够兼容特效…

    2023年9月7日
  • 人工智能

    近期,波士顿动力在机器人领域的成绩成为人们关注的焦点,其产品机器狗Spot和双足类人机器人Atlas都令人惊叹。 Spot 非常先进,它可以去你告诉它去的地方,避开障碍物,并在极端…

    2022年12月23日
  • 正确使用 Google 搜索的姿势

    前言 混迹互联网怎么可能少了搜索,说起搜索又不得不说起万能的 Google,熟练的使用谷歌搜索,提高工作效率,下面 Mark 就带大家学习搜索的进阶知识。 基础搜索   …

    工具软件 2022年10月30日
  • 10 年的音乐播放器,第 11 年有了 AI 加持!

    有图有真相!  AI 功能也得有个图 ~  接着说说有啥特性 稳定、易用: 一键安装,各流行平台均有打包(如 Arch Linux, Windows, macOS 等) 有各媒体资…

    2025年2月7日

发表回复

登录后才能评论