保存在FinalShell服務器登錄密碼忘記了,如何快速獲取到

一、從FinalShell獲取服務器基本信息

如圖操作會導出一個json文件,可以直接保存在桌面,或者其他位置

json格式如下:

{"forwarding_auto_reconnect":false
,"custom_size":false
,"delete_time":0
,"secret_key_id":""
,"user_name":"root"
,"remote_port_forwarding":{}
,"conection_type":100
,"sort_time":0
,"description":""
,"proxy_id":"0"
,"authentication_type":1
,"drivestoredirect":true
,"delete_key_sequence":0
,"password":"xE4F2Pi13TnbkO8vo6wwmQNbqB77PUeI"
,"modified_time":1700460445433
,"host":"x.xx.xx.xx"
,"accelerate":false
,"id":"sn1xqbrr5womw787"
,"height":0
,"order":0
,"create_time":1700460445433
,"port_forwarding_list":[]
,"parent_update_time":0
,"rename_time":0
,"backspace_key_sequence":2
,"fullscreen":false
,"port":22
,"terminal_encoding":"UTF-8"
,"parent_id":"root"
,"exec_channel_enable":true
,"width":0
,"name":"xx.xx.xx.xx"
,"access_time":1719895278353}

二、代碼讀取并解析獲取賬號明文信息

