finalshell查看连接远程linux的用户名和密码

2023-12-10 08:38

本文主要是介绍finalshell查看连接远程linux的用户名和密码,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

使用finalshell去连接linux,由于用户名和密码输入一次后,下次finalshell会替我们记住密码。接着,时间久了,密码忘了。
以mac为例,密码存放在/Users/$USER/Library/FinalShell/conn文件中,密码以密文形式保存。比如我的主机名叫"shuangyueliao.cn",查看主机对应密码,在conn目录下执行
grep -rni "shuangyueliao.cn" *
在这里插入图片描述
把密码放到下面文件中s1位置并执行,就能得到解密后的密码

pom.xml文件

		<dependency><groupId>commons-codec</groupId><artifactId>commons-codec</artifactId><version>1.15</version></dependency>

Test.java

//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//package com.shuang;import org.apache.commons.codec.digest.DigestUtils;import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.SecureRandom;
import java.util.Random;public class Test {
//    private static final String OO0O00OO00OOOOOO0000O0O000O0O0000OOOO00OO000OO0000OO000000O00O0O000OO00O0O000O00O0O00OOOOOO0OOO0 = "DES";public static long number = 3680984568597093857L;private static int num = 8;public static void main(String[] args) throws Exception {
//        String content = "sdsfew1tf45r1g3";
//        String s1 = encode(content);// 加密后的密码String s1 = "***********************";String s2 = decode(s1);System.out.println(s1);System.out.println(s2);}public static String decode(String data) throws IOException, Exception {if (data == null) {return null;} else {String rs = "";if (!fff(data)) {byte[] buf = ggg(data);byte[] head = new byte[num];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 = jjj(d, kkk(head));rs = new String(bt);}return rs;}}public static String encode(String content) throws Exception {byte[] head = aaa(num);byte[] d = bbb(content.getBytes("utf-8"), head);byte[] result = new byte[head.length + d.length];System.arraycopy(head, 0, result, 0, head.length);System.arraycopy(d, 0, result, head.length, d.length);String rs = ccc(result);return rs;}static byte[] aaa(int len) {byte[] data = new byte[len];for(int i = 0; i < len; ++i) {data[i] = (byte)(new Random()).nextInt(127);}return data;}public static byte[] bbb(byte[] data, byte[] head) throws Exception {SecureRandom sr = new SecureRandom();DESKeySpec dks = new DESKeySpec(kkk(head));SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");SecretKey securekey = keyFactory.generateSecret(dks);Cipher cipher = Cipher.getInstance("DES");cipher.init(1, securekey, sr);return cipher.doFinal(data);}public static String ccc(byte[] byteData) throws UnsupportedEncodingException {return ddd(byteData, "UTF-8");}public static String ddd(byte[] byteData, String encoding) throws UnsupportedEncodingException {if (byteData == null) {throw new IllegalArgumentException("byteData cannot be null");} else {return new String(eee(byteData), encoding);}}public static final byte[] eee(byte[] byteData) {if (byteData == null) {throw new IllegalArgumentException("byteData cannot be null");} else {byte[] byteDest = new byte[(byteData.length + 2) / 3 * 4];int iSrcIdx = 0;int iDestIdx;for(iDestIdx = 0; iSrcIdx < byteData.length - 2; iSrcIdx += 3) {byteDest[iDestIdx++] = (byte)(byteData[iSrcIdx] >>> 2 & 63);byteDest[iDestIdx++] = (byte)(byteData[iSrcIdx + 1] >>> 4 & 15 | byteData[iSrcIdx] << 4 & 63);byteDest[iDestIdx++] = (byte)(byteData[iSrcIdx + 2] >>> 6 & 3 | byteData[iSrcIdx + 1] << 2 & 63);byteDest[iDestIdx++] = (byte)(byteData[iSrcIdx + 2] & 63);}if (iSrcIdx < byteData.length) {byteDest[iDestIdx++] = (byte)(byteData[iSrcIdx] >>> 2 & 63);if (iSrcIdx < byteData.length - 1) {byteDest[iDestIdx++] = (byte)(byteData[iSrcIdx + 1] >>> 4 & 15 | byteData[iSrcIdx] << 4 & 63);byteDest[iDestIdx++] = (byte)(byteData[iSrcIdx + 1] << 2 & 63);} else {byteDest[iDestIdx++] = (byte)(byteData[iSrcIdx] << 4 & 63);}}for(iSrcIdx = 0; iSrcIdx < iDestIdx; ++iSrcIdx) {if (byteDest[iSrcIdx] < 26) {byteDest[iSrcIdx] = (byte)(byteDest[iSrcIdx] + 65);} else if (byteDest[iSrcIdx] < 52) {byteDest[iSrcIdx] = (byte)(byteDest[iSrcIdx] + 97 - 26);} else if (byteDest[iSrcIdx] < 62) {byteDest[iSrcIdx] = (byte)(byteDest[iSrcIdx] + 48 - 52);} else if (byteDest[iSrcIdx] < 63) {byteDest[iSrcIdx] = 43;} else {byteDest[iSrcIdx] = 47;}}while(iSrcIdx < byteDest.length) {byteDest[iSrcIdx] = 61;++iSrcIdx;}return byteDest;}}public static boolean fff(String str) {if (str == null) {return true;} else {String s2 = str.trim();return s2.equals("");}}public static final byte[] ggg(String encoded) throws UnsupportedEncodingException {return hhh(encoded, "UTF-8");}public static final byte[] hhh(String encoded, String encoding) throws IllegalArgumentException, UnsupportedEncodingException {if (encoded == null) {throw new IllegalArgumentException("encoded cannot be null");} else {return iii(encoded.getBytes(encoding));}}public static final byte[] iii(byte[] byteData) throws IllegalArgumentException {if (byteData == null) {throw new IllegalArgumentException("byteData cannot be null");} else {byte[] byteTemp = new byte[byteData.length];int reviSrcIdx;for(reviSrcIdx = byteData.length; reviSrcIdx - 1 > 0 && byteData[reviSrcIdx - 1] == 61; --reviSrcIdx) {}if (reviSrcIdx - 1 == 0) {return null;} else {byte[] byteDest = new byte[reviSrcIdx * 3 / 4];int iSrcIdx;for(iSrcIdx = 0; iSrcIdx < reviSrcIdx; ++iSrcIdx) {if (byteData[iSrcIdx] == 43) {byteTemp[iSrcIdx] = 62;} else if (byteData[iSrcIdx] == 47) {byteTemp[iSrcIdx] = 63;} else if (byteData[iSrcIdx] < 58) {byteTemp[iSrcIdx] = (byte)(byteData[iSrcIdx] + 52 - 48);} else if (byteData[iSrcIdx] < 91) {byteTemp[iSrcIdx] = (byte)(byteData[iSrcIdx] - 65);} else if (byteData[iSrcIdx] < 123) {byteTemp[iSrcIdx] = (byte)(byteData[iSrcIdx] + 26 - 97);}}iSrcIdx = 0;int iDestIdx;for(iDestIdx = 0; iSrcIdx < reviSrcIdx && iDestIdx < byteDest.length / 3 * 3; iSrcIdx += 4) {byteDest[iDestIdx++] = (byte)(byteTemp[iSrcIdx] << 2 & 252 | byteTemp[iSrcIdx + 1] >>> 4 & 3);byteDest[iDestIdx++] = (byte)(byteTemp[iSrcIdx + 1] << 4 & 240 | byteTemp[iSrcIdx + 2] >>> 2 & 15);byteDest[iDestIdx++] = (byte)(byteTemp[iSrcIdx + 2] << 6 & 192 | byteTemp[iSrcIdx + 3] & 63);}if (iSrcIdx < reviSrcIdx) {if (iSrcIdx < reviSrcIdx - 2) {byteDest[iDestIdx++] = (byte)(byteTemp[iSrcIdx] << 2 & 252 | byteTemp[iSrcIdx + 1] >>> 4 & 3);byteDest[iDestIdx++] = (byte)(byteTemp[iSrcIdx + 1] << 4 & 240 | byteTemp[iSrcIdx + 2] >>> 2 & 15);} else {if (iSrcIdx >= reviSrcIdx - 1) {throw new IllegalArgumentException("Warning: 1 input bytes left to process. This was not Base64 input");}byteDest[iDestIdx++] = (byte)(byteTemp[iSrcIdx] << 2 & 252 | byteTemp[iSrcIdx + 1] >>> 4 & 3);}}return byteDest;}}}public static byte[] jjj(byte[] data, byte[] key) throws Exception {SecureRandom sr = new SecureRandom();DESKeySpec dks = new DESKeySpec(key);SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");SecretKey securekey = keyFactory.generateSecret(dks);Cipher cipher = Cipher.getInstance("DES");cipher.init(2, securekey, sr);return cipher.doFinal(data);}static byte[] kkk(byte[] head) {long ks = number / (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 = DigestUtils.md5(keyData);return keyData;}
}

