Fix : MITM

This commit is contained in:
decolua 2026-03-05 21:13:09 +07:00
parent 1c3ba6ef69
commit f4e08fcd16
11 changed files with 497 additions and 150 deletions

View file

@ -2,6 +2,7 @@
import { NextResponse } from "next/server";
import { getMitmAlias, setMitmAliasAll } from "@/models";
import { getMitmStatus } from "@/mitm/manager";
// GET - Get MITM aliases for a tool
export async function GET(request) {
@ -25,6 +26,15 @@ export async function PUT(request) {
return NextResponse.json({ error: "tool and mappings required" }, { status: 400 });
}
// Check if DNS is enabled for this tool
const status = await getMitmStatus();
if (!status.dnsStatus || !status.dnsStatus[tool]) {
return NextResponse.json(
{ error: `DNS must be enabled for ${tool} before editing model mappings` },
{ status: 403 }
);
}
const filtered = {};
for (const [alias, model] of Object.entries(mappings)) {
if (model && model.trim()) {

View file

@ -31,7 +31,6 @@ export async function GET() {
pid: status.pid || null,
certExists: status.certExists || false,
dnsStatus: status.dnsStatus || {},
certCoversTools: status.certCoversTools || {},
hasCachedPassword: !!getCachedPassword(),
});
} catch (error) {