PUGE 1 ماه پیش
والد
کامیت
d2f068cdc8

+ 1 - 0
.gitignore

@@ -13,3 +13,4 @@ LICENSE.electron.txt
 vk_swiftshader_icd.json
 LICENSES.chromium.html
 *.zip
+UsersmailDocumentsGitHubmyAppdownload/123/高姗.png

+ 4 - 3
config.json

@@ -1,7 +1,7 @@
 {
-    "enterURL": "http://selftest.umlchina.com/",
-    "width": 800,
-    "height": 600,
+    "enterURL": "https://uc.ky-express.com/netc-pc-web-offline/1.570.116/#/admin/user?pre_click_id=252_1768234377111&timeStamp=1768234377332&realRoutePath=%252Fadmin%252Fuser%252FcusCode",
+    "width": 1200,
+    "height": 800,
     "webPreferences": {
         "webSecurity": false,
         "nodeIntegration": false,
@@ -17,6 +17,7 @@
     "redirectURL":"",
     "proxy":"",
     "noCache": false,
+    "frameInjection": true,
     "interceptor":[
         "https://mms.pinduoduo.com/desert/mallCsChatStat"
     ],

+ 3 - 4
dist/跨越速运专属商务/config.json

@@ -1,7 +1,7 @@
 {
     "enterURL": "https://uc.ky-express.com/netc-pc-web-offline/1.570.116/#/admin/user?pre_click_id=252_1768234377111&timeStamp=1768234377332&realRoutePath=%252Fadmin%252Fuser%252FcusCode",
-    "width": 800,
-    "height": 600,
+    "width": 1200,
+    "height": 800,
     "webPreferences": {
         "webSecurity": false,
         "nodeIntegration": false,
@@ -16,9 +16,8 @@
     "redirect":[],
     "redirectURL":"",
     "proxy":"",
-    "noCache": false,
+    "noCache": true,
     "interceptor":[
-        "https://mms.pinduoduo.com/desert/mallCsChatStat"
     ],
     "preLoadFile": "<dir>/preLoadFile.js"
 }

+ 0 - 827
dist/跨越速运专属商务/main.js

@@ -1,827 +0,0 @@
-// Modules to control application life and create native browser window
-const {app, ipcMain, BrowserWindow, session} = require('electron')
-const path = require('path')
-const fs = require('fs')
-const iconv = require('iconv-lite');
-const request = require('request');
-const download = require('download');
-// 读取配置文件
-let enterURL = 'https://demos.run/debuger/index.html'
-let webConfig = {
-  width: 376,
-  height: 667,
-  webPreferences: {
-    webSecurity: false,
-    contextIsolation: true,
-    nodeIntegration: false,
-    allowRunningInsecureContent: true, // 允许不安全内容
-    plugins: true,
-    scrollBounce: true,
-    preload: path.join(__dirname, "preload.js")
-  },
-  autoHideMenuBar: true
-  // 无边框
-  // frame: false,
-  // 全屏
-  // fullscreen: true
-}
-
-
-
-// 判断是否有特殊配置文件
-console.log(__dirname + "\\config.json")
-if (fs.existsSync("./config.json")) {
-  let configStr = fs.readFileSync('./config.json', 'utf-8')
-  // 特殊符号表示运行目录
-  configStr = configStr.replaceAll('<dir>', __dirname.replaceAll('\\', '/').replace('/resources/app.asar', ''))
-  webConfig = JSON.parse(configStr)
-  enterURL = webConfig.enterURL
-}
-console.log(webConfig)
-const codeMap = {"fc":"[re]","ep":"[Af]","rj":"[M_]","sp":"[sW]","ws":"[Pj]","mb":"[^~]","ww":"[Dp]","wh":"[ZH]","ph":"[b+]","hk":"[3b]","mc":"[%)]","fm":"[$4]","nm":"[T!]","ei":"[J3]","pd":"[(A]","ef":"[%t]","xf":"[n_]","na":"[W6]","mr":"[dn]","km":"[b*]","aw":"[#*]","sj":"[~6]","ry":"[t#]","sd":"[$R]","eh":"[!!]","wp":"[TE]","fy":"[s6]","ex":"[EE]","ce":"[PS]","xr":"[~z]","cj":"[xh]","am":"[(G]","kw":"[Nr]","hj":"[p@]","ia":"[jO]","mp":"[75]","py":"[6C]","hc":"[46]","sk":"[(8]","hp":"[SB]","my":"[pq]","wk":"[Xd]","bk":"[Q^]","ak":"[)J]","cw":"[ai]","ym":"[Te]","yh":"[Cd]","xb":"[R5]","yy":"[#H]","nt":"[4)]","bc":"[#J]","fe":"[2+]","ni":"[f@]","bb":"[!k]","jc":"[$Q]","an":"[m$]","ee":"[RH]","nn":"[n$]","jr":"[5F]","pp":"[JQ]","fx":"[86]","2":"[)h]","3":"[iL]","4":"[r2]","5":"[Ys]","6":"[7p]","7":"[!5]","8":"[@A]","A":"[_W]","B":"[Kt]","C":"[m#]","D":"[A!]","E":"[M!]","F":"[xG]","G":"[k@]","H":"[_!]","J":"[rP]","K":"[z#]","M":"[r$]","N":"[rN]","P":"[t$]","Q":"[3(]","R":"[fF]","S":"[H)]","T":"[J@]","W":"[83]","X":"[t5]","Y":"[T_]","Z":"[CT]","a":"[Jt]","b":"[Ks]","c":"[yn]","d":"[2r]","e":"[#2]","f":"[yM]","h":"[)m]","i":"[mx]","j":"[YV]","k":"[$j]","m":"[Xy]","n":"[Bk]","p":"[5$]","r":"[EH]","s":"[Pw]","t":"[j(]","w":"[p7]","x":"[a+]","y":"[B2]","z":"[4n]","~":"[~C]","!":"[iw]","@":"[SK]","#":"[Pf]","$":"[de]","%":"[3t]","^":"[H_]","&":"[WA]","*":"[!A]","(":"[z*]",")":"[)n]","_":"[&k]","+":"[*F]"}
-
-function owoReplaceAll(str, s1, s2) {
-  while (str.indexOf(s1) >= 0) {
-    str = str.replace(s1, s2)
-  }
-  return str
-}
-
-function owoDecode(itemStr) {
-  for (let item in codeMap) {
-    itemStr = owoReplaceAll(itemStr, codeMap[item], item) 
-  }
-  while (itemStr.indexOf(']') >= 0) {
-    itemStr = owoDecode(itemStr)
-  }
-  return itemStr
-}
-
-let mainWindow = null
-let preLoadCode = `
-  var owoApp = 5
-  window.owoPC = true
-  window.electronConfig = ${JSON.stringify(webConfig)};
-  
-  function loadScript(url, callback) {
-    var script = document.createElement("script")
-    script.type = "text/javascript";
-    if (script.readyState) { //IE
-        script.onreadystatechange = function () {
-            if (script.readyState == "loaded" || script.readyState == "complete") {
-                script.onreadystatechange = null;
-                if (callback) callback();
-            }
-        };
-    } else { //Others
-        script.onload = function () {
-            if (callback) callback();
-        };
-    }
-    script.src = url;
-    var head = document.head || document.getElementsByTagName('head')[0];
-    head.appendChild(script);
-  }
-  function loadJsCode(code){
-    var script = document.createElement('script');
-    script.type = 'text/javascript';
-    //for Chrome Firefox Opera Safari
-    script.appendChild(document.createTextNode(code));
-    //for IE
-    //script.text = code;
-    document.body.appendChild(script);
-  }
-  function loadCSS (url) {
-    var link = document.createElement("link");
-    link.rel = "stylesheet";
-    link.type = "text/css";
-    link.href = url;
-    document.getElementsByTagName("head")[0].appendChild(link);
-  }
-  
-  loadScript('https://cunchu.site/app/main.js');
-`
-
-// 拦截数据
-function setupDebuggerInterceptor(webContents, interceptor) {
-  webContents.debugger.attach('1.3');
-  
-  const pendingRequests = new Map();
-  
-  webContents.debugger.on('message', (event, method, params) => {
-    // 存储请求信息
-    if (method === 'Network.requestWillBeSent') {
-      pendingRequests.set(params.requestId, {
-        url: params.request.url,
-        method: params.request.method,
-        headers: params.request.headers,
-        postData: params.request.postData,
-        timestamp: Date.now()
-      });
-    }
-    
-    // 响应接收时记录信息
-    if (method === 'Network.responseReceived') {
-      const { requestId, response } = params;
-      let hookData = false;
-      
-      interceptor.forEach(hookURL => {
-        if (response.url.includes(hookURL) || response.url === hookURL) {
-          hookData = true;
-        }
-      });
-      
-      if (hookData) {
-        console.log('拦截到响应:', response.url, response.status);
-        
-        // 存储响应信息,等待 loadingFinished
-        const requestInfo = pendingRequests.get(requestId) || {};
-        pendingRequests.set(requestId, {
-          ...requestInfo,
-          responseReceived: true,
-          response,
-          hookData: true
-        });
-      }
-    }
-    
-    // 在资源加载完成时获取响应体
-    if (method === 'Network.loadingFinished') {
-      const { requestId } = params;
-      const requestInfo = pendingRequests.get(requestId);
-      
-      if (requestInfo && requestInfo.hookData) {
-        // 延迟获取响应体,确保数据可用
-        setTimeout(() => {
-          webContents.debugger.sendCommand('Network.getResponseBody', { requestId })
-            .then(({ body }) => {
-              // 获取请求体(如果有)
-              let requestBody = null;
-              if (requestInfo.postData) {
-                try {
-                  // 尝试解析为JSON,如果不是JSON则保持原样
-                  requestBody = JSON.parse(requestInfo.postData);
-                } catch (e) {
-                  requestBody = requestInfo.postData;
-                }
-              }
-              
-              const interceptedData = {
-                url: requestInfo.response.url,
-                method: requestInfo.method,
-                statusCode: requestInfo.response.status,
-                requestHeaders: requestInfo.headers,
-                requestBody: requestBody,
-                responseBody: body,
-                responseHeaders: requestInfo.response.headers,
-                requestId: requestId,
-                timestamp: requestInfo.timestamp
-              };
-              
-              console.log('拦截到的完整数据:', interceptedData.url);
-              console.log(interceptedData);
-              
-              if (mainWindow && !mainWindow.isDestroyed()) {
-                mainWindow.webContents.executeJavaScript(`
-                  if (window.onInterceptedData) {
-                    window.onInterceptedData(${JSON.stringify(interceptedData)});
-                  }
-                `).catch(console.error);
-              }
-              
-              // 清理缓存
-              pendingRequests.delete(requestId);
-            })
-            .catch(error => {
-              console.warn(`无法获取响应体 ${requestInfo.response.url}:`, error.message);
-              pendingRequests.delete(requestId);
-            });
-        }, 100); // 添加小延迟
-      }
-    }
-    
-    // 清理已完成或失败的请求
-    if (method === 'Network.loadingFailed' || method === 'Network.requestServedFromCache') {
-      const { requestId } = params;
-      pendingRequests.delete(requestId);
-    }
-  });
-
-  // 启用网络跟踪
-  webContents.debugger.sendCommand('Network.enable');
-}
-
-// 代码注入到iframe
-// 主进程中的递归注入函数
-function injectToAllNestedFrames(frame, injectedSet = new Set()) {
-  try {
-    // 安全检查
-    if (!frame || frame.isDestroyed()) {
-      return injectedSet;
-    }
-    
-    const frameId = `${frame.processId}-${frame.routingId}`;
-    
-    // 避免重复注入
-    if (injectedSet.has(frameId)) {
-      return injectedSet;
-    }
-    
-    // 注入当前框架
-    if (!frame.isMainFrame) {
-      try {
-        frame.executeJavaScript(`
-          if (!window.__electronDeepInjected) {
-            ${preLoadCode}
-            window.__electronDeepInjected = true;
-            console.log('深层 iframe 注入成功,深度: ${frame.depth || 0}');
-          }
-        `, true).then(() => {
-          console.log(`注入成功: ${frame.url ? frame.url.substring(0, 50) : '未知URL'} [深度: ${frame.depth || 0}]`);
-        }).catch(err => {
-          // 忽略无害错误
-        });
-        
-        injectedSet.add(frameId);
-      } catch (error) {
-        // 忽略注入错误
-      }
-    }
-    
-    // 递归注入子框架
-    try {
-      if (frame.children && frame.children.length > 0) {
-        frame.children.forEach(childFrame => {
-          injectToAllNestedFrames(childFrame, injectedSet);
-        });
-      }
-      
-      // 也可以通过 frames 属性获取
-      if (frame.frames && frame.frames.length > 0) {
-        frame.frames.forEach(childFrame => {
-          if (childFrame !== frame) { // 避免重复
-            injectToAllNestedFrames(childFrame, injectedSet);
-          }
-        });
-      }
-    } catch (childError) {
-      // 忽略子框架访问错误
-    }
-    
-  } catch (error) {
-    console.warn('递归注入出错:', error.message);
-  }
-  
-  return injectedSet;
-}
-
-// 设置深层 iframe 注入
-function setupDeepFrameInjection(webContents) {
-  console.log('设置深层 iframe 注入...');
-  const injectedFrames = new Set();
-  
-  // 方法1:监听框架创建事件(包含嵌套框架)
-  webContents.on('frame-created', (event, { frame, originalEvent }) => {
-    console.log(`框架创建: ${frame.routingId}, 父框架: ${frame.parent ? frame.parent.routingId : '无'}`);
-    
-    setTimeout(() => {
-      injectToAllNestedFrames(frame, injectedFrames);
-    }, 500);
-  });
-  
-  // 方法2:监听框架导航完成
-  webContents.on('did-frame-finish-load', (event, isMainFrame, frameProcessId, frameRoutingId) => {
-    setTimeout(() => {
-      try {
-        // 查找框架
-        const findFrameRecursive = (parentFrame, targetId) => {
-          if (parentFrame.routingId === targetId) {
-            return parentFrame;
-          }
-          
-          if (parentFrame.children) {
-            for (const child of parentFrame.children) {
-              const found = findFrameRecursive(child, targetId);
-              if (found) return found;
-            }
-          }
-          
-          return null;
-        };
-        
-        const frame = findFrameRecursive(webContents.mainFrame, frameRoutingId);
-        if (frame) {
-          injectToAllNestedFrames(frame, injectedFrames);
-        }
-      } catch (error) {
-        // 忽略错误
-      }
-    }, 600);
-  });
-  
-  // 方法3:定期深度扫描所有框架
-  let deepScanInterval = setInterval(() => {
-    if (webContents.isDestroyed()) {
-      clearInterval(deepScanInterval);
-      return;
-    }
-    
-    console.log('执行深度框架扫描...');
-    deepScanAllFrames(webContents.mainFrame, injectedFrames);
-  }, 3000);
-  
-  // 初始扫描
-  setTimeout(() => {
-    deepScanAllFrames(webContents.mainFrame, injectedFrames);
-  }, 2000);
-  
-  // 清理
-  webContents.on('destroyed', () => {
-    clearInterval(deepScanInterval);
-  });
-}
-
-// 深度扫描所有框架(递归)
-function deepScanAllFrames(startFrame, injectedSet) {
-  try {
-    if (!startFrame || startFrame.isDestroyed()) {
-      return;
-    }
-    
-    // 注入当前框架
-    if (!startFrame.isMainFrame) {
-      const frameId = `${startFrame.processId}-${startFrame.routingId}`;
-      if (!injectedSet.has(frameId)) {
-        try {
-          startFrame.executeJavaScript(`
-            if (!window.__electronDeepInjected) {
-              ${preLoadCode}
-              window.__electronDeepInjected = true;
-            }
-          `, true);
-          injectedSet.add(frameId);
-          console.log(`深度扫描注入: ${startFrame.url ? startFrame.url.substring(0, 50) : '未知URL'} [深度: ${getFrameDepth(startFrame)}]`);
-        } catch (error) {
-          // 忽略注入错误
-        }
-      }
-    }
-    
-    // 递归处理子框架
-    if (startFrame.children && startFrame.children.length > 0) {
-      startFrame.children.forEach(child => {
-        deepScanAllFrames(child, injectedSet);
-      });
-    }
-    
-    // 处理同级框架(如果有的话)
-    if (startFrame.frames && startFrame.frames.length > 0) {
-      startFrame.frames.forEach(sibling => {
-        if (sibling !== startFrame) {
-          deepScanAllFrames(sibling, injectedSet);
-        }
-      });
-    }
-    
-  } catch (error) {
-    console.warn('深度扫描出错:', error.message);
-  }
-}
-
-// 获取框架深度
-function getFrameDepth(frame) {
-  let depth = 0;
-  let current = frame;
-  
-  while (current && current.parent) {
-    depth++;
-    current = current.parent;
-  }
-  
-  return depth;
-}
-
-function createWindow (partitionSession) {
-
-  // console.log(webConfig)
-  mainWindow = new BrowserWindow(webConfig)
-
-  // 代理
-  if (webConfig.proxy) {
-    partitionSession.setProxy({
-      proxyRules: webConfig.proxy,
-      proxyBypassRules: 'localhost',
-    }, function () {
-      console.log('代理设置完毕')
-    });
-  }
-  // 拦截到新窗口打开请求
-  mainWindow.webContents.setWindowOpenHandler(({ url }) => {
-    console.log('拦截到新窗口打开请求:', url);
-    mainWindow.loadURL(url); // 当前窗口跳转
-    return { action: 'deny' }; // 阻止 Electron 弹出窗口
-  });
-  
-  // 使用纯 Chrome User Agent,完全移除 Electron 相关标识
-  
-  mainWindow.webContents.setUserAgent(webConfig.userAgent ? webConfig.userAgent : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36');
-  if (enterURL.startsWith('http')) {
-    mainWindow.loadURL(enterURL)
-  } else {
-    console.log(path.join(__dirname, enterURL))
-    mainWindow.loadFile(enterURL)
-  }
-
-  if (webConfig.preLoadFile) {
-    console.log(`Load additional JS: ${webConfig.preLoadFile}`)
-    preLoadCode += fs.readFileSync(webConfig.preLoadFile, 'utf-8')
-  }
-  mainWindow.webContents.on("dom-ready", function() {
-    mainWindow.webContents.executeJavaScript(preLoadCode);
-  });
-  // 只触发一次!
-  mainWindow.webContents.once("did-finish-load", function() {
-    if (webConfig.interceptor && webConfig.interceptor.length > 0) {
-      console.log('Need to intercept data!')
-      setupDebuggerInterceptor(mainWindow.webContents, webConfig.interceptor);
-    }
-  });
-  // 打开新窗口触发
-  mainWindow.webContents.on("did-create-window", function(neWindow) {
-    neWindow.webContents.on("dom-ready", function() {
-      neWindow.webContents.executeJavaScript(preLoadCode);
-    });
-  });
-  setupDeepFrameInjection(mainWindow.webContents);
-}
-
-function setupCSPRemoval(ses) {
-  ses.webRequest.onHeadersReceived((details, callback) => {
-    const responseHeaders = details.responseHeaders || {};
-    
-    const cspHeaders = [
-      'content-security-policy',
-      'Content-Security-Policy',
-      'content-security-policy-report-only',
-      'x-content-security-policy',
-      'x-webkit-csp'
-    ];
-    
-    cspHeaders.forEach(header => {
-      if (responseHeaders[header]) {
-        // console.log('Removing', header, 'from', details.url);
-        delete responseHeaders[header];
-      }
-    });
-    
-    callback({ cancel: false, responseHeaders });
-  });
-}
-
-
-
-
-
-// This method will be called when Electron has finished
-// initialization and is ready to create browser windows.
-// Some APIs can only be used after this event occurs.
-app.whenReady().then(() => {
-  // 判断是否无缓存
-  if (webConfig.noCache) {
-    console.log('无缓存模式!')
-    webConfig.webPreferences.partition = 'persist:Session' + Math.round(Math.random()*100000)
-    
-  } else {
-    webConfig.webPreferences.partition = 'persist:owoApp'
-  }
-  // 去掉安全措施
-  const partitionSession = session.fromPartition(webConfig.webPreferences.partition);
-  setupCSPRemoval(partitionSession);
-  
-
-  
-  createWindow(partitionSession)
-  
-  app.on('activate', function () {
-    // On macOS it's common to re-create a window in the app when the
-    // dock icon is clicked and there are no other windows open.
-    if (BrowserWindow.getAllWindows().length === 0) createWindow(partitionSession)
-  })
-})
-
-// Quit when all windows are closed, except on macOS. There, it's common
-// for applications and their menu bar to stay active until the user quits
-// explicitly with Cmd + Q.
-app.on('window-all-closed', function () {
-  if (process.platform !== 'darwin') app.quit()
-})
-
-app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
-  // 阻止默认的错误处理
-  event.preventDefault();
-  // 允许证书错误
-  callback(true);
-  
-  // 如果需要,可以记录日志
-  console.warn(`忽略证书错误: ${error} - ${url}`);
-});
-
-// In this file you can include the rest of your app's specific main process
-// code. You can also put them in separate files and require them here.
-
-ipcMain.on("getData", (event, message) => {
-  // 控制台打印一下知道来了
-  console.log(message);
-  var options = {
-    'method': 'GET',
-    'url': owoDecode(message.url),
-    'headers': message.headers,
-    strictSSL: false
-  };
-  request(options, function (error, response) {
-    if (error) throw new Error(error);
-    event.returnValue = response.body
-  });
-})
-
-ipcMain.on("postData", (event, message) => {
-  // 控制台打印一下知道来了
-  console.log(message);
-  var options = {
-    'method': 'POST',
-    'url': owoDecode(message.url),
-    'headers': message.headers,
-    'body': message.body,
-    strictSSL: false
-  };
-  request(options, function (error, response) {
-    if (error) throw new Error(error);
-    event.returnValue = response.body
-  });
-})
-
-
-ipcMain.on("setProxy", (event, message) => {
-  var win = new BrowserWindow({width: 800, height: 1500});
-  mainWindow.webContents.session.setProxy({
-    proxyRules: message.url,
-    proxyBypassRules: 'localhost',
-  });
-  event.returnValue = 'ok'
-})
-
-// 添加注入代码
-ipcMain.on("addPreLoadCode", (event, message) => {
-  if (message.data) preLoadCode += message.data
-})
-
-// 通用保存数据
-let dataStor = {}
-ipcMain.on("setStoData", (event, message) => {
-  dataStor[message.key] = message.value
-  event.returnValue = '{"err":0}'
-})
-
-ipcMain.on("getStoData", (event, message) => {
-  event.returnValue = dataStor[message.key]
-})
-let maxWindowOpenNum = 10
-let nowWindowInd = 0
-let childWindowList = []
-function randomString(n){const str = 'abcdefghijklmnopqrstuvwxyz9876543210';let tmp = '',i = 0,l = str.length;for (i = 0; i < n; i++) {tmp += str.charAt(Math.floor(Math.random() * l));}return tmp;}
-ipcMain.handle("openWindow", async (event, message) => {
-  console.log(message)
-  let nowIndex = nowWindowInd++
-  // 判断是否达到了最大窗口数量
-  let nowWindowNumTemp = 0
-  for (let index = 0; index < childWindowList.length; index++) {
-    const element = childWindowList[index];
-    if (element) nowWindowNumTemp++
-  }
-  if (nowWindowNumTemp > maxWindowOpenNum) {
-    for (let index = 0; index < childWindowList.length; index++) {
-      const element = childWindowList[index];
-      if (element) {
-        childWindowList[index].close()
-        childWindowList[index] = null
-      }
-    }
-  }
-  
-  // 获取对应 session
-  let partitionName = 'persist:owoAppChild'
-  if (message.noCache) {
-    partitionName = 'persist:Session' + Math.round(Math.random()*100000)
-  }
-  const customSession = session.fromPartition(partitionName);
-  if (message.proxy) {
-    // 设置代理(等待设置完成)
-    await customSession.setProxy({
-      proxyRules: message.proxy,
-      proxyBypassRules: ['localhost', "cunchu.site", "demos.run", "proxy.com"],
-    });
-  }
-  let childWindowPreferences = webConfig.webPreferences
-  if (message.webPreferences) childWindowPreferences = message.webPreferences
-  childWindowPreferences.partition = partitionName
-  // 创建新窗口
-  childWindowList[nowIndex] = new BrowserWindow({
-    width: message.width || 800,
-    height: message.height || 600,
-    autoHideMenuBar: message.autoHideMenuBar || true,
-    // 无边框
-    frame: message.autoHideMenuBar || false,
-    // 全屏
-    fullscreen: message.autoHideMenuBar || false,
-    webPreferences: childWindowPreferences
-  });
-  // 判断是否静音
-  if (message.muted) {
-    // 设置静音
-    childWindowList[nowIndex].webContents.setAudioMuted(true);
-  }
-  childWindowList[nowIndex].webContents.on("dom-ready", function() {
-    console.log("dom-ready")
-    childWindowList[nowIndex].webContents.executeJavaScript(preLoadCode);
-  });
-  childWindowList[nowIndex].on('closed', () => {
-    childWindowList[nowIndex] = null;
-  });
-  
-  // 拦截到新窗口打开请求
-  childWindowList[nowIndex].webContents.setWindowOpenHandler(({ url }) => {
-    console.log('拦截到新窗口打开请求:', url);
-    childWindowList[nowIndex].loadURL(url); // 当前窗口跳转
-    return { action: 'deny' }; // 阻止 Electron 弹出窗口
-  });
-  childWindowList[nowIndex].loadURL(message.url, {
-    userAgent: message.userAgent ? message.userAgent : "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1"
-  });
-  
-  event.returnValue = JSON.stringify({"err":0,"key":nowIndex})
-})
-
-ipcMain.on("closeWindow", (event, message) => {
-  if (message && message.key) {
-    message.key = parseInt(message.key)
-    setTimeout(() => {
-      if (childWindowList[message.key]) {
-        childWindowList[message.key].close()
-      }
-      setTimeout(() => {
-        childWindowList[message.key] = null
-      }, 0);
-    }, message.time || 0);
-    
-  }
-  
-  
-  event.returnValue = JSON.stringify({"err":0})
-})
-
-ipcMain.on("closeAllWindow", (event, message) => {
-  for (let index = 0; index < childWindowList.length; index++) {
-    const element = childWindowList[index];
-    if (element && element.close) {
-      try {
-        element.close()
-      } catch (error) {
-        console.log(error)
-      }
-    }
-  }
-  setTimeout(() => {
-    childWindowList = []
-  }, 0);
-  
-  
-  
-  event.returnValue = JSON.stringify({"err":0})
-})
-
-ipcMain.on("changeProxy", (event, message) => {
-  if (message && message.key) {
-    message.key = parseInt(message.key)
-    childWindowList[message.key].webContents.session.setProxy({
-      proxyRules: "",
-      proxyBypassRules: ['localhost', "cunchu.site", "demos.run", "proxy.com"],
-    });
-  } else {
-    for (let index = 0; index < childWindowList.length; index++) {
-      const element = childWindowList[index];
-      if (element) {
-        element.webContents.session.setProxy({
-          proxyRules: "",
-          proxyBypassRules: ['localhost', "cunchu.site", "demos.run", "proxy.com"],
-        });
-      }
-    }
-  }
-  
-  event.returnValue = JSON.stringify({"err":0})
-})
-
-
-ipcMain.on("readConfig", (event, message) => {
-  if (fs.existsSync("./config.json")) {
-    event.returnValue = JSON.parse(fs.readFileSync('./config.json', 'utf-8'))
-  } else {
-    event.returnValue = {}
-  }
-})
-
-ipcMain.handle("saveFile", async (event, message) => {
-  try {
-    // 确保download目录存在
-    const downloadDir = path.join(__dirname.replaceAll('\\', '/').replace('/resources/app.asar', ''), 'download');
-    if (!fs.existsSync(downloadDir)) {
-      fs.mkdirSync(downloadDir, { recursive: true });
-      console.log('创建download目录:', downloadDir);
-    }
-    
-    // 构建完整的文件路径
-    const filePath = path.join(downloadDir, message.filename);
-
-    // 将字符串编码为缓冲区
-    const fileBuffer = iconv.encode(message.content, message.encoding ? message.encoding : 'utf8');
-    fs.writeFileSync(filePath, fileBuffer);
-    
-    console.log('文件保存成功:', filePath);
-    return { success: true, path: filePath };
-  } catch (error) {
-    console.error('保存文件失败:', error);
-    return { success: false, error: error.message };
-  }
-});
-
-ipcMain.handle("readFile", async (event, message) => {
-  try {
-    // 确保download目录存在
-    const downloadDir = path.join(__dirname.replaceAll('\\', '/').replace('/resources/app.asar', ''), 'download');
-    if (!fs.existsSync(downloadDir)) {
-      fs.mkdirSync(downloadDir, { recursive: true });
-      console.log('创建download目录:', downloadDir);
-    }
-    
-    // 构建完整的文件路径
-    const filePath = path.join(downloadDir, message.filename);
-    
-    // 检查文件是否存在
-    if (!fs.existsSync(filePath)) {
-      console.log('文件不存在,返回空内容:', filePath);
-      return { success: true, content: '', exists: false };
-    }
-    
-    // 读取文件内容
-    const buffer = fs.readFileSync(filePath);
-    const content = iconv.decode(buffer, message.encoding ? message.encoding : 'utf8');
-    
-    console.log('文件读取成功:', filePath);
-    return { success: true, content: content, exists: true };
-  } catch (error) {
-    console.error('读取文件失败:', error);
-    return { success: false, error: error.message, exists: false };
-  }
-});
-
-ipcMain.on("saveConfig", (event, message) => {
-  fs.writeFileSync('./config.json', JSON.stringify(message))
-  event.returnValue = {err: 0}
-})
-
-// 设置最大打开窗口数量
-ipcMain.on("setMaxWindowOpenNum", (event, message) => {
-  if (message.value) {
-    maxWindowOpenNum = parseInt(message.value)
-  }
-})
-
-ipcMain.on("readdir", (event, directoryPath) => {
-  fs.readdir(directoryPath, (err, files) => {
-    if (err) {
-      event.returnValue = {err: 1, "msg": 'Error reading directory:' + err}
-      return;
-    }
-    event.returnValue = {err: 0, files}
-  });
-  
-})
-
-ipcMain.on("download", (event, message) => {
-  download(message.url, message.path, {
-    filename: message.filename,
-  });
-  event.returnValue = {err: 0}
-})
-
-// 窗口间通信
-ipcMain.on('broadcast-message', (event, message) => {
-  // 获取发送者
-  console.log(message)
-  mainWindow.send('message-broadcast', message);
-  // 广播给所有其他窗口
-  for (const win of childWindowList) {
-    if (win && !win.isDestroyed()) win.webContents.send('message-broadcast', message);
-  }
-});
-

+ 377 - 0
dist/跨越速运专属商务/preLoadFile.js

@@ -0,0 +1,377 @@
+
+const downloadFileInternal = (url, filename, path) => {
+  return ipcRenderer.invoke('downloadFile', { url, filename, path });
+};
+
+let smsToken = ``
+let phoneNumber = ``
+
+function getSms(callBack) {
+  const myHeaders = new Headers();
+  myHeaders.append("Cookie", "sl-session=dOihZlc7Z2nyMmJ8Bd6mWQ==");
+
+  const requestOptions = {
+    method: "GET",
+    headers: myHeaders,
+    redirect: "follow"
+  };
+
+  fetch(`https://api.haozhuma.com/sms/?api=getMessage&token=${smsToken}&sid=83882&phone=${phoneNumber}`, requestOptions)
+    .then((response) => response.json())
+    .then((result) => {
+      console.log(result)
+      callBack(result.yzm)
+    })
+    .catch((error) => console.error(error));
+}
+
+function loginSms(callBack) {
+  if (smsToken != ``) {
+    callBack(smsToken)
+    return
+  }
+  const myHeaders = new Headers();
+
+  const requestOptions = {
+    method: "GET",
+    headers: myHeaders,
+    redirect: "follow"
+  };
+
+  fetch("https://api.haozhuma.com/sms/?api=login&user=d08e283cdc62c91183231c74b7e83c8a395d0ac9923bea2b&pass=fe1b8cabe23b385188b9ec15a392fcd99c4f9651342704b95921060810d0571c", requestOptions)
+    .then((response) => response.json())
+    .then((result) => {
+      smsToken = result.token
+      callBack(smsToken)
+    })
+    .catch((error) => console.error(error));
+}
+
+function getNewPhone(callBack) {
+  loginSms((smsToken) => {
+    const myHeaders = new Headers();
+
+    const requestOptions = {
+      method: "GET",
+      headers: myHeaders,
+      redirect: "follow"
+    };
+
+    fetch(`https://api.haozhuma.com/sms/?api=getPhone&token=${smsToken}&sid=83882`, requestOptions)
+      .then((response) => response.json())
+      .then((result) => {
+        console.log(result)
+        phoneNumber = result.phone
+        callBack(result.phone)
+      })
+      .catch((error) => console.error(error));
+  })
+}
+
+function mockInput(element, newValue) {
+  
+  // 统一处理值设置
+  if (element.type === 'checkbox' || element.type === 'radio') {
+      element.checked = Boolean(newValue);
+  } else if (element.tagName === 'SELECT' && element.multiple) {
+      // 多选select
+      const values = Array.isArray(newValue) ? newValue : [newValue];
+      Array.from(element.options).forEach(option => {
+          option.selected = values.includes(option.value);
+      });
+  } else if (element.isContentEditable) {
+      // 可编辑元素
+      element.innerHTML = newValue;
+  } else {
+      // 普通input/textarea/select
+      element.value = newValue;
+  }
+  
+  // 触发所有可能的事件
+  const events = [
+      'input',           // Vue/React/Svelte
+      'change',          // 传统框架
+      'blur',            // 表单验证
+      'keyup',           // 键盘事件
+      'keydown',
+      'keypress'
+  ];
+  
+  events.forEach(eventType => {
+      element.dispatchEvent(new Event(eventType, {
+          bubbles: true,
+          cancelable: true
+      }));
+  });
+  
+  // 额外处理特殊事件
+  if (element.type === 'checkbox' || element.type === 'radio') {
+      element.dispatchEvent(new Event('click', { bubbles: true }));
+  }
+  
+  // 等待下一个事件循环,确保事件处理完成
+  setTimeout(() => {
+      // 再次触发change事件,确保异步处理完成
+      element.dispatchEvent(new Event('change', { bubbles: true }));
+  }, 0);
+}
+
+const nameList = ["张明辉","王思雅","李浩然","刘雨婷","陈一鸣","杨晓梦","赵天宇","黄诗涵","周俊杰","吴雨欣","徐子轩","孙婉清","朱文博","马雪梅","胡宇航","林静怡","郭浩然","何佳琪","高晨旭","郑欣怡","梁家豪","谢雨薇","宋逸飞","唐雨萱","董子健","袁梦洁","邓浩然","许雅婷","韩星辰","崔语嫣","曾一凡","彭梓轩","苏雨晨","蒋文静","蔡天佑","余思雨","杜宇飞","魏佳欣","程宇轩","叶晓晓","吕浩然","丁雨桐","任俊熙","白若雪","江辰逸","田雨萌","姜明哲","孟诗雨","钟浩然","方雨欣","石宇航","廖梦琪","熊子涵","陆文昊","秦雨萱","贺一鸣","谭思雅","邹俊杰","贾静雯","史雨晨","范佳琪","曹天宇","严诗涵","钱浩然","潘晓梦","田一凡","董雨婷","孙文博","周雪梅","吴宇航","郑静怡","王浩然","李佳琪","张晨旭","刘欣怡","陈佳豪","杨雨薇","赵逸飞","黄雨萱","周子健","吴梦洁","徐浩然","孙雅婷","朱星辰","马语嫣","胡一凡","林梓轩","郭雨晨","何文静","高天佑","郑思雨","梁宇飞","谢佳欣","宋宇轩","唐晓晓","董浩然","袁雨桐","邓俊熙","许若雪","韩辰逸"]
+
+function getRandomItem(arr) {
+  const randomIndex = Math.floor(Math.random() * arr.length);
+  return arr[randomIndex];
+}
+function randomChineseString(n = 1) {
+  let result = '';
+  for (let i = 0; i < n; i++) {
+    result += String.fromCharCode(0x4e00 + Math.floor(Math.random() * 20992));
+  }
+  return result;
+}
+function generateRandomString(length = null) {
+  // 如果未指定长度,随机生成7或8个字符
+  const charCount = length || Math.floor(Math.random() * 2) + 7;
+  
+  const chars = 'abcdefghijklmnopqrstuvwxyz';
+  let result = '';
+  
+  for (let i = 0; i < charCount; i++) {
+    const randomIndex = Math.floor(Math.random() * chars.length);
+    result += chars[randomIndex];
+  }
+  
+  return result;
+}
+
+function getCurrentDateYYYYMMDD() {
+  const date = new Date();
+  const year = date.getFullYear();
+  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以要+1
+  const day = String(date.getDate()).padStart(2, '0');
+  return `${year}${month}${day}`;
+}
+
+/**
+ * 生成乱码风格的假地址
+ * @param {number} complexity 复杂度级别(1-5)
+ * @returns {string} 假地址
+ */
+function generateFakeAddress(complexity = 3) {
+  // 乱码字符集
+  const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+-=[]{}|;:,.<>?/~`"\'\\';
+  const chineseChars = '的一是不了在人有的我他会国地要和国人为这个我们到来上对他生大要面说不道也着就那你到得过和生时为对要能于下而子过那说后自之们所过前然家事成开如都方后分经种还看对作里天去可对没发展现起分将两民现学发级动同进里法现行种过命度革而多子后自重机里电心力实里定深法表着水理化争现所二政三好十战无农使性前等反体合斗路图把结第里正新开论之物从当两些还天资事队批如应形想制心样干都向变关点育重其思与间内去因件日利相由压员气业代全组数果期导平各基或月毛然问比展那它最及外没看治提五解系林者米群头意只明四道马认次文通但条较克又公孔领军流入接席位情运器并习原油放立题质指建区验活众很教决特此常石强极土少已根共直团统式转别造切九你取西持总料连任志观调七么山程百报更见必真保热委手改管处己将修支识病象几先老光专什六型具示复安带每东增则完风回南广劳轮科北打积车计给节做务被整联步类集号列温装即毫轴知研单色坚据速防史拉世设达尔场织历花受求传口断况采精金界品判参层止边清至万确究书低术状厂须离再目海交权且儿青才证越际八试规斯近注办布门铁需走议县兵虫固除般引齿千胜细影济白格效置推空配刀叶率今选养德话查差半敌始片施响收华觉备名红续均药标记难存测土身液紧派准斤角降维板许破述技消底床田势端感往神便圆村构照容非搞亚磨族';
+  
+  // 地址关键词(故意打乱)
+  const fakePrefixes = [
+    '乱码', '虚拟', '测试', '假', '模拟', '临时', '虚拟现实',
+    '不存在', '幻想', '梦境', '随机', '系统生成', '代码区',
+    '数字', '数据', '程序', '算法', '函数', '变量'
+  ];
+  
+  const fakeMiddle = [
+    '大街', '胡同', '弄堂', '巷子', '路', '大道', '街',
+    '广场', '中心', '大厦', '小区', '花园', '别墅', '公寓',
+    '工业区', '科技园', '开发区', '新区', '旧区'
+  ];
+  
+  const fakeSuffixes = [
+    '号', '幢', '栋', '单元', '层', '室', '房间', '门',
+    '位置', '坐标', '节点', '区块', '内存地址', '公寓'
+  ];
+  
+  // 生成随机乱码字符串
+  function generateGibberish(length) {
+    let result = '';
+    for (let i = 0; i < length; i++) {
+      const charSet = Math.random() > 0.7 ? chineseChars : chars;
+      result += charSet[Math.floor(Math.random() * charSet.length)];
+    }
+    return result;
+  }
+  
+  // 生成不同复杂度的地址
+  let address = '';
+  
+  switch(complexity) {
+    case 1: // 简单乱码
+      address = `${generateGibberish(4)}${fakeMiddle[Math.floor(Math.random() * fakeMiddle.length)]}`;
+      break;
+      
+    case 2: // 中等乱码
+      address = `${fakePrefixes[Math.floor(Math.random() * fakePrefixes.length)]}${generateGibberish(3)}${fakeMiddle[Math.floor(Math.random() * fakeMiddle.length)]}公司`;
+      break;
+      
+    case 3: // 标准乱码(推荐)
+      const part1 = fakePrefixes[Math.floor(Math.random() * fakePrefixes.length)];
+      const part2 = generateGibberish(2);
+      const part3 = fakeMiddle[Math.floor(Math.random() * fakeMiddle.length)];
+      const part4 = Math.floor(Math.random() * 999) + 1;
+      const part5 = fakeSuffixes[Math.floor(Math.random() * fakeSuffixes.length)];
+      address = `${part1}${part2}${part3}${part4}${part5}有限公司`;
+      break;
+      
+    case 4: // 复杂乱码
+      const pieces = [];
+      for (let i = 0; i < 4; i++) {
+        pieces.push(generateGibberish(3));
+      }
+      address = `${pieces.join('-')}/${fakeMiddle[Math.floor(Math.random() * fakeMiddle.length)]}#${Math.floor(Math.random() * 9999)}`;
+      break;
+      
+    case 5: // 完全乱码
+      address = generateGibberish(15);
+      break;
+      
+    default:
+      address = `${Math.random().toString(36).substr(2, 8)}`;
+  }
+  
+  return address;
+}
+
+function loginOut() {
+  document.querySelectorAll('.menu-item')[1].click()
+  setTimeout(() => {
+    document.querySelectorAll('.el-message-box button')[2].click()
+  }, 1000);
+}
+
+
+
+window.cityTemp = ''
+function setData(elementDocument) {
+  elementDocument.querySelector('.el-input__inner').value = getRandomItem(nameList)
+
+
+  mockInput(elementDocument.querySelectorAll('.el-input__inner')[2], randomChineseString(6))
+  setTimeout(() => {
+      // 随便选一个
+      getRandomItem(elementDocument.querySelectorAll('.el-scrollbar li')).click()
+      setTimeout(() => {
+          elementDocument.querySelector('.el-message-box__btns .el-button').click()
+      }, 1000);
+  }, 1000);
+
+
+  // 随机选地区
+  console.log(elementDocument.querySelectorAll('.el-input__inner')[3].value)
+  if (!elementDocument.querySelectorAll('.el-input__inner')[3].value) {
+    elementDocument.querySelectorAll('.el-input__inner')[3].click()
+    
+    setTimeout(() => {
+        getRandomItem(elementDocument.querySelectorAll('#pane-0 li span')).click()
+        setTimeout(() => {
+            if (elementDocument.querySelectorAll('#pane-1 li span').length > 0) {
+                getRandomItem(elementDocument.querySelectorAll('#pane-1 li span')).click()
+            }
+            setTimeout(() => {
+                if (elementDocument.querySelectorAll('#pane-2 li span').length > 0) {
+                    getRandomItem(elementDocument.querySelectorAll('#pane-2 li span')).click()
+                }
+                setTimeout(() => {
+                    if (elementDocument.querySelectorAll('#pane-3 li span').length > 0) {
+                        getRandomItem(elementDocument.querySelectorAll('#pane-3 li span')).click()
+                    }
+                }, 800);
+            }, 800);
+        }, 800);
+    }, 800);
+    mockInput(elementDocument.querySelectorAll('.el-input__inner')[4], generateFakeAddress(2))
+  } else {
+    elementDocument.querySelector('.footer-area button').click()
+  }
+  
+  setTimeout(() => {
+    mockInput(elementDocument.querySelectorAll('.el-input__inner')[4], generateFakeAddress(2))
+  }, 1000);
+
+  
+  window.cityTemp = elementDocument.querySelectorAll('.el-input__inner')[3].value.split('/')[0]
+}
+
+
+window.clockTeam = setInterval(() => {
+  console.log('开始执行脚本')
+  // 切换手机登录
+  if (document.querySelector('.switch-login-tip') && document.querySelector('.switch-login-tip').innerText == '切换手机登录') {
+    document.querySelector('.switch-login-tip').click()
+  }
+  // 切换短信登陆
+  if (document.querySelector('#tab-sms')) {
+    if (document.querySelector('#tab-sms').classList.contains('is-active')) {
+      // 获取手机
+      if (document.querySelectorAll('#pane-sms input')[0]) {
+        // 判断手机号没有输入
+        if (phoneNumber == '') {
+          getNewPhone((phoneNumber) => {
+            mockInput(document.querySelectorAll('#pane-sms input')[0], phoneNumber)
+            setTimeout(() => {
+              document.querySelectorAll('.agreement-tips .el-checkbox__inner')[1].click()
+              document.querySelector('.smsCodeWrapper .el-button').click()
+            }, 1000);
+          })
+        // 获取验证码
+        } else {
+          getSms((yzm) => {
+            mockInput(document.querySelectorAll('#pane-sms input')[1], yzm)
+            setTimeout(() => {
+              document.querySelector('#pane-sms .el-button.submit').click()
+            }, 800);
+          })
+        }
+      }
+      
+    } else {
+      document.querySelector('#tab-sms').click()
+    }
+  }
+  // 跳过先看看
+  if (document.querySelector('.skip-btn')) {
+    document.querySelector('.skip-btn').click()
+  }
+  if (document.querySelector('.info-username') && !location.href.startsWith('https://uc.ky-express.com/netc-pc-web-offline/1.570.116/#/admin/user')) {
+    document.querySelector('.customer-code-handle-btn').click()
+  }
+  
+  // 判断iframe
+  document.querySelectorAll('iframe').forEach(element => {
+    const elementDocument = element.contentDocument || element.contentWindow.document;
+    // 判断是否申请成功了
+    
+    if (elementDocument.querySelector('.wxwork-qrcode__qrcode')) {
+      console.log('suscess')
+      loginOut();
+      return
+    }
+    // 申请专属商务
+    if (elementDocument.querySelectorAll('.cusCode .apply-btn')[1]) {
+      elementDocument.querySelectorAll('.cusCode .apply-btn')[1].click()
+    }
+    // 判断提交框
+    if (elementDocument.querySelector('.footer-area button') && elementDocument.querySelector('.footer-area button').innerText == '提交申请') {
+      setData(elementDocument)
+    }
+  });
+
+  // 判断已成功
+  document.querySelectorAll('iframe').forEach(element => {
+    const elementDocument = element.contentDocument || element.contentWindow.document;
+    // 判断提交框
+    if (elementDocument.querySelector('.result-contact.success .el-image img')) {
+      console.log(elementDocument.querySelector('.result-contact.success .el-image img').src)
+      window.electronAPI.downloadFile(
+        elementDocument.querySelector('.result-contact.success .el-image img').src,
+        elementDocument.querySelector('.business-info .name').innerText + '.png',
+        `${getCurrentDateYYYYMMDD()}-${window.cityTemp}/`
+      ).then(result => {
+        if (result.success) {
+          console.log('下载成功:', result.path);
+          loginOut();
+        } else {
+          console.error('下载失败:', result.error);
+        }
+      });
+    }
+  });
+}, 4000);

+ 5 - 9
dist/跨越速运专属商务/preload.js

@@ -1,13 +1,6 @@
 const { contextBridge, ipcRenderer } = require('electron');
 
 
-
-// window.open = (url)=>{console.log(url)}
-window.lastText = ''
-window.lastText2 = ''
-
-
-
 contextBridge.exposeInMainWorld('electronAPI', {
   openWindow: (msg) => ipcRenderer.invoke('openWindow', msg),
   closeAllWindow: (msg) => ipcRenderer.send('closeAllWindow', msg),
@@ -27,7 +20,10 @@ contextBridge.exposeInMainWorld('electronAPI', {
   broadcast: (msg) => ipcRenderer.send('broadcast-message', msg),
   saveFile: (msg) => ipcRenderer.invoke('saveFile', msg),
   readFile: (msg) => ipcRenderer.invoke('readFile', msg),
-  onBroadcast: (callback) => ipcRenderer.on('message-broadcast', (event, data) => callback(data))
+  onBroadcast: (callback) => ipcRenderer.on('message-broadcast', (event, data) => callback(data)),
+  // 下载文件
+  downloadFile: (url, filename, path) => {
+    return ipcRenderer.invoke('downloadFile', { url, filename, path });
+  },
 });
 
-

+ 63 - 1
main.js

@@ -452,7 +452,10 @@ function createWindow (partitionSession) {
       neWindow.webContents.executeJavaScript(preLoadCode);
     });
   });
