import { CodeViewer } from "@/components/code-viewer.tsx"; import { CopyableField } from "@/components/copyable-field.tsx"; import { QuickUsage } from "@/components/quick-usage.tsx"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert.tsx"; import { Button } from "@/components/ui/button.tsx"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Separator } from "@/components/ui/separator.tsx"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs.tsx"; import { downloadBytes } from "@/lib/utils.ts"; import { BehinderShellToolConfig, CommandShellToolConfig, GenerateResult, GodzillaShellToolConfig, Suo5ShellToolConfig, } from "@/types/shell.ts"; import { TFunction } from "i18next"; import { CircleHelpIcon, TriangleAlertIcon } from "lucide-react"; import { Fragment, useState } from "react"; import { useTranslation } from "react-i18next"; import { toast } from "sonner"; function AgentResult({ packResult, generateResult }: { packResult: string; generateResult?: GenerateResult }) { return ( 使用方法
  1. 下载 MemShellAgent.jar
  2. 下载 Jattach 工具(后期考虑直接封装在 Jar 中)
  3. 将 MemShellAgent.jar 和 jattach 移动到容器中(如果测试环境使用容器部署)
  4. 获取目标 jvm 的进程 pid (使用 jps 或 ps)
  5. 执行命令进行注入:/path/to/jattach pid load instrument false /path/to/agent.jar
  6. 尝试利用内存马
); } function JarResult({ packResult, generateResult }: { packResult: string; generateResult?: GenerateResult }) { const { t } = useTranslation(); return (
); } function FeedbackAlert() { const { t } = useTranslation(); return ( {t("shellNotWork.title")}
  1. {t("shellNotWork.step1")}
  2. {t("shellNotWork.step2")}
{t("cancel")} window.open( "https://github.com/ReaJason/MemShellParty/issues/new?template=%E5%86%85%E5%AD%98%E9%A9%AC%E7%94%9F%E6%88%90-bug-%E4%B8%8A%E6%8A%A5.md", ) } > {t("feedback")}
); } function BasicInfo({ generateResult }: { generateResult?: GenerateResult }) { const { t } = useTranslation(); return ( {t("generateResult.basicInfo")}
{generateResult?.shellConfig.shellTool === "Behinder" && ( )} {generateResult?.shellConfig.shellTool === "Godzilla" && ( )} {generateResult?.shellConfig.shellTool === "Command" && ( )} {generateResult?.shellConfig.shellTool === "Suo5" && ( )}
); } function MultiPackResult({ allPackResults, packMethod, t, }: { allPackResults: object | undefined; packMethod: string; t: TFunction; }) { const showCode = packMethod === "JSP"; const packMethods = Object.keys(allPackResults ?? {}); const [selectedMethod, setSelectedMethod] = useState(packMethods[0]); const [packResult, setPackResult] = useState(allPackResults?.[selectedMethod as keyof typeof allPackResults] ?? ""); return ( ({packResult?.length}) } wrapLongLines={!showCode} showLineNumbers={showCode} language={showCode ? "java" : "text"} height={350} /> ); } function renderResultComponent( packResult: string | undefined, allPackResults: Map | undefined, packMethod: string, t: TFunction, generateResult?: GenerateResult, ) { const showCode = packMethod === "JSP"; const isAgent = packMethod.startsWith("Agent"); const isJar = packMethod === "Jar"; if (allPackResults) { return ; } if (isAgent) { return ; } if (isJar) { return ; } if (!isAgent && !isJar) { return ( {t("packageConfig.title")}:{packMethod} ({packResult?.length}) } wrapLongLines={!showCode} showLineNumbers={showCode} language={showCode ? "java" : "text"} height={350} /> ); } return null; } export function ShellResult({ packResult, allPackResults, packMethod, generateResult, }: { packResult: string | undefined; allPackResults: Map | undefined; packMethod: string; generateResult?: GenerateResult; }) { const { t } = useTranslation(); return ( {generateResult ? ( {t("generateResult.title1")} {t("generateResult.title2")} {t("generateResult.title3")}
{renderResultComponent(packResult, allPackResults, packMethod, t, generateResult)}
Warning {t("tips.decompileTip")}
{generateResult?.shellClassName}} wrapLongLines={true} height={600} code={generateResult?.shellBytesBase64Str ?? ""} language="text" />
Warning {t("tips.decompileTip")}
{generateResult?.injectorClassName}} height={600} code={generateResult?.injectorBytesBase64Str ?? ""} language="text" />
) : ( )}
); }