From 0a4d834c7f2462b3223adcac3a4886658e7016e8 Mon Sep 17 00:00:00 2001 From: luoluo <1425735414@qq.com> Date: Wed, 31 Jul 2024 10:49:03 +0800 Subject: [PATCH] =?UTF-8?q?doc:=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReverseShellTerminal/ReverseShellTerminal.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/renderer/src/main/src/pages/reverseShellReceiver/ReverseShellTerminal/ReverseShellTerminal.tsx b/app/renderer/src/main/src/pages/reverseShellReceiver/ReverseShellTerminal/ReverseShellTerminal.tsx index 6ce9f49471..704b333d4c 100644 --- a/app/renderer/src/main/src/pages/reverseShellReceiver/ReverseShellTerminal/ReverseShellTerminal.tsx +++ b/app/renderer/src/main/src/pages/reverseShellReceiver/ReverseShellTerminal/ReverseShellTerminal.tsx @@ -1,10 +1,10 @@ -import React, {forwardRef, memo, useEffect, useImperativeHandle, useRef} from "react" -import {useDebounceFn, useMemoizedFn} from "ahooks" +import React, {memo, useEffect, useRef} from "react" +import {useMemoizedFn} from "ahooks" import YakitXterm, {TERMINAL_KEYBOARD_Map, YakitXtermRefProps} from "@/components/yakitUI/YakitXterm/YakitXterm" import {writeXTerm} from "@/utils/xtermUtils" import {yakitNotify} from "@/utils/notification" import {System, SystemInfo, handleFetchSystem} from "@/constants/hardware" -import {Position} from "monaco-editor" +import {Uint8ArrayToString} from "@/utils/str" const {ipcRenderer} = window.require("electron") export interface ReverseShellTerminalProps { @@ -32,6 +32,7 @@ export const ReverseShellTerminal: React.FC = memo((p } const key = `client-listening-port-data-${addr}` ipcRenderer.on(key, (e, data) => { + console.log("data", data, Uint8ArrayToString(data?.raw || new Uint8Array())) if (data.closed) { onCancelMonitor() return @@ -52,11 +53,13 @@ export const ReverseShellTerminal: React.FC = memo((p }) const errorKey = `client-listening-port-error-${addr}` ipcRenderer.on(errorKey, (e: any, data: any) => { + console.log("error", data) yakitNotify("error", `监听报错:${data}`) onCancelMonitor() }) const endKey = `client-listening-port-end-${addr}` ipcRenderer.on(endKey, (e: any, data: any) => { + console.log("end", data) onCancelMonitor() }) return () => { @@ -68,7 +71,9 @@ export const ReverseShellTerminal: React.FC = memo((p // 写入 const commandExec = useMemoizedFn((str) => { + console.log("addr,str", addr, str) if (isWrite) { + console.log('isWrite',isWrite) writeXTerm(xtermRef, str) } ipcRenderer.invoke("listening-port-input", addr, str) @@ -93,7 +98,7 @@ export const ReverseShellTerminal: React.FC = memo((p return false } if (isWrite && e.key === TERMINAL_KEYBOARD_Map.Enter.key) { - commandExec(String.fromCharCode(10)) //enter 该为换行符 + commandExec(String.fromCharCode(10)) //enter 改为换行符 e.preventDefault() return false }