mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-24 07:51:52 +08:00
style: fmt code
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import type { MemShellResult } from "@/types/memshell";
|
||||
|
||||
import { ScrollTextIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { downloadBytes, formatBytes } from "@/lib/utils";
|
||||
import type { MemShellResult } from "@/types/memshell";
|
||||
|
||||
export function AgentResult({
|
||||
packMethod,
|
||||
@@ -26,11 +28,10 @@ export function AgentResult({
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ol className="list-decimal list-inside space-y-4 text-sm">
|
||||
<ol className="list-inside list-decimal space-y-4 text-sm">
|
||||
<li className="flex items-center justify-between">
|
||||
<span>
|
||||
{t("common:download")} MemShellAgent.jar (
|
||||
{formatBytes(atob(packResult).length)})
|
||||
{t("common:download")} MemShellAgent.jar ({formatBytes(atob(packResult).length)})
|
||||
</span>
|
||||
<Button
|
||||
size="sm"
|
||||
@@ -56,9 +57,7 @@ export function AgentResult({
|
||||
variant="outline"
|
||||
className="w-28"
|
||||
type="button"
|
||||
onClick={() =>
|
||||
window.open("https://github.com/jattach/jattach/releases")
|
||||
}
|
||||
onClick={() => window.open("https://github.com/jattach/jattach/releases")}
|
||||
>
|
||||
{t("common:download")}
|
||||
</Button>
|
||||
@@ -72,9 +71,7 @@ export function AgentResult({
|
||||
</li>
|
||||
<li>{t("memshell:tips.get-pid")}</li>
|
||||
<li>
|
||||
{isPureAgent
|
||||
? t("memshell:tips.execute-command")
|
||||
: t("memshell:tips.execute-command1")}
|
||||
{isPureAgent ? t("memshell:tips.execute-command") : t("memshell:tips.execute-command1")}
|
||||
</li>
|
||||
<li>{t("memshell:tips.try-to-use-shell")}</li>
|
||||
</ol>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { FileTextIcon } from "lucide-react";
|
||||
import { Fragment } from "react/jsx-runtime";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Fragment } from "react/jsx-runtime";
|
||||
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { notNeedUrlPattern } from "@/lib/utils";
|
||||
@@ -15,12 +16,11 @@ import {
|
||||
ShellToolType,
|
||||
type Suo5ShellToolConfig,
|
||||
} from "@/types/memshell";
|
||||
|
||||
import { CopyableField } from "../../copyable-field";
|
||||
import { FeedbackAlert } from "./feedback-alert";
|
||||
|
||||
export function BasicInfo({
|
||||
generateResult,
|
||||
}: Readonly<{ generateResult?: MemShellResult }>) {
|
||||
export function BasicInfo({ generateResult }: Readonly<{ generateResult?: MemShellResult }>) {
|
||||
const { t } = useTranslation(["memshell", "common"]);
|
||||
const isDubbo = generateResult?.shellConfig.server === "Dubbo";
|
||||
return (
|
||||
@@ -35,11 +35,8 @@ export function BasicInfo({
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
<CopyableField
|
||||
label={t("common:server")}
|
||||
text={generateResult?.shellConfig.server}
|
||||
/>
|
||||
<div className="grid grid-cols-1 gap-2 md:grid-cols-2">
|
||||
<CopyableField label={t("common:server")} text={generateResult?.shellConfig.server} />
|
||||
<CopyableField
|
||||
label={t("mainConfig.shellTool")}
|
||||
text={generateResult?.shellConfig.shellTool}
|
||||
@@ -55,29 +52,21 @@ export function BasicInfo({
|
||||
value={generateResult?.injectorConfig.urlPattern}
|
||||
/>
|
||||
</div>
|
||||
{generateResult?.shellConfig.shellTool !== ShellToolType.Custom &&
|
||||
!isDubbo && <Separator className="my-1" />}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
{generateResult?.shellConfig.shellTool !== ShellToolType.Custom && !isDubbo && (
|
||||
<Separator className="my-1" />
|
||||
)}
|
||||
<div className="grid grid-cols-1 gap-2 md:grid-cols-2">
|
||||
{generateResult?.shellConfig.shellTool === ShellToolType.Behinder && (
|
||||
<>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.behinderScriptType")}
|
||||
text="jsp"
|
||||
/>
|
||||
<CopyableField label={t("shellToolConfig.behinderScriptType")} text="jsp" />
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.behinderEncryptType")}
|
||||
text={t("shellToolConfig.behinderDefaultEncryptType")}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.behinder.pass")}
|
||||
text={
|
||||
(generateResult?.shellToolConfig as BehinderShellToolConfig)
|
||||
.pass
|
||||
}
|
||||
value={
|
||||
(generateResult?.shellToolConfig as BehinderShellToolConfig)
|
||||
.pass
|
||||
}
|
||||
text={(generateResult?.shellToolConfig as BehinderShellToolConfig).pass}
|
||||
value={(generateResult?.shellToolConfig as BehinderShellToolConfig).pass}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.behinder.header")}
|
||||
@@ -90,25 +79,13 @@ export function BasicInfo({
|
||||
<>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.godzilla.pass")}
|
||||
text={
|
||||
(generateResult?.shellToolConfig as GodzillaShellToolConfig)
|
||||
.pass
|
||||
}
|
||||
value={
|
||||
(generateResult?.shellToolConfig as GodzillaShellToolConfig)
|
||||
.pass
|
||||
}
|
||||
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).pass}
|
||||
value={(generateResult?.shellToolConfig as GodzillaShellToolConfig).pass}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.godzilla.key")}
|
||||
text={
|
||||
(generateResult?.shellToolConfig as GodzillaShellToolConfig)
|
||||
.key
|
||||
}
|
||||
value={
|
||||
(generateResult?.shellToolConfig as GodzillaShellToolConfig)
|
||||
.key
|
||||
}
|
||||
text={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
||||
value={(generateResult?.shellToolConfig as GodzillaShellToolConfig).key}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.godzilla.encryptor")}
|
||||
@@ -125,38 +102,27 @@ export function BasicInfo({
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{generateResult?.shellConfig.shellTool === ShellToolType.Command &&
|
||||
!isDubbo && (
|
||||
<Fragment>
|
||||
<CopyableField
|
||||
hidden={generateResult?.shellConfig.shellType.includes(
|
||||
"WebSocket",
|
||||
)}
|
||||
label={t("common:paramName")}
|
||||
text={
|
||||
(generateResult?.shellToolConfig as CommandShellToolConfig)
|
||||
.paramName
|
||||
}
|
||||
value={
|
||||
(generateResult?.shellToolConfig as CommandShellToolConfig)
|
||||
.paramName
|
||||
}
|
||||
/>
|
||||
<CopyableField
|
||||
hidden={
|
||||
!(
|
||||
generateResult?.shellConfig.shellType ===
|
||||
"BypassNginxWebSocket" ||
|
||||
generateResult?.shellConfig.shellType ===
|
||||
"BypassNginxJakartaWebSocket"
|
||||
)
|
||||
}
|
||||
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}`}
|
||||
/>
|
||||
</Fragment>
|
||||
)}
|
||||
{generateResult?.shellConfig.shellTool === ShellToolType.Command && !isDubbo && (
|
||||
<Fragment>
|
||||
<CopyableField
|
||||
hidden={generateResult?.shellConfig.shellType.includes("WebSocket")}
|
||||
label={t("common:paramName")}
|
||||
text={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
||||
value={(generateResult?.shellToolConfig as CommandShellToolConfig).paramName}
|
||||
/>
|
||||
<CopyableField
|
||||
hidden={
|
||||
!(
|
||||
generateResult?.shellConfig.shellType === "BypassNginxWebSocket" ||
|
||||
generateResult?.shellConfig.shellType === "BypassNginxJakartaWebSocket"
|
||||
)
|
||||
}
|
||||
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}`}
|
||||
/>
|
||||
</Fragment>
|
||||
)}
|
||||
{(generateResult?.shellConfig.shellTool === ShellToolType.Suo5 ||
|
||||
generateResult?.shellConfig.shellTool === ShellToolType.Suo5v2) && (
|
||||
<CopyableField
|
||||
@@ -176,14 +142,8 @@ export function BasicInfo({
|
||||
<>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.antSword.pass")}
|
||||
text={
|
||||
(generateResult?.shellToolConfig as AntSwordShellToolConfig)
|
||||
.pass
|
||||
}
|
||||
value={
|
||||
(generateResult?.shellToolConfig as AntSwordShellToolConfig)
|
||||
.pass
|
||||
}
|
||||
text={(generateResult?.shellToolConfig as AntSwordShellToolConfig).pass}
|
||||
value={(generateResult?.shellToolConfig as AntSwordShellToolConfig).pass}
|
||||
/>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.httpHeader")}
|
||||
@@ -192,14 +152,9 @@ export function BasicInfo({
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{generateResult?.shellConfig.shellTool ===
|
||||
ShellToolType.NeoreGeorg && (
|
||||
{generateResult?.shellConfig.shellTool === ShellToolType.NeoreGeorg && (
|
||||
<>
|
||||
<CopyableField
|
||||
label={t("shellToolConfig.neoreGeorgKey")}
|
||||
text="key"
|
||||
value="key"
|
||||
/>
|
||||
<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}`}
|
||||
@@ -209,7 +164,7 @@ export function BasicInfo({
|
||||
)}
|
||||
</div>
|
||||
<Separator className="my-1" />
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
||||
<div className="grid grid-cols-1 gap-2 md:grid-cols-2">
|
||||
<CopyableField
|
||||
label={t("mainConfig.injectorClassName")}
|
||||
value={generateResult?.injectorClassName}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { CircleHelpIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import type { MemShellResult } from "@/types/memshell";
|
||||
|
||||
import { ScrollTextIcon } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import { downloadBytes, formatBytes } from "@/lib/utils";
|
||||
import type { MemShellResult } from "@/types/memshell";
|
||||
|
||||
export function JarResult({
|
||||
packMethod,
|
||||
@@ -25,11 +27,10 @@ export function JarResult({
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ol className="list-decimal list-inside space-y-4 text-sm">
|
||||
<ol className="list-inside list-decimal space-y-4 text-sm">
|
||||
<li className="flex items-center justify-between">
|
||||
<span>
|
||||
{t("common:download")} {packMethod}Shell.jar (
|
||||
{formatBytes(atob(packResult).length)})
|
||||
{t("common:download")} {packMethod}Shell.jar ({formatBytes(atob(packResult).length)})
|
||||
</span>
|
||||
<Button
|
||||
size="sm"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { DownloadIcon } from "lucide-react";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import CodeViewer from "@/components/code-viewer";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
@@ -26,14 +27,9 @@ export function MultiPackResult({
|
||||
const showCode = packMethod === "JSP";
|
||||
const { t } = useTranslation();
|
||||
const packResults = allPackResults as Record<string, string> | undefined;
|
||||
const packMethods = useMemo(
|
||||
() => Object.keys(packResults ?? {}),
|
||||
[packResults],
|
||||
);
|
||||
const packMethods = useMemo(() => Object.keys(packResults ?? {}), [packResults]);
|
||||
|
||||
const [selectedMethod, setSelectedMethod] = useState(
|
||||
() => packMethods[0] ?? "",
|
||||
);
|
||||
const [selectedMethod, setSelectedMethod] = useState(() => packMethods[0] ?? "");
|
||||
|
||||
const packResult = useMemo(() => {
|
||||
if (!selectedMethod) {
|
||||
@@ -55,16 +51,12 @@ export function MultiPackResult({
|
||||
}, [packMethods, selectedMethod]);
|
||||
|
||||
const handleDownload = useCallback(() => {
|
||||
const fileName =
|
||||
shellClassName?.substring(shellClassName?.lastIndexOf(".") ?? 0) ?? "";
|
||||
const fileName = shellClassName?.substring(shellClassName?.lastIndexOf(".") ?? 0) ?? "";
|
||||
if (packMethod === "JSP") {
|
||||
const fileExtension = selectedMethod.includes("JSPX") ? ".jspx" : ".jsp";
|
||||
const content = new Blob([packResult], { type: "text/plain" });
|
||||
return downloadContent(content, fileName, fileExtension);
|
||||
} else if (
|
||||
packMethod === "JavaDeserialize" ||
|
||||
packMethod.includes("Hessian")
|
||||
) {
|
||||
} else if (packMethod === "JavaDeserialize" || packMethod.includes("Hessian")) {
|
||||
const content = new Blob([base64ToBytes(packResult)], {
|
||||
type: "application/octet-stream",
|
||||
});
|
||||
@@ -73,20 +65,13 @@ export function MultiPackResult({
|
||||
const base64Content = packResults?.[packMethods[0]] ?? "";
|
||||
return downloadBytes(base64Content, shellClassName);
|
||||
}
|
||||
}, [
|
||||
packMethod,
|
||||
packMethods,
|
||||
packResult,
|
||||
packResults,
|
||||
selectedMethod,
|
||||
shellClassName,
|
||||
]);
|
||||
}, [packMethod, packMethods, packResult, packResults, selectedMethod, shellClassName]);
|
||||
|
||||
return (
|
||||
<CodeViewer
|
||||
code={packResult ?? ""}
|
||||
header={
|
||||
<div className="flex items-center justify-between text-xs gap-2">
|
||||
<div className="flex items-center justify-between gap-2 text-xs">
|
||||
<Select
|
||||
onValueChange={(value) => {
|
||||
setSelectedMethod(value as string);
|
||||
@@ -94,9 +79,7 @@ export function MultiPackResult({
|
||||
value={selectedMethod}
|
||||
>
|
||||
<SelectTrigger className="h-7 text-xs [&_svg]:h-4 [&_svg]:w-4">
|
||||
<span className="text-muted-foreground">
|
||||
{t("common:packerMethod")}:
|
||||
</span>
|
||||
<span className="text-muted-foreground">{t("common:packerMethod")}: </span>
|
||||
<SelectValue data-placeholder={t("common:placeholders.select")} />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import CodeViewer from "@/components/code-viewer";
|
||||
import type { MemShellResult } from "@/types/memshell";
|
||||
|
||||
import { DownloadIcon } from "lucide-react";
|
||||
import { useCallback } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import CodeViewer from "@/components/code-viewer";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { base64ToBytes, downloadBytes, downloadContent } from "@/lib/utils";
|
||||
|
||||
import { AgentResult } from "./agent";
|
||||
import { JarResult } from "./jar-result";
|
||||
import { MultiPackResult } from "./multi-packer";
|
||||
import { useCallback } from "react";
|
||||
import { base64ToBytes, downloadBytes, downloadContent } from "@/lib/utils";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DownloadIcon } from "lucide-react";
|
||||
|
||||
export function ResultComponent({
|
||||
packResult,
|
||||
@@ -55,16 +58,12 @@ export function ResultComponent({
|
||||
const shellClassName = generateResult?.shellClassName;
|
||||
|
||||
const handleDownload = useCallback(() => {
|
||||
const fileName =
|
||||
shellClassName?.substring(shellClassName?.lastIndexOf(".") ?? 0) ?? "";
|
||||
const fileName = shellClassName?.substring(shellClassName?.lastIndexOf(".") ?? 0) ?? "";
|
||||
if (packMethod.includes("JSP")) {
|
||||
const fileExtension = packMethod.includes("JSPX") ? ".jspx" : ".jsp";
|
||||
const content = new Blob([packResult as string], { type: "text/plain" });
|
||||
return downloadContent(content, fileName, fileExtension);
|
||||
} else if (
|
||||
packMethod.includes("JavaCommons") ||
|
||||
packMethod.includes("Hessian")
|
||||
) {
|
||||
} else if (packMethod.includes("JavaCommons") || packMethod.includes("Hessian")) {
|
||||
const content = new Blob([base64ToBytes(packResult as string)], {
|
||||
type: "application/octet-stream",
|
||||
});
|
||||
@@ -78,7 +77,7 @@ export function ResultComponent({
|
||||
<CodeViewer
|
||||
code={packResult ?? ""}
|
||||
header={
|
||||
<div className="flex items-center justify-between text-xs gap-2">
|
||||
<div className="flex items-center justify-between gap-2 text-xs">
|
||||
<span>
|
||||
{t("common:packerMethod")}:{packMethod}
|
||||
</span>
|
||||
|
||||
Reference in New Issue
Block a user