这篇关于finalshell查看连接远程linux的用户名和密码的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/476593

相关文章

linux hostname设置全过程

《linuxhostname设置全过程》:本文主要介绍linuxhostname设置全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录查询hostname设置步骤其它相关点hostid/etc/hostsEDChina编程A工具license破解注意事项总结以RHE

Mysql实现范围分区表(新增、删除、重组、查看)

《Mysql实现范围分区表(新增、删除、重组、查看)》MySQL分区表的四种类型(范围、哈希、列表、键值),主要介绍了范围分区的创建、查询、添加、删除及重组织操作,具有一定的参考价值,感兴趣的可以了解... 目录一、mysql分区表分类二、范围分区(Range Partitioning1、新建分区表:2、分

Linux中压缩、网络传输与系统监控工具的使用完整指南

《Linux中压缩、网络传输与系统监控工具的使用完整指南》在Linux系统管理中,压缩与传输工具是数据备份和远程协作的桥梁,而系统监控工具则是保障服务器稳定运行的眼睛,下面小编就来和大家详细介绍一下它... 目录引言一、压缩与解压:数据存储与传输的优化核心1. zip/unzip:通用压缩格式的便捷操作2.

Spring Security中用户名和密码的验证完整流程

《SpringSecurity中用户名和密码的验证完整流程》本文给大家介绍SpringSecurity中用户名和密码的验证完整流程,本文结合实例代码给大家介绍的非常详细,对大家的学习或工作具有一定... 首先创建了一个UsernamePasswordAuthenticationTChina编程oken对象,这是S

一文详解Git中分支本地和远程删除的方法

《一文详解Git中分支本地和远程删除的方法》在使用Git进行版本控制的过程中,我们会创建多个分支来进行不同功能的开发,这就容易涉及到如何正确地删除本地分支和远程分支,下面我们就来看看相关的实现方法吧... 目录技术背景实现步骤删除本地分支删除远程www.chinasem.cn分支同步删除信息到其他机器示例步骤

Linux中SSH服务配置的全面指南

《Linux中SSH服务配置的全面指南》作为网络安全工程师,SSH(SecureShell)服务的安全配置是我们日常工作中不可忽视的重要环节,本文将从基础配置到高级安全加固,全面解析SSH服务的各项参... 目录概述基础配置详解端口与监听设置主机密钥配置认证机制强化禁用密码认证禁止root直接登录实现双因素

MySQL中的表连接原理分析

《MySQL中的表连接原理分析》:本文主要介绍MySQL中的表连接原理分析,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、背景2、环境3、表连接原理【1】驱动表和被驱动表【2】内连接【3】外连接【4编程】嵌套循环连接【5】join buffer4、总结1、背景

在Linux终端中统计非二进制文件行数的实现方法

《在Linux终端中统计非二进制文件行数的实现方法》在Linux系统中,有时需要统计非二进制文件(如CSV、TXT文件)的行数,而不希望手动打开文件进行查看,例如,在处理大型日志文件、数据文件时,了解... 目录在linux终端中统计非二进制文件的行数技术背景实现步骤1. 使用wc命令2. 使用grep命令

Linux如何快速检查服务器的硬件配置和性能指标

《Linux如何快速检查服务器的硬件配置和性能指标》在运维和开发工作中,我们经常需要快速检查Linux服务器的硬件配置和性能指标,本文将以CentOS为例,介绍如何通过命令行快速获取这些关键信息,... 目录引言一、查询CPU核心数编程(几C?)1. 使用 nproc(最简单)2. 使用 lscpu(详细信

linux重启命令有哪些? 7个实用的Linux系统重启命令汇总

《linux重启命令有哪些?7个实用的Linux系统重启命令汇总》Linux系统提供了多种重启命令,常用的包括shutdown-r、reboot、init6等,不同命令适用于不同场景,本文将详细... 在管理和维护 linux 服务器时,完成系统更新、故障排查或日常维护后,重启系统往往是必不可少的步骤。本文