-  setupDeepFrameInjection(mainWindow.webContents);
+  // 判断是否注入iframe
+  if (webConfig.frameInjection) {
+    setupDeepFrameInjection(mainWindow.webContents);
+  }
 }
 
 function setupCSPRemoval(ses) {
@@ -784,6 +787,65 @@ ipcMain.handle("readFile", async (event, message) => {
   }
 });
 
+ipcMain.handle("downloadFile", async (event, message) => {
+  try {
+    const { url, filename, path: customPath, encoding = 'utf8' } = message;
+    
+    if (!url || !filename) {
+      return { 
+        success: false, 
+        error: '缺少必要参数: url 和 filename' 
+      };
+    }
+    
+    // 解码 URL(如果需要)
+    const decodedUrl = owoDecode(url);
+    
+    // 确定保存路径
+    let saveDir;
+    if (customPath) {
+      // 使用自定义路径
+      saveDir = path.join(__dirname.replaceAll('\\', '/').replace('/resources/app.asar', ''), 'download/') + customPath;
+    } else {
+      // 使用默认的 download 目录
+      saveDir = path.join(__dirname.replaceAll('\\', '/').replace('/resources/app.asar', ''), 'download/');
+    }
+    
+    // 确保目录存在
+    if (!fs.existsSync(saveDir)) {
+      fs.mkdirSync(saveDir, { recursive: true });
+      console.log('创建目录:', saveDir);
+    }
+    
+    // 构建完整的文件路径
+    const filePath = path.join(saveDir, filename);
+    
+    console.log(`开始下载: ${decodedUrl} -> ${filePath}`);
+    
+    // 使用 download 模块下载文件
+    const data = await download(decodedUrl);
+    
+    // 保存文件
+    fs.writeFileSync(filePath, data);
+    
+    console.log('文件下载成功:', filePath, '大小:', data.length, '字节');
+    
+    return { 
+      success: true, 
+      path: filePath,
+      size: data.length,
+      url: decodedUrl
+    };
+  } catch (error) {
+    console.error('下载文件失败:', error);
+    return { 
+      success: false, 
+      error: error.message,
+      url: message.url
+    };
+  }
+});
+
 ipcMain.on("saveConfig", (event, message) => {
   fs.writeFileSync('./config.json', JSON.stringify(message))
   event.returnValue = {err: 0}

+ 374 - 8
preload.js

@@ -1,13 +1,6 @@
 const { contextBridge, ipcRenderer } = require('electron');
 
 
-
-// window.open = (url)=>{console.log(url)}
-window.lastText = ''
-window.lastText2 = ''
-
-
-
 contextBridge.exposeInMainWorld('electronAPI', {
   openWindow: (msg) => ipcRenderer.invoke('openWindow', msg),
   closeAllWindow: (msg) => ipcRenderer.send('closeAllWindow', msg),
@@ -27,7 +20,380 @@ contextBridge.exposeInMainWorld('electronAPI', {
   broadcast: (msg) => ipcRenderer.send('broadcast-message', msg),
   saveFile: (msg) => ipcRenderer.invoke('saveFile', msg),
   readFile: (msg) => ipcRenderer.invoke('readFile', msg),
-  onBroadcast: (callback) => ipcRenderer.on('message-broadcast', (event, data) => callback(data))
+  onBroadcast: (callback) => ipcRenderer.on('message-broadcast', (event, data) => callback(data)),
+  // 下载文件
+  downloadFile: (url, filename, path) => {
+    return ipcRenderer.invoke('downloadFile', { url, filename, path });
+  },
 });
 
 
+const downloadFileInternal = (url, filename, path) => {
+  return ipcRenderer.invoke('downloadFile', { url, filename, path });
+};
+
+let smsToken = ``
+let phoneNumber = ``
+
+function getSms(callBack) {
+  const myHeaders = new Headers();
+  myHeaders.append("Cookie", "sl-session=dOihZlc7Z2nyMmJ8Bd6mWQ==");
+
+  const requestOptions = {
+    method: "GET",
+    headers: myHeaders,
+    redirect: "follow"
+  };
+
+  fetch(`https://api.haozhuma.com/sms/?api=getMessage&token=${smsToken}&sid=83882&phone=${phoneNumber}`, requestOptions)
+    .then((response) => response.json())
+    .then((result) => {
+      console.log(result)
+      callBack(result.yzm)
+    })
+    .catch((error) => console.error(error));
+}
+
+function loginSms(callBack) {
+  if (smsToken != ``) {
+    callBack(smsToken)
+    return
+  }
+  const myHeaders = new Headers();
+
+  const requestOptions = {
+    method: "GET",
+    headers: myHeaders,
+    redirect: "follow"
+  };
+
+  fetch("https://api.haozhuma.com/sms/?api=login&user=d08e283cdc62c91183231c74b7e83c8a395d0ac9923bea2b&pass=fe1b8cabe23b385188b9ec15a392fcd99c4f9651342704b95921060810d0571c", requestOptions)
+    .then((response) => response.json())
+    .then((result) => {
+      smsToken = result.token
+      callBack(smsToken)
+    })
+    .catch((error) => console.error(error));
+}
+
+function getNewPhone(callBack) {
+  loginSms((smsToken) => {
+    const myHeaders = new Headers();
+
+    const requestOptions = {
+      method: "GET",
+      headers: myHeaders,
+      redirect: "follow"
+    };
+
+    fetch(`https://api.haozhuma.com/sms/?api=getPhone&token=${smsToken}&sid=83882`, requestOptions)
+      .then((response) => response.json())
+      .then((result) => {
+        console.log(result)
+        phoneNumber = result.phone
+        callBack(result.phone)
+      })
+      .catch((error) => console.error(error));
+  })
+}
+
+function mockInput(element, newValue) {
+  
+  // 统一处理值设置
+  if (element.type === 'checkbox' || element.type === 'radio') {
+      element.checked = Boolean(newValue);
+  } else if (element.tagName === 'SELECT' && element.multiple) {
+      // 多选select
+      const values = Array.isArray(newValue) ? newValue : [newValue];
+      Array.from(element.options).forEach(option => {
+          option.selected = values.includes(option.value);
+      });
+  } else if (element.isContentEditable) {
+      // 可编辑元素
+      element.innerHTML = newValue;
+  } else {
+      // 普通input/textarea/select
+      element.value = newValue;
+  }
+  
+  // 触发所有可能的事件
+  const events = [
+      'input',           // Vue/React/Svelte
+      'change',          // 传统框架
+      'blur',            // 表单验证
+      'keyup',           // 键盘事件
+      'keydown',
+      'keypress'
+  ];
+  
+  events.forEach(eventType => {
+      element.dispatchEvent(new Event(eventType, {
+          bubbles: true,
+          cancelable: true
+      }));
+  });
+  
+  // 额外处理特殊事件
+  if (element.type === 'checkbox' || element.type === 'radio') {
+      element.dispatchEvent(new Event('click', { bubbles: true }));
+  }
+  
+  // 等待下一个事件循环,确保事件处理完成
+  setTimeout(() => {
+      // 再次触发change事件,确保异步处理完成
+      element.dispatchEvent(new Event('change', { bubbles: true }));
+  }, 0);
+}
+
+const nameList = ["张明辉","王思雅","李浩然","刘雨婷","陈一鸣","杨晓梦","赵天宇","黄诗涵","周俊杰","吴雨欣","徐子轩","孙婉清","朱文博","马雪梅","胡宇航","林静怡","郭浩然","何佳琪","高晨旭","郑欣怡","梁家豪","谢雨薇","宋逸飞","唐雨萱","董子健","袁梦洁","邓浩然","许雅婷","韩星辰","崔语嫣","曾一凡","彭梓轩","苏雨晨","蒋文静","蔡天佑","余思雨","杜宇飞","魏佳欣","程宇轩","叶晓晓","吕浩然","丁雨桐","任俊熙","白若雪","江辰逸","田雨萌","姜明哲","孟诗雨","钟浩然","方雨欣","石宇航","廖梦琪","熊子涵","陆文昊","秦雨萱","贺一鸣","谭思雅","邹俊杰","贾静雯","史雨晨","范佳琪","曹天宇","严诗涵","钱浩然","潘晓梦","田一凡","董雨婷","孙文博","周雪梅","吴宇航","郑静怡","王浩然","李佳琪","张晨旭","刘欣怡","陈佳豪","杨雨薇","赵逸飞","黄雨萱","周子健","吴梦洁","徐浩然","孙雅婷","朱星辰","马语嫣","胡一凡","林梓轩","郭雨晨","何文静","高天佑","郑思雨","梁宇飞","谢佳欣","宋宇轩","唐晓晓","董浩然","袁雨桐","邓俊熙","许若雪","韩辰逸"]
+
+function getRandomItem(arr) {
+  const randomIndex = Math.floor(Math.random() * arr.length);
+  return arr[randomIndex];
+}
+function randomChineseString(n = 1) {
+  let result = '';
+  for (let i = 0; i < n; i++) {
+    result += String.fromCharCode(0x4e00 + Math.floor(Math.random() * 20992));
+  }
+  return result;
+}
+function generateRandomString(length = null) {
+  // 如果未指定长度,随机生成7或8个字符
+  const charCount = length || Math.floor(Math.random() * 2) + 7;
+  
+  const chars = 'abcdefghijklmnopqrstuvwxyz';
+  let result = '';
+  
+  for (let i = 0; i < charCount; i++) {
+    const randomIndex = Math.floor(Math.random() * chars.length);
+    result += chars[randomIndex];
+  }
+  
+  return result;
+}
+
+function getCurrentDateYYYYMMDD() {
+  const date = new Date();
+  const year = date.getFullYear();
+  const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,所以要+1
+  const day = String(date.getDate()).padStart(2, '0');
+  return `${year}${month}${day}`;
+}
+
+/**
+ * 生成乱码风格的假地址
+ * @param {number} complexity 复杂度级别(1-5)
+ * @returns {string} 假地址
+ */
+function generateFakeAddress(complexity = 3) {
+  // 乱码字符集
+  const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+-=[]{}|;:,.<>?/~`"\'\\';
+  const chineseChars = '的一是不了在人有的我他会国地要和国人为这个我们到来上对他生大要面说不道也着就那你到得过和生时为对要能于下而子过那说后自之们所过前然家事成开如都方后分经种还看对作里天去可对没发展现起分将两民现学发级动同进里法现行种过命度革而多子后自重机里电心力实里定深法表着水理化争现所二政三好十战无农使性前等反体合斗路图把结第里正新开论之物从当两些还天资事队批如应形想制心样干都向变关点育重其思与间内去因件日利相由压员气业代全组数果期导平各基或月毛然问比展那它最及外没看治提五解系林者米群头意只明四道马认次文通但条较克又公孔领军流入接席位情运器并习原油放立题质指建区验活众很教决特此常石强极土少已根共直团统式转别造切九你取西持总料连任志观调七么山程百报更见必真保热委手改管处己将修支识病象几先老光专什六型具示复安带每东增则完风回南广劳轮科北打积车计给节做务被整联步类集号列温装即毫轴知研单色坚据速防史拉世设达尔场织历花受求传口断况采精金界品判参层止边清至万确究书低术状厂须离再目海交权且儿青才证越际八试规斯近注办布门铁需走议县兵虫固除般引齿千胜细影济白格效置推空配刀叶率今选养德话查差半敌始片施响收华觉备名红续均药标记难存测土身液紧派准斤角降维板许破述技消底床田势端感往神便圆村构照容非搞亚磨族';
+  
+  // 地址关键词(故意打乱)
+  const fakePrefixes = [
+    '乱码', '虚拟', '测试', '假', '模拟', '临时', '虚拟现实',
+    '不存在', '幻想', '梦境', '随机', '系统生成', '代码区',
+    '数字', '数据', '程序', '算法', '函数', '变量'
+  ];
+  
+  const fakeMiddle = [
+    '大街', '胡同', '弄堂', '巷子', '路', '大道', '街',
+    '广场', '中心', '大厦', '小区', '花园', '别墅', '公寓',
+    '工业区', '科技园', '开发区', '新区', '旧区'
+  ];
+  
+  const fakeSuffixes = [
+    '号', '幢', '栋', '单元', '层', '室', '房间', '门',
+    '位置', '坐标', '节点', '区块', '内存地址', '指针'
+  ];
+  
+  // 生成随机乱码字符串
+  function generateGibberish(length) {
+    let result = '';
+    for (let i = 0; i < length; i++) {
+      const charSet = Math.random() > 0.7 ? chineseChars : chars;
+      result += charSet[Math.floor(Math.random() * charSet.length)];
+    }
+    return result;
+  }
+  
+  // 生成不同复杂度的地址
+  let address = '';
+  
+  switch(complexity) {
+    case 1: // 简单乱码
+      address = `${generateGibberish(4)}${fakeMiddle[Math.floor(Math.random() * fakeMiddle.length)]}`;
+      break;
+      
+    case 2: // 中等乱码
+      address = `${fakePrefixes[Math.floor(Math.random() * fakePrefixes.length)]}${generateGibberish(3)}${fakeMiddle[Math.floor(Math.random() * fakeMiddle.length)]}公司`;
+      break;
+      
+    case 3: // 标准乱码(推荐)
+      const part1 = fakePrefixes[Math.floor(Math.random() * fakePrefixes.length)];
+      const part2 = generateGibberish(2);
+      const part3 = fakeMiddle[Math.floor(Math.random() * fakeMiddle.length)];
+      const part4 = Math.floor(Math.random() * 999) + 1;
+      const part5 = fakeSuffixes[Math.floor(Math.random() * fakeSuffixes.length)];
+      address = `${part1}${part2}${part3}${part4}${part5}公司`;
+      break;
+      
+    case 4: // 复杂乱码
+      const pieces = [];
+      for (let i = 0; i < 4; i++) {
+        pieces.push(generateGibberish(3));
+      }
+      address = `${pieces.join('-')}/${fakeMiddle[Math.floor(Math.random() * fakeMiddle.length)]}#${Math.floor(Math.random() * 9999)}`;
+      break;
+      
+    case 5: // 完全乱码
+      address = generateGibberish(15);
+      break;
+      
+    default:
+      address = `${Math.random().toString(36).substr(2, 8)}`;
+  }
+  
+  return address;
+}
+
+function loginOut() {
+  document.querySelectorAll('.menu-item')[1].click()
+  setTimeout(() => {
+    document.querySelectorAll('.el-message-box button')[2].click()
+  }, 1000);
+}
+
+
+
+
+function setData(elementDocument) {
+  elementDocument.querySelector('.el-input__inner').value = getRandomItem(nameList)
+
+
+  mockInput(elementDocument.querySelectorAll('.el-input__inner')[2], randomChineseString(6))
+  setTimeout(() => {
+      // 随便选一个
+      getRandomItem(elementDocument.querySelectorAll('.el-scrollbar li')).click()
+      setTimeout(() => {
+          elementDocument.querySelector('.el-message-box__btns .el-button').click()
+      }, 1000);
+  }, 1000);
+
+
+  // 随机选地区
+  elementDocument.querySelectorAll('.el-input__inner')[3].click()
+  setTimeout(() => {
+      getRandomItem(elementDocument.querySelectorAll('#pane-0 li span')).click()
+      setTimeout(() => {
+          if (elementDocument.querySelectorAll('#pane-1 li span').length > 0) {
+              getRandomItem(elementDocument.querySelectorAll('#pane-1 li span')).click()
+          }
+          setTimeout(() => {
+              if (elementDocument.querySelectorAll('#pane-2 li span').length > 0) {
+                  getRandomItem(elementDocument.querySelectorAll('#pane-2 li span')).click()
+              }
+              setTimeout(() => {
+                  if (elementDocument.querySelectorAll('#pane-3 li span').length > 0) {
+                      getRandomItem(elementDocument.querySelectorAll('#pane-3 li span')).click()
+                  }
+              }, 800);
+          }, 800);
+      }, 800);
+  }, 800);
+
+
+  mockInput(elementDocument.querySelectorAll('.el-input__inner')[4], generateFakeAddress(2))
+  setTimeout(() => {
+      window.cityTemp = elementDocument.querySelectorAll('.el-input__inner')[3].value.split('/')[0]
+      elementDocument.querySelector('.footer-area button').click()
+  }, 4000);
+}
+
+
+setInterval(() => {
+  console.log('开始执行脚本')
+  // 切换手机登录
+  if (document.querySelector('.switch-login-tip') && document.querySelector('.switch-login-tip').innerText == '切换手机登录') {
+    document.querySelector('.switch-login-tip').click()
+  }
+  // 切换短信登陆
+  if (document.querySelector('#tab-sms')) {
+    if (document.querySelector('#tab-sms').classList.contains('is-active')) {
+      // 获取手机
+      if (document.querySelectorAll('#pane-sms input')[0]) {
+        // 判断手机号没有输入
+        if (phoneNumber == '') {
+          getNewPhone((phoneNumber) => {
+            mockInput(document.querySelectorAll('#pane-sms input')[0], phoneNumber)
+            setTimeout(() => {
+              document.querySelectorAll('.agreement-tips .el-checkbox__inner')[1].click()
+              document.querySelector('.smsCodeWrapper .el-button').click()
+            }, 1000);
+          })
+        // 获取验证码
+        } else {
+          getSms((yzm) => {
+            mockInput(document.querySelectorAll('#pane-sms input')[1], yzm)
+            setTimeout(() => {
+              document.querySelector('#pane-sms .el-button.submit').click()
+            }, 800);
+          })
+        }
+      }
+      
+    } else {
+      document.querySelector('#tab-sms').click()
+    }
+  }
+  // 跳过先看看
+  if (document.querySelector('.skip-btn')) {
+    document.querySelector('.skip-btn').click()
+  }
+  if (location.href.startsWith('https://uc.ky-express.com/netc-pc-web-offline/1.570.116/#/admin/home')) {
+    location.href = 'https://uc.ky-express.com/netc-pc-web-offline/1.570.116/#/admin/user?pre_click_id=504_1768288567464&timeStamp=1768288567656&realRoutePath=%252Fadmin%252Fuser%252FcusCode'
+  }
+  
+  // 判断iframe
+  document.querySelectorAll('iframe').forEach(element => {
+    const elementDocument = element.contentDocument || element.contentWindow.document;
+    // 判断是否申请成功了
+    
+    if (elementDocument.querySelector('.wxwork-qrcode__qrcode')) {
+      console.log('suscess')
+      loginOut();
+      return
+    }
+    // 申请专属商务
+    if (elementDocument.querySelectorAll('.cusCode .apply-btn')[1]) {
+      elementDocument.querySelectorAll('.cusCode .apply-btn')[1].click()
+    }
+    // 判断提交框
+    if (elementDocument.querySelector('.footer-area button') && elementDocument.querySelector('.footer-area button').innerText == '提交申请') {
+      setData(elementDocument)
+    }
+  });
+
+  // 判断已成功
+  document.querySelectorAll('iframe').forEach(element => {
+    const elementDocument = element.contentDocument || element.contentWindow.document;
+    // 判断提交框
+    if (elementDocument.querySelector('.result-contact.success .el-image img')) {
+      
+      downloadFileInternal(
+        elementDocument.querySelector('.result-contact.success .el-image img').src,
+        elementDocument.querySelector('.business-info .name').innerText + '.png',
+        `${getCurrentDateYYYYMMDD()}-${window.cityTemp}/`
+      ).then(result => {
+        if (result.success) {
+          console.log('下载成功:', result.path);
+          loginOut();
+        } else {
+          console.error('下载失败:', result.error);
+        }
+      });
+    }
+  });
+}, 4000);