package com.base.info.controller;import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;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.File;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.*;public class FinalShellDecodePass {public static void main(String[] args) throws Exception {// 獲取finalshell的所有json數據,json數據所在文件夾File file = new File("C:\\Users\\12118\\Desktop"); //我的放在桌面了,如果json文件在其他位置,需要更改為對應路徑// 獲取所有的json文件File[] files = file.listFiles(pathname -> "json".equalsIgnoreCase(FilenameUtils.getExtension(pathname.getName())));// 主要信息: ip/端口/用戶名/密碼List<Map<String, Object>> infoList = new ArrayList<>(files.length);for (File jsonFile : files) {String s = FileUtils.readFileToString(jsonFile);FinalShellConfig shellConfig = JSON.parseObject(s, FinalShellConfig.class);// 密文改明文String password = shellConfig.getPassword();if (StringUtils.isNotBlank(password)) {shellConfig.setPassword(decodePass(password));}String s1 = JSON.toJSONString(shellConfig);System.err.println(s1);Map<String, Object> map = new LinkedHashMap<>();map.put("主機", shellConfig.getHost());map.put("端口", shellConfig.getPort());map.put("用戶名", shellConfig.getUserName());map.put("密碼", shellConfig.getPassword());infoList.add(map);}for (Map<String, Object> stringObjectMap : infoList) {System.err.println(JSON.toJSONString(stringObjectMap));}}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;}@NoArgsConstructor@Datastatic class FinalShellConfig {@JsonProperty("forwarding_auto_reconnect")private Boolean forwardingAutoReconnect;@JsonProperty("custom_size")private Boolean customSize;@JsonProperty("delete_time")private Integer deleteTime;@JsonProperty("secret_key_id")private String secretKeyId;@JsonProperty("user_name")private String userName;@JsonProperty("conection_type")private Integer conectionType;@JsonProperty("sort_time")private Integer sortTime;@JsonProperty("description")private String description;@JsonProperty("proxy_id")private String proxyId;@JsonProperty("authentication_type")private Integer authenticationType;@JsonProperty("drivestoredirect")private Boolean drivestoredirect;@JsonProperty("delete_key_sequence")private Integer deleteKeySequence;@JsonProperty("password")private String password;@JsonProperty("modified_time")private Long modifiedTime;@JsonProperty("host")private String host;@JsonProperty("accelerate")private Boolean accelerate;@JsonProperty("id")private String id;@JsonProperty("height")private Integer height;@JsonProperty("order")private Integer order;@JsonProperty("create_time")private Long createTime;@JsonProperty("port_forwarding_list")private List<?> portForwardingList;@JsonProperty("parent_update_time")private Integer parentUpdateTime;@JsonProperty("rename_time")private Long renameTime;@JsonProperty("backspace_key_sequence")private Integer backspaceKeySequence;@JsonProperty("fullscreen")private Boolean fullscreen;@JsonProperty("port")private Integer port;@JsonProperty("terminal_encoding")private String terminalEncoding;@JsonProperty("parent_id")private String parentId;@JsonProperty("exec_channel_enable")private Boolean execChannelEnable;@JsonProperty("width")private Integer width;@JsonProperty("name")private String name;@JsonProperty("access_time")private Long accessTime;}
}

三、執行main方法,獲取信息

這樣就獲取到了!

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/39211.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/39211.shtml
英文地址,請注明出處:http://en.pswp.cn/web/39211.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Python數據分析-舊金山犯罪預測分析(San Francisco Crime Classification)

一、研究背景 舊金山是一個人口稠密、旅游業發達的城市&#xff0c;同時也是美國犯罪率較高的城市之一。隨著城市的不斷發展&#xff0c;犯罪行為的類型和頻率也在不斷變化&#xff0c;這對城市的治安管理和社會穩定構成了巨大的挑戰。近年來&#xff0c;數據科學技術的迅猛發…

xmind導入導出支持圖片功能源碼改造

xmind導入導出支持圖片功能 在開發用例管理平臺的過程中&#xff0c;需要使用xmind來管理用例。所以也涉及到xmind用例的導入導出功能&#xff0c; 在開始的時候&#xff0c;xmind文件中沒有圖片&#xff0c;所以使用xmind,xmindparser包就可以完成改任務。現在新增需求&#x…

C# 編程中互斥鎖的使用

C# 中的互斥鎖 互斥鎖是 C# 中使用的同步原語&#xff0c;用于控制多個線程或進程對共享資源的訪問。其目的是確保在任何給定時間只有一個線程或進程可以獲取互斥鎖&#xff0c;從而提供互斥。 C# 中互斥鎖的優點 可以使用互斥鎖 (Mutex) 并享受其帶來的好處。 1. 共享資源…

德國威步的技術演進之路(下):從云端許可管理到硬件加密狗的創新

從單機用戶許可證到WkNET網絡浮點授權的推出&#xff0c;再到引入使用次數和豐富的時間許可證管理&#xff0c;德國威步產品不斷滿足市場對靈活性和可擴展性的需求。TCP/IP浮動網絡許可證進一步展示了威步技術在網絡時代的創新應用。借助于2009年推出的借用許可證以及2015年推出…

mac磁盤工具如何合并分區 macos 磁盤工具 無法抹除 磁盤管理軟件哪個使用率最高

一、什么是NTFS格式分區 NTFS格式分區是微軟公司開發的諸多文件系統中的一種。NTFS格式分區是一種文件系統&#xff0c;磁盤只有在安裝了文件系統后才能被正常使用&#xff0c;文件系統的格式有非常多&#xff0c;常見的有FAT 32和NTFS。 作為常見文件系統&#xff0c;NTFS格式…

無人機集群協同搜索研究綜述

源自&#xff1a;指揮控制與仿真 作者&#xff1a;劉圣洋, 宋婷, 馮浩龍, 孫玥, 韓飛 注&#xff1a;若出現無法顯示完全的情況&#xff0c;可 V 搜索“人工智能技術與咨詢”查看完整文章 摘要 無人機集群協同區域搜索能夠有效地獲取任務區域地面信息,降低環境不確定度。基…

買賣股票的最佳時期含冷凍期(leetcode)

個人主頁&#xff1a;Lei寶啊 愿所有美好如期而遇 也就有這樣的狀態轉移方程&#xff1a; 買入&#xff1a;dp[i][0] max(dp[i-1][1] - prices[i], dp[i-1][0]); 可買入&#xff1a;dp[i][1] max(dp[i-1][1], dp[i-1][2]); 冷凍期&#xff1a;dp[i][2] dp[i-1][0] prices…

使用ChatGPT自動生成測試用例思維導圖

使用ChatGPT自動生成測試用例思維導圖 引言ChatGPT在測試用例編寫中的應用全面覆蓋測試場景邊界測試避免測試用例重復 借助ChatGPT生成測試用例思維導圖準備工作步驟一&#xff1a;與ChatGPT對話步驟二&#xff1a;生成思維導圖代碼 結語 引言 在編寫測試用例時&#xff0c;測…

基于Python Django的房價數據分析平臺,包括大屏和后臺數據管理,有線性、向量機、梯度提升樹、bp神經網絡等模型

背景 隨著城市化進程的加速和房地產市場的快速發展&#xff0c;房價已成為經濟學、社會學等多學科交叉研究的熱點問題。為了更精確地分析和預測房價&#xff0c;數據分析和機器學習技術被廣泛應用。在此背景下&#xff0c;開發一個基于Python Django的房價數據分析平臺具有重要…

職業技能大賽引領下物聯網專業實訓教學的改革研究

隨著物聯網技術的迅猛發展&#xff0c;作為培養高技能應用型人才的高職院校&#xff0c;面臨著將理論與實踐深度結合&#xff0c;以滿足行業對物聯網專業人才新要求的挑戰。職業技能大賽作為一種重要的教育評價與促進機制&#xff0c;為物聯網專業實訓教學的改革提供了新的視角…

面試題004-Java-Java多線程(下)

面試題004-Java-Java多線程(下) 這里寫目錄標題 面試題004-Java-Java多線程(下)題目自測題目答案1. synchronized 關鍵字的作用&#xff1f;2. volatile 關鍵字的作用&#xff1f;3. synchronized 和 volatile 的區別&#xff1f;4. synchronized 和 ReentrantLock 的區別&…

成人高考本科何時報名-深職訓學校幫您規劃學習之路

你有想過繼續深造自己的學歷嗎&#xff1f;也許你已經工作多年&#xff0c;但總覺得學歷是一塊心病&#xff0c;想要通過成人高考本科來提升自己。不用著急&#xff0c;今天我們來聊一聊成人高考本科的報名時間&#xff0c;以及深職訓學校如何幫助你順利完成報名。 深圳成人高…

LeetCode-刷題記錄-滑動窗口合集(本篇blog會持續更新哦~)

一、滑動窗口概述 滑動窗口&#xff08;Sliding Window&#xff09;是一種用于解決數組&#xff08;或字符串&#xff09;中子數組&#xff08;或子串&#xff09;問題的有效算法。 Sliding Window核心思想&#xff1a; 滑動窗口技術的基本思想是維護一個窗口&#xff08;一般…

怎樣在Python中使用oobabooga的API密鑰,通過端口5000獲取模型列表的授權

題意&#xff1a; oobabooga-textgen-web-ui how to get authorization to view model list from port 5000 via the oobas api-key in python 怎樣在Python中使用oobabooga的API密鑰&#xff0c;通過端口5000獲取模型列表的授權 問題背景&#xff1a; I wish to extract an…

fastapi+vue3前后端分離開發第一個案例整理

開發思路 1、使用fastapi開發第一個后端接口 2、使用fastapi解決cors跨域的問題。cors跨域是瀏覽器的問題&#xff0c;只要使用瀏覽器&#xff0c;不同IP或者不同端口之間通信&#xff0c;就會存在這個問題。前后端分離是兩個服務&#xff0c;端口不一樣&#xff0c;所以必須要…

PCA和PCoA分析的python代碼

主成分分析(PCA)和主坐標分析(PCoA)都是數據降維和可視化的常用方法,但它們在適用場景和計算方法上有一些重要區別。 主成分分析(PCA) 定義: PCA是一種線性降維方法,通過正交變換將原始數據轉化為一組線性不相關的變量(主成分)。這些主成分是數據中方差最大的方向。…

XLSX + LuckySheet + LuckyExcel實現前端的excel預覽

文章目錄 功能簡介簡單代碼實現效果參考 功能簡介 通過LuckyExcel的transformExcelToLucky方法&#xff0c; 我們可以把一個文件直接轉成LuckySheet需要的json字符串&#xff0c; 之后我們就可以用LuckySheet預覽excelLuckyExcel只能解析xlsx格式的excel文件&#xff0c;因此對…

.NET 漏洞分析 | 某ERP系統存在SQL注入

01閱讀須知 此文所提供的信息只為網絡安全人員對自己所負責的網站、服務器等&#xff08;包括但不限于&#xff09;進行檢測或維護參考&#xff0c;未經授權請勿利用文章中的技術資料對任何計算機系統進行入侵操作。利用此文所提供的信息而造成的直接或間接后果和損失&#xf…

Java中s-EJB 與 e-EJB的區別

在Java中&#xff0c;關于“s-EJB”與“e-EJB”的區分&#xff0c;實際上可能存在一定的誤解或混淆&#xff0c;因為在標準的EJB&#xff08;Enterprise JavaBeans&#xff09;術語中&#xff0c;并沒有直接稱為“s-EJB”和“e-EJB”的明確分類。然而&#xff0c;為了嘗試解答這…

【Postman gRPC測試全攻略】探索微服務通信的新紀元

標題&#xff1a;【Postman gRPC測試全攻略】探索微服務通信的新紀元 gRPC是一種高性能、開源和通用的RPC框架&#xff0c;由Google主導開發&#xff0c;它使用Protocol Buffers作為接口描述語言和消息交換格式。Postman作為API開發的利器&#xff0c;也提供了對gRPC服務的測試…