mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
style: lint and fmt code
This commit is contained in:
@@ -23,6 +23,7 @@ import { FeedbackAlert } from "./feedback-alert";
|
||||
export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShellResult }>) {
|
||||
const { t } = useTranslation(["memshell", "common"]);
|
||||
const isDubbo = generateResult?.shellConfig.server === "Dubbo";
|
||||
const shellToolConfig = generateResult?.shellToolConfig;
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
@@ -65,13 +66,13 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShe
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.behinder.pass")}
|
||||
text={(generateResult?.shellToolConfig as BehinderShellToolConfig).pass}
|
||||
value={(generateResult?.shellToolConfig as BehinderShellToolConfig).pass}
|
||||
text={(shellToolConfig as BehinderShellToolConfig).pass}
|
||||
value={(shellToolConfig as BehinderShellToolConfig).pass}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.behinder.header")}
|
||||
text={`${(generateResult?.shellToolConfig as BehinderShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as BehinderShellToolConfig).headerValue}`}
|
||||
value={`${(generateResult?.shellToolConfig as BehinderShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as BehinderShellToolConfig).headerValue}`}
|
||||
text={`${(shellToolConfig as BehinderShellToolConfig).headerName}: ${(shellToolConfig as BehinderShellToolConfig).headerValue}`}
|
||||
value={`${(shellToolConfig as BehinderShellToolConfig).headerName}: ${(shellToolConfig as BehinderShellToolConfig).headerValue}`}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
@@ -79,26 +80,28 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShe
|
||||
<>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.godzilla.pass")}
|
||||
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).pass}
|
||||
value={(generateResult?.shellToolConfig as GodzillaShellToolConfig).pass}
|
||||
text={(shellToolConfig as GodzillaShellToolConfig).pass}
|
||||
value={(shellToolConfig as GodzillaShellToolConfig).pass}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.godzilla.key")}
|
||||
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
||||
value={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
||||
text={(shellToolConfig as GodzillaShellToolConfig).key}
|
||||
value={(shellToolConfig as GodzillaShellToolConfig).key}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.godzilla.encryptor")}
|
||||
text={
|
||||
generateResult?.shellConfig.shellType.includes("WebSocket")
|
||||
? "JAVA_WEBSOCKET_AES_RAW"
|
||||
: generateResult?.shellConfig.shellType.includes("Dubbo") ? "DUBBO_XOR_BASE64" : "JAVA_AES_BASE64"
|
||||
: generateResult?.shellConfig.shellType.includes("Dubbo")
|
||||
? "DUBBO_XOR_BASE64"
|
||||
: "JAVA_AES_BASE64"
|
||||
}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.godzilla.header")}
|
||||
text={`${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
||||
value={`${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
||||
text={`${(shellToolConfig as GodzillaShellToolConfig).headerName}: ${(shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
||||
value={`${(shellToolConfig as GodzillaShellToolConfig).headerName}: ${(shellToolConfig as GodzillaShellToolConfig).headerValue}`}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
@@ -107,8 +110,8 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShe
|
||||
<CopyableField
|
||||
hidden={generateResult?.shellConfig.shellType.includes("WebSocket")}
|
||||
label={t("common:paramName")}
|
||||
text={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
||||
value={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
||||
text={(shellToolConfig as CommandShellToolConfig).paramName}
|
||||
value={(shellToolConfig as CommandShellToolConfig).paramName}
|
||||
/>
|
||||
<CopyableField
|
||||
hidden={
|
||||
@@ -118,8 +121,8 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShe
|
||||
)
|
||||
}
|
||||
label={t("shellToolConfig.httpHeader")}
|
||||
text={`${(generateResult?.shellToolConfig as CommandShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as CommandShellToolConfig).headerValue}`}
|
||||
value={`${(generateResult?.shellToolConfig as CommandShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as CommandShellToolConfig).headerValue}`}
|
||||
text={`${(shellToolConfig as CommandShellToolConfig).headerName}: ${(shellToolConfig as CommandShellToolConfig).headerValue}`}
|
||||
value={`${(shellToolConfig as CommandShellToolConfig).headerName}: ${(shellToolConfig as CommandShellToolConfig).headerValue}`}
|
||||
/>
|
||||
</Fragment>
|
||||
)}
|
||||
@@ -127,28 +130,28 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShe
|
||||
generateResult?.shellConfig.shellTool === ShellToolType.Suo5v2) && (
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.suo5Header")}
|
||||
text={`${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerValue}`}
|
||||
value={`${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as Suo5ShellToolConfig).headerValue}`}
|
||||
text={`${(shellToolConfig as Suo5ShellToolConfig).headerName}: ${(shellToolConfig as Suo5ShellToolConfig).headerValue}`}
|
||||
value={`${(shellToolConfig as Suo5ShellToolConfig).headerName}: ${(shellToolConfig as Suo5ShellToolConfig).headerValue}`}
|
||||
/>
|
||||
)}
|
||||
{generateResult?.shellConfig.shellTool === ShellToolType.Proxy && (
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.httpHeader")}
|
||||
text={`${(generateResult?.shellToolConfig as ProxyShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as ProxyShellToolConfig).headerValue}`}
|
||||
value={`${(generateResult?.shellToolConfig as ProxyShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as ProxyShellToolConfig).headerValue}`}
|
||||
text={`${(shellToolConfig as ProxyShellToolConfig).headerName}: ${(shellToolConfig as ProxyShellToolConfig).headerValue}`}
|
||||
value={`${(shellToolConfig as ProxyShellToolConfig).headerName}: ${(shellToolConfig as ProxyShellToolConfig).headerValue}`}
|
||||
/>
|
||||
)}
|
||||
{generateResult?.shellConfig.shellTool === ShellToolType.AntSword && (
|
||||
<>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.antSword.pass")}
|
||||
text={(generateResult?.shellToolConfig as AntSwordShellToolConfig).pass}
|
||||
value={(generateResult?.shellToolConfig as AntSwordShellToolConfig).pass}
|
||||
text={(shellToolConfig as AntSwordShellToolConfig).pass}
|
||||
value={(shellToolConfig as AntSwordShellToolConfig).pass}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.httpHeader")}
|
||||
text={`${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerValue}`}
|
||||
value={`${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as AntSwordShellToolConfig).headerValue}`}
|
||||
text={`${(shellToolConfig as AntSwordShellToolConfig).headerName}: ${(shellToolConfig as AntSwordShellToolConfig).headerValue}`}
|
||||
value={`${(shellToolConfig as AntSwordShellToolConfig).headerName}: ${(shellToolConfig as AntSwordShellToolConfig).headerValue}`}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
@@ -157,8 +160,8 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShe
|
||||
<CopyableField label={t("shellToolConfig.neoreGeorgKey")} text="key" value="key" />
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.neoreGeorgHeader")}
|
||||
text={`${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
|
||||
value={`${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(generateResult?.shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
|
||||
text={`${(shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
|
||||
value={`${(shellToolConfig as NeoreGeorgShellToolConfig).headerName}: ${(shellToolConfig as NeoreGeorgShellToolConfig).headerValue}`}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { DownloadIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import DecompiledCodeViewer from "@/components/memshell/decompiled-code-viewer";
|
||||
import DecompiledCodeViewer from "@/components/decompiled-code-viewer";
|
||||
import { QuickUsage } from "@/components/memshell/quick-usage";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
|
||||
@@ -12,6 +12,7 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: ProbeS
|
||||
const isBodyContent = generateResult?.probeConfig.probeMethod === "ResponseBody";
|
||||
const isFilterContent = generateResult?.probeConfig.probeContent === "Filter";
|
||||
const isBodyCommand = isBodyContent && generateResult?.probeConfig.probeContent === "Command";
|
||||
const probeContentConfig = generateResult?.probeContentConfig as ResponseBodyConfig | undefined;
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
@@ -28,18 +29,17 @@ export function BasicInfo({ generateResult }: Readonly<{ generateResult?: ProbeS
|
||||
{!isFilterContent && isBodyContent && (
|
||||
<CopyableField
|
||||
label={t("common:paramName")}
|
||||
value={(generateResult?.probeContentConfig as ResponseBodyConfig).reqParamName}
|
||||
text={(generateResult?.probeContentConfig as ResponseBodyConfig).reqParamName}
|
||||
value={probeContentConfig?.reqParamName}
|
||||
text={probeContentConfig?.reqParamName}
|
||||
/>
|
||||
)}
|
||||
{isBodyCommand && probeContentConfig?.commandTemplate && (
|
||||
<CopyableField
|
||||
label={t("common:commandTemplate")}
|
||||
value={probeContentConfig.commandTemplate}
|
||||
text={probeContentConfig.commandTemplate}
|
||||
/>
|
||||
)}
|
||||
{isBodyCommand &&
|
||||
(generateResult?.probeContentConfig as ResponseBodyConfig).commandTemplate && (
|
||||
<CopyableField
|
||||
label={t("common:commandTemplate")}
|
||||
value={(generateResult?.probeContentConfig as ResponseBodyConfig).commandTemplate}
|
||||
text={(generateResult?.probeContentConfig as ResponseBodyConfig).commandTemplate}
|
||||
/>
|
||||
)}
|
||||
<CopyableField
|
||||
label={t("probeshell:shellClassName")}
|
||||
value={generateResult?.shellClassName}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import type { ProbeShellResult } from "@/types/probeshell";
|
||||
|
||||
import { DownloadIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
|
||||
import DecompiledCodeViewer from "@/components/decompiled-code-viewer";
|
||||
import { QuickUsage } from "@/components/probeshell/quick-usage";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import { useDecompiledSources } from "@/lib/decompile/use-decompiled-sources";
|
||||
import { downloadBytes } from "@/lib/utils";
|
||||
|
||||
import CodeViewer from "../code-viewer";
|
||||
import { BasicInfo } from "./basic-info";
|
||||
@@ -17,16 +23,29 @@ export default function ShellResult({
|
||||
packMethod: string;
|
||||
generateResult?: ProbeShellResult;
|
||||
}>) {
|
||||
const { t } = useTranslation();
|
||||
const { t } = useTranslation(["common", "probeshell"]);
|
||||
const { sources, isDecompiling, error } = useDecompiledSources(generateResult);
|
||||
|
||||
if (!generateResult) {
|
||||
return <QuickUsage />;
|
||||
}
|
||||
|
||||
const showCode = packMethod === "JSP";
|
||||
const height = 600;
|
||||
const decompiledSourceHeight = 800;
|
||||
const shellClassName = generateResult.shellClassName;
|
||||
const shellBytesBase64 = generateResult.shellBytesBase64Str;
|
||||
const sourcePlaceholder = isDecompiling
|
||||
? `// ${t("common:decompiling")}`
|
||||
: error
|
||||
? `// ${t("common:decompileFailed", { error })}`
|
||||
: "";
|
||||
|
||||
return (
|
||||
<Tabs defaultValue="packResult">
|
||||
<TabsList className="grid w-full grid-cols-1">
|
||||
<TabsList className="grid w-full grid-cols-2">
|
||||
<TabsTrigger value="packResult">{t("common:generateResult")}</TabsTrigger>
|
||||
<TabsTrigger value="shell">{t("probeshell:shellClass")}</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent value="packResult" className="space-y-2">
|
||||
<BasicInfo generateResult={generateResult} />
|
||||
@@ -48,6 +67,46 @@ export default function ShellResult({
|
||||
/>
|
||||
)}
|
||||
</TabsContent>
|
||||
<TabsContent value="shell" className="mt-4" keepMounted>
|
||||
<DecompiledCodeViewer
|
||||
copyLabel={t("common:copy")}
|
||||
copyOptions={[
|
||||
{
|
||||
label: t("probeshell:copySource"),
|
||||
value: sources.shell?.source ?? "",
|
||||
disabled: !sources.shell,
|
||||
},
|
||||
{
|
||||
label: t("probeshell:copyBase64"),
|
||||
value: shellBytesBase64 ?? "",
|
||||
disabled: !shellBytesBase64,
|
||||
},
|
||||
]}
|
||||
header={<div className="truncate text-xs">{shellClassName}</div>}
|
||||
button={
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
type="button"
|
||||
className="h-7 w-7 [&_svg]:h-4 [&_svg]:w-4"
|
||||
aria-label={t("common:download")}
|
||||
title={t("common:download")}
|
||||
onClick={() => {
|
||||
if (!shellBytesBase64) {
|
||||
toast.warning(t("probeshell:tips.shellBytesEmpty"));
|
||||
return;
|
||||
}
|
||||
downloadBytes(shellBytesBase64, shellClassName);
|
||||
}}
|
||||
>
|
||||
<DownloadIcon className="h-4 w-4" />
|
||||
</Button>
|
||||
}
|
||||
height={decompiledSourceHeight}
|
||||
lines={sources.shell?.lines ?? null}
|
||||
placeholder={sourcePlaceholder}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import * as React from "react"
|
||||
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area"
|
||||
import { ScrollArea as ScrollAreaPrimitive } from "@base-ui/react/scroll-area";
|
||||
import * as React from "react";
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
function ScrollArea({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: ScrollAreaPrimitive.Root.Props) {
|
||||
function ScrollArea({ className, children, ...props }: ScrollAreaPrimitive.Root.Props) {
|
||||
return (
|
||||
<ScrollAreaPrimitive.Root
|
||||
data-slot="scroll-area"
|
||||
@@ -23,7 +19,7 @@ function ScrollArea({
|
||||
<ScrollBar />
|
||||
<ScrollAreaPrimitive.Corner />
|
||||
</ScrollAreaPrimitive.Root>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function ScrollBar({
|
||||
@@ -38,7 +34,7 @@ function ScrollBar({
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"flex touch-none p-px transition-colors select-none data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent",
|
||||
className
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
@@ -47,7 +43,7 @@ function ScrollBar({
|
||||
className="relative flex-1 rounded-full bg-border"
|
||||
/>
|
||||
</ScrollAreaPrimitive.Scrollbar>
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
export { ScrollArea, ScrollBar }
|
||||
export { ScrollArea, ScrollBar };
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"about": "About",
|
||||
"documents": "Documents",
|
||||
"basicInfo": "BasicInfo",
|
||||
"byPassJavaModule": "BypassModule",
|
||||
"byPassJavaModule.description": "JDK 9+ module system strictly restricts reflective defineClass calls. When enabled, automatically inserts Unsafe-based module bypass code into injector",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"about": "关于",
|
||||
"documents": "文档",
|
||||
"basicInfo": "基本信息",
|
||||
"byPassJavaModule": "绕过模块限制",
|
||||
"byPassJavaModule.description": "JDK 9+ 模块化系统严格限制反射调用 defineClass。开启后会在注入器中自动插入使用 Unsafe 绕过模块限制的代码",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"buttons.generate": "Generate Shell",
|
||||
"copyBase64": "Copy Base64",
|
||||
"copySource": "Copy Source",
|
||||
"dnslog.host": "DNSLog Host",
|
||||
"probeContent": "ProbeContent",
|
||||
"probeContent.bytecode": "Bytecode",
|
||||
@@ -12,9 +14,11 @@
|
||||
"quickUsage.step1": "Select Probe Method, DNSLog, Response, etc.",
|
||||
"quickUsage.step2": "Select Probe Content, JDK, Server, etc.",
|
||||
"quickUsage.step3": "Click Generate Shell",
|
||||
"shellClass": "ProbeShell",
|
||||
"shellClassName": "ShellClassName",
|
||||
"sleepSeconds": "SleepTime (seconds)",
|
||||
"sleepServer": "SleepServer",
|
||||
"tips.dnslog.host.required": "DNSLog host required",
|
||||
"tips.response.reqParamName.required": "ParamName required"
|
||||
"tips.response.reqParamName.required": "ParamName required",
|
||||
"tips.shellBytesEmpty": "Shell bytes is empty, please generate shell first"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"buttons.generate": "生成探测马",
|
||||
"copyBase64": "复制 Base64",
|
||||
"copySource": "复制源码",
|
||||
"dnslog.host": "DNSLog 地址",
|
||||
"probeContent": "探测内容",
|
||||
"probeContent.bytecode": "字节码执行",
|
||||
@@ -12,9 +14,11 @@
|
||||
"quickUsage.step1": "选择探测方法,DNSLog、Response 或者其他",
|
||||
"quickUsage.step2": "选择探测内容,JDK、服务类型 或者其他",
|
||||
"quickUsage.step3": "点击生成探测马",
|
||||
"shellClass": "探测马",
|
||||
"shellClassName": "探测马类名",
|
||||
"sleepSeconds": "延迟时间(秒)",
|
||||
"sleepServer": "探测服务",
|
||||
"tips.dnslog.host.required": "DNSLog 地址必填",
|
||||
"tips.response.reqParamName.required": "参数名称必填"
|
||||
"tips.response.reqParamName.required": "参数名称必填",
|
||||
"tips.shellBytesEmpty": "探测马字节码为空,无法下载,请先生成探测马"
|
||||
}
|
||||
|
||||
+15
-4
@@ -1,7 +1,17 @@
|
||||
import type { LinkItemType } from "fumadocs-ui/layouts/shared";
|
||||
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { LanguageSwitcher } from "@/components/language-switcher";
|
||||
|
||||
type NavLabelKey = "MemShellGenerator" | "ProbeShellGenerator" | "documents" | "about";
|
||||
|
||||
function NavLabel({ translationKey }: { translationKey: NavLabelKey }) {
|
||||
const { t } = useTranslation("common");
|
||||
|
||||
return t(translationKey);
|
||||
}
|
||||
|
||||
export const siteConfig = {
|
||||
name: "MemShellParty",
|
||||
url: "https://party.memshell.news",
|
||||
@@ -13,19 +23,20 @@ export const siteConfig = {
|
||||
blog: "https://reajason.eu.org",
|
||||
navLinks: [
|
||||
{
|
||||
text: "MemShellGenerator",
|
||||
text: <NavLabel translationKey="MemShellGenerator" />,
|
||||
url: "/memshell",
|
||||
},
|
||||
{
|
||||
text: "ProbeShellGenerator",
|
||||
text: <NavLabel translationKey="ProbeShellGenerator" />,
|
||||
url: "/probeshell",
|
||||
},
|
||||
{
|
||||
text: "Documents",
|
||||
text: <NavLabel translationKey="documents" />,
|
||||
url: "/docs",
|
||||
external: true,
|
||||
},
|
||||
{
|
||||
text: "About",
|
||||
text: <NavLabel translationKey="about" />,
|
||||
url: "/about",
|
||||
},
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@ export interface DecompileRequest {
|
||||
id: number;
|
||||
shellClassName: string;
|
||||
shellBytesBase64: string;
|
||||
injectorClassName: string;
|
||||
injectorBytesBase64: string;
|
||||
injectorClassName?: string;
|
||||
injectorBytesBase64?: string;
|
||||
}
|
||||
|
||||
export interface DecompileResponse {
|
||||
@@ -95,10 +95,15 @@ self.onmessage = async (event: MessageEvent<DecompileRequest>) => {
|
||||
try {
|
||||
const classes = new Map<string, Uint8Array>([
|
||||
[toJvmClassName(shellClassName), base64ToBytes(shellBytesBase64)],
|
||||
[toJvmClassName(injectorClassName), base64ToBytes(injectorBytesBase64)],
|
||||
]);
|
||||
const hasInjector = injectorClassName && injectorBytesBase64;
|
||||
if (hasInjector) {
|
||||
classes.set(toJvmClassName(injectorClassName), base64ToBytes(injectorBytesBase64));
|
||||
}
|
||||
const shell = await decompileClass(toJvmClassName(shellClassName), classes);
|
||||
const injector = await decompileClass(toJvmClassName(injectorClassName), classes);
|
||||
const injector = hasInjector
|
||||
? await decompileClass(toJvmClassName(injectorClassName), classes)
|
||||
: undefined;
|
||||
self.postMessage({ id, shell, injector } satisfies DecompileResponse);
|
||||
} catch (error) {
|
||||
self.postMessage({
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
import type { DecompiledClass, DecompileRequest, DecompileResponse } from "./decompile.worker";
|
||||
import type { MemShellResult } from "@/types/memshell";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
/** Structural subset shared by MemShellResult and ProbeShellResult */
|
||||
export interface DecompileInput {
|
||||
shellClassName?: string;
|
||||
shellBytesBase64Str?: string;
|
||||
injectorClassName?: string;
|
||||
injectorBytesBase64Str?: string;
|
||||
}
|
||||
|
||||
export interface DecompiledSources {
|
||||
shell: DecompiledClass | null;
|
||||
injector: DecompiledClass | null;
|
||||
@@ -67,10 +74,10 @@ function getWorker() {
|
||||
const entry = pending.get(id);
|
||||
if (!entry) return;
|
||||
pending.delete(id);
|
||||
if (error || !shell || !injector) {
|
||||
if (error || !shell) {
|
||||
entry.reject(new Error(error ?? "decompile failed"));
|
||||
} else {
|
||||
entry.resolve({ shell, injector });
|
||||
entry.resolve({ shell, injector: injector ?? null });
|
||||
}
|
||||
};
|
||||
worker.onerror = (event) => {
|
||||
@@ -90,7 +97,7 @@ function decompileInWorker(request: Omit<DecompileRequest, "id">) {
|
||||
});
|
||||
}
|
||||
|
||||
export function useDecompiledSources(generateResult: MemShellResult | undefined) {
|
||||
export function useDecompiledSources(generateResult: DecompileInput | undefined) {
|
||||
const shellClassName = generateResult?.shellClassName;
|
||||
const shellBytesBase64 = generateResult?.shellBytesBase64Str;
|
||||
const injectorClassName = generateResult?.injectorClassName;
|
||||
@@ -99,12 +106,12 @@ export function useDecompiledSources(generateResult: MemShellResult | undefined)
|
||||
const [state, setState] = useState<DecompileState>(IDLE);
|
||||
|
||||
useEffect(() => {
|
||||
if (!shellClassName || !shellBytesBase64 || !injectorClassName || !injectorBytesBase64) {
|
||||
if (!shellClassName || !shellBytesBase64) {
|
||||
setState(IDLE);
|
||||
return;
|
||||
}
|
||||
|
||||
const key = cacheKey(shellBytesBase64, injectorBytesBase64);
|
||||
const key = cacheKey(shellBytesBase64, injectorBytesBase64 ?? "");
|
||||
const cached = cacheGet(key);
|
||||
if (cached) {
|
||||
setState({ sources: cached, isDecompiling: false, error: null });
|
||||
|
||||
@@ -16,11 +16,11 @@ export function downloadContent(content: Blob, fileName: string, fileExtension:
|
||||
|
||||
export function base64ToBytes(base64String: string) {
|
||||
const byteCharacters = atob(base64String);
|
||||
const byteNumbers = new Array(byteCharacters.length);
|
||||
const bytes = new Uint8Array(byteCharacters.length);
|
||||
for (let i = 0; i < byteCharacters.length; i++) {
|
||||
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
||||
bytes[i] = byteCharacters.charCodeAt(i);
|
||||
}
|
||||
return new Uint8Array(byteNumbers);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
export function downloadBytes(base64String: string, className?: string, jarName?: string) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import ShellResult from "@/components/probeshell/shell-result";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { env } from "@/config";
|
||||
import { siteConfig } from "@/lib/config";
|
||||
import { baseOptions } from "@/lib/layout.shared";
|
||||
import {
|
||||
type ProbeShellFormSchema,
|
||||
probeShellFormSchema,
|
||||
@@ -22,8 +23,6 @@ import {
|
||||
} from "@/types/schema";
|
||||
import { transformToProbePostData } from "@/utils/transformer";
|
||||
|
||||
import { baseOptions } from "@/lib/layout.shared";
|
||||
|
||||
export default function ProbeShellGenerator() {
|
||||
const { data: responseBodyServers } = useQuery<string[]>({
|
||||
queryKey: ["probeResponseBodyServers"],
|
||||
|
||||
Reference in New Issue
Block a user