Fix : MITM
This commit is contained in:
parent
1c3ba6ef69
commit
f4e08fcd16
11 changed files with 497 additions and 150 deletions
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue