diff --git a/app/main/handlers/chromelauncher.js b/app/main/handlers/chromelauncher.js index 88911273cb..6e5c1c418d 100644 --- a/app/main/handlers/chromelauncher.js +++ b/app/main/handlers/chromelauncher.js @@ -129,7 +129,7 @@ module.exports = (win, getClient) => { }) ipcMain.handle("LaunchChromeWithParams", async (e, params) => { - const {port, host, chromePath, userDataDir, username, password} = params + const {port, host, chromePath, userDataDir, username, password, disableCACertPage} = params const portInt = parseInt(`${port}`) const hostRaw = `${host}` if (hostRaw === "undefined" || hostRaw.includes("/") || hostRaw.split(":").length > 1) { @@ -141,7 +141,7 @@ module.exports = (win, getClient) => { // --no-system-proxy-config-service ⊗ Do not use system proxy configuration service. // --no-proxy-server ⊗ Don't use a proxy server, always make direct connections. Overrides any other proxy server flags that are passed. ↪ let launchOpt = { - startingUrl: "http://mitm", // 确保在启动时打开 chrome://newtab 页面。 + startingUrl: disableCACertPage === false ? "http://mitm" : "chrome://newtab", // 确保在启动时打开 chrome://newtab 页面。 chromeFlags: [ `--no-system-proxy-config-service`, // 禁用系统代理配置服务。 `--proxy-bypass-list=<-loopback>`, // 为代理设置回避列表,不代理回环地址。 diff --git a/app/main/handlers/mitm.js b/app/main/handlers/mitm.js index 0c1c10d139..3e83ed62fe 100644 --- a/app/main/handlers/mitm.js +++ b/app/main/handlers/mitm.js @@ -215,7 +215,7 @@ module.exports = (win, getClient) => { ipcMain.handle("mitm-set-downstream-proxy", (e, downstreamProxy) => { if (stream) { stream.write({ - SetDownstreamProxy : true, + SetDownstreamProxy: true, downstreamProxy }) } @@ -233,7 +233,7 @@ module.exports = (win, getClient) => { // 开始调用 MITM,设置 stream let isFirstData = true - ipcMain.handle("mitm-start-call", (e, host, port, downstreamProxy, enableHttp2, ForceDisableKeepAlive,certificates, extra) => { + ipcMain.handle("mitm-start-call", (e, host, port, downstreamProxy, enableHttp2, ForceDisableKeepAlive, certificates, extra) => { if (stream) { if (win) { win.webContents.send("client-mitm-start-success") @@ -325,8 +325,9 @@ module.exports = (win, getClient) => { if (stream) { stream.write({ host, port, downstreamProxy, - enableHttp2, ForceDisableKeepAlive ,certificates, + enableHttp2, ForceDisableKeepAlive, certificates, ...extra, + DisableCACertPage: extra.disableCACertPage }) } }) diff --git a/app/renderer/src/main/src/pages/mitm/MITMChromeLauncher.tsx b/app/renderer/src/main/src/pages/mitm/MITMChromeLauncher.tsx index 71aef5c7fc..2a61df598f 100644 --- a/app/renderer/src/main/src/pages/mitm/MITMChromeLauncher.tsx +++ b/app/renderer/src/main/src/pages/mitm/MITMChromeLauncher.tsx @@ -24,11 +24,13 @@ interface ChromeLauncherButtonProp { onFished?: (host: string, port: number) => void isStartMITM?: boolean repRuleFlag?: boolean + disableCACertPage: boolean } interface MITMChromeLauncherProp { host?: string port?: number + disableCACertPage: boolean callback: (host: string, port: number) => void } @@ -84,7 +86,8 @@ const MITMChromeLauncher: React.FC = (props) => { userDataDir?: string username?: string password?: string - } = {...params, username, password, userDataDir} + disableCACertPage: boolean + } = {...params, username, password, userDataDir, disableCACertPage: props.disableCACertPage} setRemoteValue(RemoteGV.MITMUserDataSave, isSaveUserData + "") userDataDirRef.current.onSetRemoteValues(userDataDir) @@ -211,7 +214,7 @@ const MITMChromeLauncher: React.FC = (props) => { } const ChromeLauncherButton: React.FC = React.memo((props: ChromeLauncherButtonProp) => { - const {isStartMITM, host, port, onFished, repRuleFlag = false} = props + const {isStartMITM, host, port, onFished, repRuleFlag = false, disableCACertPage} = props const [started, setStarted] = useState(false) const [chromeVisible, setChromeVisible] = useState(false) @@ -319,6 +322,7 @@ const ChromeLauncherButton: React.FC = React.memo((pro { setChromeVisible(false) if (!isStartMITM) { diff --git a/app/renderer/src/main/src/pages/mitm/MITMPage.tsx b/app/renderer/src/main/src/pages/mitm/MITMPage.tsx index 0f2fd432b7..d992d3ffc4 100644 --- a/app/renderer/src/main/src/pages/mitm/MITMPage.tsx +++ b/app/renderer/src/main/src/pages/mitm/MITMPage.tsx @@ -80,6 +80,7 @@ export const MITMPage: React.FC = (props) => { const [addr, setAddr] = useState("") const [host, setHost] = useState("127.0.0.1") const [port, setPort] = useState(8083) + const [disableCACertPage, setDisableCACertPage] = useState(false) const [enableInitialMITMPlugin, setEnableInitialMITMPlugin] = useState(false) const [defaultPlugins, setDefaultPlugins] = useState([]) const [tip, setTip] = useState("") @@ -272,6 +273,7 @@ export const MITMPage: React.FC = (props) => { setAddr(`http://${host}:${port} 或 socks5://${host}:${port}`) setHost(host) setPort(port) + setDisableCACertPage(extra?.disableCACertPage || false) setDefaultPlugins(plugins) setEnableInitialMITMPlugin(enableInitialPlugin) startMITMServer(host, port, downstreamProxy, enableHttp2, ForceDisableKeepAlive, certs, extra) @@ -321,6 +323,7 @@ export const MITMPage: React.FC = (props) => { port={port} addr={addr} host={host} + disableCACertPage={disableCACertPage} status={status} setStatus={setStatus} defaultPlugins={defaultPlugins} @@ -420,6 +423,8 @@ export interface ExtraMITMServerProps { hosts: {Key: string; Value: string}[] /**@name 过滤WebSocket */ filterWebsocket: boolean + /**禁用初始页 */ + disableCACertPage: boolean } interface MITMServerProps { diff --git a/app/renderer/src/main/src/pages/mitm/MITMServerHijacking/MITMServerHijacking.tsx b/app/renderer/src/main/src/pages/mitm/MITMServerHijacking/MITMServerHijacking.tsx index f4c2d573f4..a2670a0d1a 100644 --- a/app/renderer/src/main/src/pages/mitm/MITMServerHijacking/MITMServerHijacking.tsx +++ b/app/renderer/src/main/src/pages/mitm/MITMServerHijacking/MITMServerHijacking.tsx @@ -35,6 +35,7 @@ export interface MITMServerHijackingProp { addr: string host: string port: number + disableCACertPage: boolean status: MITMStatus enableInitialMITMPlugin?: boolean defaultPlugins?: string[] @@ -65,6 +66,7 @@ export const MITMServerHijacking: React.FC = (props) => const { host, port, + disableCACertPage, addr, status, setStatus, @@ -219,7 +221,7 @@ export const MITMServerHijacking: React.FC = (props) => {/* 系统代理*/} {/**/}
- +
stop()} /> diff --git a/app/renderer/src/main/src/pages/mitm/MITMServerStartForm/MITMFormAdvancedConfiguration.tsx b/app/renderer/src/main/src/pages/mitm/MITMServerStartForm/MITMFormAdvancedConfiguration.tsx index 30af06294c..eebf22bc22 100644 --- a/app/renderer/src/main/src/pages/mitm/MITMServerStartForm/MITMFormAdvancedConfiguration.tsx +++ b/app/renderer/src/main/src/pages/mitm/MITMServerStartForm/MITMFormAdvancedConfiguration.tsx @@ -17,10 +17,11 @@ import {ExclamationCircleOutlined} from "@ant-design/icons" import {YakitSwitch} from "@/components/yakitUI/YakitSwitch/YakitSwitch" import {YakitAutoComplete} from "@/components/yakitUI/YakitAutoComplete/YakitAutoComplete" import {useWatch} from "antd/lib/form/Form" -import { YakitSelect } from "@/components/yakitUI/YakitSelect/YakitSelect" -import { YakitTag } from "@/components/yakitUI/YakitTag/YakitTag" -import { inputHTTPFuzzerHostConfigItem } from "@/pages/fuzzer/HTTPFuzzerHosts" +import {YakitSelect} from "@/components/yakitUI/YakitSelect/YakitSelect" +import {YakitTag} from "@/components/yakitUI/YakitTag/YakitTag" +import {inputHTTPFuzzerHostConfigItem} from "@/pages/fuzzer/HTTPFuzzerHosts" import {YakitRoute} from "@/enums/yakitRoute" +import {RemoteGV} from "@/yakitGV" const MITMAddTLS = React.lazy(() => import("./MITMAddTLS")) const MITMFiltersModal = React.lazy(() => import("./MITMFiltersModal")) @@ -45,6 +46,7 @@ export interface AdvancedConfigurationFromValue { dnsServers: string[] etcHosts: any[] filterWebsocket: boolean + disableCACertPage: boolean } const MITMFormAdvancedConfiguration: React.FC = React.memo( React.forwardRef((props, ref) => { @@ -58,10 +60,11 @@ const MITMFormAdvancedConfiguration: React.FC(false) const [proxyUsernameDef, setProxyUsernameDef] = useState() const [proxyPasswordDef, setProxyPasswordDef] = useState() - const [dnsServersDef,setDnsServersDef] = useState(["8.8.8.8", "114.114.114.114"]) - const [etcHostsDef,setEtcHostsDef] = useState([]) + const [dnsServersDef, setDnsServersDef] = useState(["8.8.8.8", "114.114.114.114"]) + const [etcHostsDef, setEtcHostsDef] = useState([]) const [etcHosts, setEtcHosts] = useState([]) const [filterWebsocketDef, setFilterWebsocketDef] = useState(false) + const [disableCACertPageDef, setDisableCACertPageDef] = useState(false) const [certificateFormVisible, setCertificateFormVisible] = useState(false) const [filtersVisible, setFiltersVisible] = useState(false) @@ -76,7 +79,7 @@ const MITMFormAdvancedConfiguration: React.FC { const v = form.getFieldsValue() if (Object.keys(v).length > 0) { - return {...v,etcHosts} + return {...v, etcHosts} } else { return { certs: certsDef, @@ -87,7 +90,8 @@ const MITMFormAdvancedConfiguration: React.FC { + const v = e === "true" ? true : false + setDisableCACertPageDef(v) + form.setFieldsValue({disableCACertPage: v}) + }) }, [visible]) /** * @description 单个导出证书 @@ -254,29 +265,31 @@ const MITMFormAdvancedConfiguration: React.FC { + const onClose = useMemoizedFn((jumpPage?: boolean) => { const formValue = form.getFieldsValue() - const oldValue:any = { + const oldValue: any = { certs: certsDef, dnsServers: dnsServersDef, - etcHosts:etcHostsDef, + etcHosts: etcHostsDef, enableProxyAuth: enableProxyAuthDef, filterWebsocket: filterWebsocketDef, + disableCACertPage: disableCACertPageDef, proxyUsername: proxyUsernameDef, - proxyPassword: proxyPasswordDef, + proxyPassword: proxyPasswordDef } - if(enableGMTLS){ + if (enableGMTLS) { oldValue.preferGMTLS = preferGMTLSDef oldValue.onlyEnableGMTLS = onlyEnableGMTLSDef } const newValue = { certs, ...formValue, - proxyUsername:formValue.proxyUsername||'', - proxyPassword:formValue.proxyPassword||'', + proxyUsername: formValue.proxyUsername || "", + proxyPassword: formValue.proxyPassword || "", etcHosts } if (JSON.stringify(oldValue) !== JSON.stringify(newValue)) { @@ -300,18 +313,18 @@ const MITMFormAdvancedConfiguration: React.FC { onSaveSetting() - jumpPage&&ipcRenderer.invoke("open-route-page", {route: YakitRoute.Beta_ConfigNetwork}) + jumpPage && ipcRenderer.invoke("open-route-page", {route: YakitRoute.Beta_ConfigNetwork}) }, onCancel: () => { setVisible(false) - jumpPage&&ipcRenderer.invoke("open-route-page", {route: YakitRoute.Beta_ConfigNetwork}) + jumpPage && ipcRenderer.invoke("open-route-page", {route: YakitRoute.Beta_ConfigNetwork}) }, cancelButtonProps: {size: "small", className: "modal-cancel-button"}, okButtonProps: {size: "small", className: "modal-ok-button"} }) } else { setVisible(false) - jumpPage&&ipcRenderer.invoke("open-route-page", {route: YakitRoute.Beta_ConfigNetwork}) + jumpPage && ipcRenderer.invoke("open-route-page", {route: YakitRoute.Beta_ConfigNetwork}) } }) return ( @@ -341,45 +354,45 @@ const MITMFormAdvancedConfiguration: React.FC
- - { - return {value: i, label: i} - })} - mode='tags' - allowClear={true} - placeholder={"例如 1.1.1.1"} - /> - - - - { - inputHTTPFuzzerHostConfigItem((obj) => { - setEtcHosts([...etcHosts.filter((i) => i.Key !== obj.Key), obj]) - }) - }} - > - 添加 Hosts 映射 - - {etcHosts.map((i, n) => ( - { - setEtcHosts(etcHosts.filter((j) => j.Key !== i.Key)) + + { + return {value: i, label: i} + })} + mode='tags' + allowClear={true} + placeholder={"例如 1.1.1.1"} + /> + + + + { + inputHTTPFuzzerHostConfigItem((obj) => { + setEtcHosts([...etcHosts.filter((i) => i.Key !== obj.Key), obj]) + }) }} - key={`${i.Key}-${n}`} > - {`${i.Key} => ${i.Value}`} - - ))} - - + 添加 Hosts 映射 + + {etcHosts.map((i, n) => ( + { + setEtcHosts(etcHosts.filter((j) => j.Key !== i.Key)) + }} + key={`${i.Key}-${n}`} + > + {`${i.Key} => ${i.Value}`} + + ))} + + {enableGMTLS && ( <> )} + + + diff --git a/app/renderer/src/main/src/pages/mitm/MITMServerStartForm/MITMServerStartForm.tsx b/app/renderer/src/main/src/pages/mitm/MITMServerStartForm/MITMServerStartForm.tsx index 4dcfcf63bb..9e5ab401c3 100644 --- a/app/renderer/src/main/src/pages/mitm/MITMServerStartForm/MITMServerStartForm.tsx +++ b/app/renderer/src/main/src/pages/mitm/MITMServerStartForm/MITMServerStartForm.tsx @@ -25,11 +25,9 @@ import {YakitModal} from "@/components/yakitUI/YakitModal/YakitModal" import {YakitInput} from "@/components/yakitUI/YakitInput/YakitInput" import {YakitAutoCompleteRefProps} from "@/components/yakitUI/YakitAutoComplete/YakitAutoCompleteType" import {CacheDropDownGV} from "@/yakitGV" -import emiter from "@/utils/eventBus/eventBus" import {PageNodeItemProps, usePageInfo} from "@/store/pageInfo" import {shallow} from "zustand/shallow" import {YakitRoute} from "@/enums/yakitRoute" -import {onSetRemoteValuesBase} from "@/components/yakitUI/utils" import {YakitRadioButtons} from "@/components/yakitUI/YakitRadioButtons/YakitRadioButtons" const MITMFormAdvancedConfiguration = React.lazy(() => import("./MITMFormAdvancedConfiguration")) const ChromeLauncherButton = React.lazy(() => import("../MITMChromeLauncher")) @@ -199,7 +197,8 @@ export const MITMServerStartForm: React.FC = React.memo proxyPassword: params.proxyPassword, dnsServers: params.dnsServers, hosts: params.etcHosts, - filterWebsocket: params.filterWebsocket + filterWebsocket: params.filterWebsocket, + disableCACertPage: params.disableCACertPage } if (params.stateSecretHijacking === "enableGMTLS") { extra.enableGMTLS = true @@ -400,6 +399,7 @@ export const MITMServerStartForm: React.FC = React.memo { const values = { ...form.getFieldsValue(), diff --git a/app/renderer/src/main/src/yakitGV.ts b/app/renderer/src/main/src/yakitGV.ts index 0f96e5aaf4..8857b988e5 100644 --- a/app/renderer/src/main/src/yakitGV.ts +++ b/app/renderer/src/main/src/yakitGV.ts @@ -103,7 +103,9 @@ export enum RemoteGV { /**@name 端口监听器缓存的监听主机 */ ReverseShellReceiverHostList="reverse-shell-receiver-host-list", /**@name YakitDraggerContent组件限制文件大小 */ - YakitDraggerContentFileLimit = "yakit_dragger_content_file_limit" + YakitDraggerContentFileLimit = "yakit_dragger_content_file_limit", + /**@name mitm禁用初始页 */ + MITMDisableCACertPage = "mitm_disable_CACertPage", } /** 项目逻辑全局变量 */