mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-22 07:00:43 +08:00
feat: add diff tips for attacher
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { downloadBytes } from "@/lib/utils";
|
||||
import { downloadBytes, formatBytes } from "@/lib/utils";
|
||||
import { GenerateResult } from "@/types/shell";
|
||||
import { ScrollTextIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -6,8 +6,14 @@ import { Button } from "../ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";
|
||||
import { Separator } from "../ui/separator";
|
||||
|
||||
export function AgentResult({ packResult, generateResult }: { packResult: string; generateResult?: GenerateResult }) {
|
||||
export function AgentResult({
|
||||
packMethod,
|
||||
packResult,
|
||||
generateResult,
|
||||
}: Readonly<{ packMethod: string; packResult: string; generateResult?: GenerateResult }>) {
|
||||
const { t } = useTranslation();
|
||||
console.log(packMethod);
|
||||
const isPureAgent = packMethod === "AgentJar";
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
@@ -19,7 +25,9 @@ export function AgentResult({ packResult, generateResult }: { packResult: string
|
||||
<CardContent>
|
||||
<ol className="list-decimal list-inside space-y-4 text-sm">
|
||||
<li className="flex items-center justify-between">
|
||||
<span>{t("download")} MemShellAgent.jar</span>
|
||||
<span>
|
||||
{t("download")} MemShellAgent.jar ({formatBytes(atob(packResult).length)})
|
||||
</span>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
@@ -33,25 +41,27 @@ export function AgentResult({ packResult, generateResult }: { packResult: string
|
||||
)
|
||||
}
|
||||
>
|
||||
{t("download")} Jar
|
||||
</Button>
|
||||
</li>
|
||||
<li className="flex items-center justify-between">
|
||||
<span>{t("tips.download-jattach")}</span>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="w-28"
|
||||
type="button"
|
||||
onClick={() => window.open("https://github.com/jattach/jattach/releases")}
|
||||
>
|
||||
{t("download")} Jattach
|
||||
{t("download")}
|
||||
</Button>
|
||||
</li>
|
||||
{isPureAgent && (
|
||||
<li className="flex items-center justify-between">
|
||||
<span>{t("tips.download-jattach")}</span>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="w-28"
|
||||
type="button"
|
||||
onClick={() => window.open("https://github.com/jattach/jattach/releases")}
|
||||
>
|
||||
{t("download")}
|
||||
</Button>
|
||||
</li>
|
||||
)}
|
||||
<Separator />
|
||||
<li>{t("tips.move-to-container")}</li>
|
||||
<li>{isPureAgent ? t("tips.agent-move-to-target") : t("tips.agent-move-to-target1")}</li>
|
||||
<li>{t("tips.get-pid")}</li>
|
||||
<li>{t("tips.execute-command")}</li>
|
||||
<li>{isPureAgent ? t("tips.execute-command") : t("tips.execute-command1")}</li>
|
||||
<li>{t("tips.try-to-use-shell")}</li>
|
||||
</ol>
|
||||
</CardContent>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { GenerateResult } from "@/types/shell";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Button } from "../ui/button";
|
||||
|
||||
export function JarResult({ packResult, generateResult }: { packResult: string; generateResult?: GenerateResult }) {
|
||||
export function JarResult({ packResult, generateResult }: Readonly<{ packResult: string; generateResult?: GenerateResult }>) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="flex items-center justify-center">
|
||||
|
||||
@@ -12,13 +12,13 @@ export function ResultComponent({
|
||||
packMethod,
|
||||
t,
|
||||
generateResult,
|
||||
}: {
|
||||
}: Readonly<{
|
||||
packResult: string | undefined;
|
||||
allPackResults: Map<string, string> | undefined;
|
||||
packMethod: string;
|
||||
t: TFunction;
|
||||
generateResult?: GenerateResult;
|
||||
}) {
|
||||
}>) {
|
||||
const showCode = packMethod === "JSP";
|
||||
const isAgent = packMethod.startsWith("Agent");
|
||||
const isJar = packMethod === "Jar";
|
||||
@@ -27,30 +27,28 @@ export function ResultComponent({
|
||||
}
|
||||
|
||||
if (isAgent) {
|
||||
return <AgentResult packResult={packResult ?? ""} generateResult={generateResult} />;
|
||||
return <AgentResult packMethod={packMethod} packResult={packResult ?? ""} generateResult={generateResult} />;
|
||||
}
|
||||
if (isJar) {
|
||||
return <JarResult packResult={packResult ?? ""} generateResult={generateResult} />;
|
||||
}
|
||||
if (!isAgent && !isJar) {
|
||||
return (
|
||||
<Fragment>
|
||||
<CodeViewer
|
||||
code={packResult ?? ""}
|
||||
header={
|
||||
<div className="flex items-center justify-between text-xs gap-2">
|
||||
<span>
|
||||
{t("packageConfig.title")}:{packMethod}
|
||||
</span>
|
||||
<span className="text-muted-foreground">({packResult?.length})</span>
|
||||
</div>
|
||||
}
|
||||
wrapLongLines={!showCode}
|
||||
showLineNumbers={showCode}
|
||||
language={showCode ? "java" : "text"}
|
||||
height={350}
|
||||
/>
|
||||
</Fragment>
|
||||
<CodeViewer
|
||||
code={packResult ?? ""}
|
||||
header={
|
||||
<div className="flex items-center justify-between text-xs gap-2">
|
||||
<span>
|
||||
{t("packageConfig.title")}:{packMethod}
|
||||
</span>
|
||||
<span className="text-muted-foreground">({packResult?.length})</span>
|
||||
</div>
|
||||
}
|
||||
wrapLongLines={!showCode}
|
||||
showLineNumbers={showCode}
|
||||
language={showCode ? "java" : "text"}
|
||||
height={350}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user