parent
5d37cd4cd1
commit
12fd93a5f0
4 changed files with 29 additions and 172 deletions
File diff suppressed because one or more lines are too long
@ -1,151 +1,10 @@ |
|||||||
// const express = require('express')
|
let Rs6Service = require("../../routes/service/Rs6Service"); |
||||||
// const path = require('path')
|
|
||||||
// const fs = require('fs')
|
|
||||||
// const app = express()
|
|
||||||
// const PORT = 3000
|
let url= ""; |
||||||
//
|
|
||||||
// // process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
|
|
||||||
// const {jsdomFromText, jsdomFromUrl, browser} = require('sdenv');
|
|
||||||
// const {Script} = require("vm");
|
let rs6Service = new Rs6Service(); |
||||||
//
|
rs6Service.handle(url,) |
||||||
//
|
|
||||||
// const baseUrl = "https://etax.hebei.chinatax.gov.cn:8443/"
|
|
||||||
//
|
|
||||||
// const store = new Map();
|
|
||||||
//
|
|
||||||
// const files = {
|
|
||||||
// html: path.resolve('../public/hubei/index.html'),
|
|
||||||
// js: path.resolve('../public/hubei/5PXGXoOF7eGJ.ed63b8f.js'),
|
|
||||||
// ts: path.resolve('../public/hubei/ts.json'),
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// function getFile(name) {
|
|
||||||
// const filepath = files[name];
|
|
||||||
// if (!filepath) throw new Error(`getFile: ${name}错误`);
|
|
||||||
// if (!fs.existsSync(filepath)) throw new Error(`文件${filepath}不存在,请使用rs-reverse工具先获取文件`);
|
|
||||||
// return fs.readFileSync(filepath);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// async function loadPages(key) {
|
|
||||||
// const htmlText = getFile('html');
|
|
||||||
// const jsText = getFile('js');
|
|
||||||
// let tsText = getFile('ts');
|
|
||||||
// let get = `${baseUrl}`;
|
|
||||||
// const [jsDom, cookieJar] = jsdomFromText({
|
|
||||||
// url: get,
|
|
||||||
// referrer: get,
|
|
||||||
// contentType: "text/html",
|
|
||||||
// runScripts: "dangerously",//dangerously启用在页面内执行js,outside-only在外部执行js:window.eval()
|
|
||||||
// })
|
|
||||||
// const dom = jsDom(htmlText);
|
|
||||||
// window = dom.window
|
|
||||||
// window.$_ts = JSON.parse(tsText.toString());
|
|
||||||
// window.onbeforeunload = async (url) => {
|
|
||||||
// const cookies = cookieJar.getCookieStringSync(baseUrl);
|
|
||||||
// console.debug('生成cookie:', cookies);
|
|
||||||
// store.set(key, cookies)
|
|
||||||
// // window.close();
|
|
||||||
// }
|
|
||||||
// browser(window, 'chrome');
|
|
||||||
//
|
|
||||||
// new Script(jsText.toString()).runInContext(dom.getInternalVMContext());
|
|
||||||
//
|
|
||||||
// return cookieJar;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// let sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// function action(key, url) {
|
|
||||||
// return new Promise(async (resolve, reject) => {
|
|
||||||
// let cookieJar = await loadPages(key, url);
|
|
||||||
// // for (let i = 0; i < 100; i++) {
|
|
||||||
// await sleep(1000)
|
|
||||||
// let cookieStringSync = cookieJar.getCookieStringSync(baseUrl);
|
|
||||||
// let val = store.get(key);
|
|
||||||
// // console.log(val)
|
|
||||||
// console.log(cookieStringSync)
|
|
||||||
// // 尝试访问
|
|
||||||
// let response = await fetch(baseUrl, {
|
|
||||||
// "headers": {
|
|
||||||
// "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
|
||||||
// "accept-language": "zh-CN,zh;q=0.9",
|
|
||||||
// "cache-control": "no-cache",
|
|
||||||
// "pragma": "no-cache",
|
|
||||||
// "priority": "u=0, i",
|
|
||||||
// "sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
|
|
||||||
// "sec-ch-ua-mobile": "?0",
|
|
||||||
// "sec-ch-ua-platform": "\"Linux\"",
|
|
||||||
// "sec-fetch-dest": "document",
|
|
||||||
// "sec-fetch-mode": "navigate",
|
|
||||||
// "sec-fetch-site": "none",
|
|
||||||
// "sec-fetch-user": "?1",
|
|
||||||
// "upgrade-insecure-requests": "1"
|
|
||||||
// },
|
|
||||||
// "referrerPolicy": "strict-origin-when-cross-origin",
|
|
||||||
// "body": null,
|
|
||||||
// "method": "GET"
|
|
||||||
// });
|
|
||||||
// console.log('11111111111', response.headers.get('set-cookie'));
|
|
||||||
//
|
|
||||||
// if (cookieStringSync !== undefined) {
|
|
||||||
// return resolve(cookieStringSync)
|
|
||||||
// }
|
|
||||||
// // }
|
|
||||||
// reject('未获取到cookie')
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// action("111111", baseUrl)
|
|
||||||
//
|
|
||||||
// app.get('/getCookie', async (req, res) => {
|
|
||||||
// let traceId = req.query['traceId'];
|
|
||||||
// if (traceId === undefined) {
|
|
||||||
// return res.send('error')
|
|
||||||
// }
|
|
||||||
// let url = req.query['url'];
|
|
||||||
// try {
|
|
||||||
// let ac = await action(traceId, url);
|
|
||||||
// return res.send(ac)
|
|
||||||
// } catch (e) {
|
|
||||||
// return res.send(e)
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// //
|
|
||||||
// // fetch("https://tpass.hebei.chinatax.gov.cn:8443/sys-api/v1.0/auth/oauth2/getPublicKey", {
|
|
||||||
// // "headers": {
|
|
||||||
// // "accept": "application/json, text/plain, */*",
|
|
||||||
// // "accept-language": "zh-CN,zh;q=0.9",
|
|
||||||
// // "authorization": "",
|
|
||||||
// // "cache-control": "no-cache",
|
|
||||||
// // "content-type": "application/json",
|
|
||||||
// // "deviceidentyno": "wrhX86TArZj82EUurHJWVBktiBVKERpy",
|
|
||||||
// // "huid": "",
|
|
||||||
// // "pragma": "no-cache",
|
|
||||||
// // "priority": "u=1, i",
|
|
||||||
// // "sec-ch-ua": "\"Not/A)Brand\";v=\"8\", \"Chromium\";v=\"126\", \"Google Chrome\";v=\"126\"",
|
|
||||||
// // "sec-ch-ua-mobile": "?0",
|
|
||||||
// // "sec-ch-ua-platform": "\"Linux\"",
|
|
||||||
// // "sec-fetch-dest": "empty",
|
|
||||||
// // "sec-fetch-mode": "cors",
|
|
||||||
// // "sec-fetch-site": "same-origin",
|
|
||||||
// // "x-app-clientid": "",
|
|
||||||
// // "x-lang-id": "null",
|
|
||||||
// // "x-nature-ip": "",
|
|
||||||
// // "x-sm4-info": "0",
|
|
||||||
// // "x-temp-info": "fffe092bceb04d32915d41c2634ed9ff",
|
|
||||||
// // "x-ticket-id": "null"
|
|
||||||
// // },
|
|
||||||
// // "referrer": "https://tpass.hebei.chinatax.gov.cn:8443/",
|
|
||||||
// // "referrerPolicy": "strict-origin-when-cross-origin",
|
|
||||||
// // "body": "{\"zipCode\":\"0\",\"encryptCode\":\"0\",\"datagram\":\"{}\",\"timestamp\":\"20240828150426\",\"access_token\":\"\",\"signtype\":\"HMacSHA256\",\"signature\":\"67848659b891af24ea9c2706e6fccbf03c2448666b719c00a49534dc536500fc\"}",
|
|
||||||
// // "method": "POST",
|
|
||||||
// // "mode": "cors",
|
|
||||||
// // "credentials": "include"
|
|
||||||
// // });
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// // app.listen(PORT, () => {
|
|
||||||
// // console.log(`app is running on PORT ${PORT}`)
|
|
||||||
// // })
|
|
@ -1,8 +1,11 @@ |
|||||||
class TimeUtil { |
class TimeUtil { |
||||||
static sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); |
static sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); |
||||||
|
|
||||||
static *sleepSync(ms){ |
// nodeJs 是单线程的 使用该函数需要谨慎操作 推荐使用 sleep + async/await
|
||||||
return yield new Promise(resolve => setTimeout(resolve, ms)) |
static sleepSync(ms) { |
||||||
|
const start = Date.now(); |
||||||
|
while (Date.now() - start < ms) { |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
|
@ -0,0 +1,10 @@ |
|||||||
|
const crypto = require("node:crypto"); |
||||||
|
|
||||||
|
class UUIDUtil { |
||||||
|
static uuid = crypto.randomUUID().replace(/-/g, ""); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
console.log(UUIDUtil.uuid); |
||||||
|
|
||||||
|
module.exports = UUIDUtil; |
Loading…
Reference in new issue