qnloft-spider/Job/com.boss_zhipin/demo.js

511 lines
18 KiB
JavaScript

const jsdom = require("jsdom");
const {JSDOM} = jsdom;
const {CookieJar} = require('tough-cookie');
delete __filename
delete __dirname
const customCookies = [];
const cookieJar = new CookieJar();
customCookies.forEach(cookie => {
cookieJar.setCookieSync(cookie, 'https://www.zhipin.com/web/geek/job?query=python&city=101020100');
});
proxy_ = function (obj) {
return new Proxy(obj, {
set(target, property, value) {
console.table([{"类型": 'set', '调用者': target, "调用属性": property, '设置值': value}])
return Reflect.set(...arguments)
},
get(target, property, receiver) {
console.table([{"类型": 'get', '调用者': target, "调用属性": property, '获取值': target[property]}])
return target[property]
}
})
}
const resourceLoader = new jsdom.ResourceLoader({
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36",
});
const html = `<!DOCTYPE html><p>Hello world</p>`;
const dom = new JSDOM(html, {
url: "https://www.zhipin.com/web/geek/job?query=python&city=101020100",
referrer: "https://www.zhipin.com/web/geek/job?query=python&city=101020100",
contentType: "text/html",
pretendToBeVisual: true,
resources: resourceLoader,
cookieJar: cookieJar,
});
window = global
self = global;
top = global;
// window = proxy_(window);
win = dom.window;
document = win.document;
// document = proxy_(document);
navigator = win.navigator;
// navigator = proxy_(navigator);
location = win.location
// location = proxy_(location);
history = win.history;
// history = proxy_(history);
screen = win.screen;
// screen = proxy_(screen);
localStorage = win.localStorage;
// localStorage = proxy_(localStorage);
sessionStorage = win.sessionStorage;
// sessionStorage = proxy_(sessionStorage)
window['outerHeighten'] = undefined;
window['alert'] = function () {
}
window['Buffer'] = false;
Frequency = {
name: 'Frequency',
setValueAtTime: function (a, b, c, d) {
if (b === undefined) {
throw new Error('Frequency')
}
}
}
// Frequency = proxy_(Frequency)
OscillatorNode = {
name: 'OscillatorNode',
frequency: Frequency,
connect: function (a) {
return DynamicsCompressorNode
},
start: function (a, b) {
if (a === 0) {
throw new Error('123')
}
}
}
// OscillatorNode = proxy_(OscillatorNode)
var Threshold = {
name: 'Threshold',
automationRate: "k-rate",
defaultValue: -24,
maxValue: 0,
minValue: -100,
value: -24,
setValueAtTime: function (a, b, c) {
return Threshold
}
}
// Threshold = proxy_(Threshold)
var knee = {
name: 'knee',
automationRate: "k-rate",
defaultValue: 30,
maxValue: 40,
minValue: 0,
value: 30,
setValueAtTime: function (a, b, c) {
return knee
}
}
// knee = proxy_(knee)
var ratio = {
name: 'rate',
automationRate: "k-rate",
defaultValue: 12,
maxValue: 20,
minValue: 1,
value: 12,
setValueAtTime: function (a, b) {
return ratio
}
}
// ratio = proxy_(ratio)
var attack = {
name: 'attack',
automationRate: "k-rate",
defaultValue: 12,
maxValue: 20,
minValue: 1,
value: 12,
setValueAtTime: function (a, b) {
console.log(a, b)
return attack
}
}
// attack = proxy_(attack)
DynamicsCompressorNode = {
name: 'DynamicsCompressorNode',
threshold: Threshold,
knee: knee,
ratio: ratio,
reduction: 0,
attack: attack,
// release: Threshold,
// ratio: Threshold,
connect: function (a) {
if (a === undefined) {
throw new Error('A parameter must be')
}
}
}
// DynamicsCompressorNode = proxy_(DynamicsCompressorNode)
AudioDestinationNode = {
name: 'AudioDestinationNode',
}
// AudioDestinationNode = proxy_(AudioDestinationNode)
OfflineAudioContexts = {
name: 'OfflineAudioContext',
createOscillator: function () {
console.log('createOscillator')
return OscillatorNode
},
currentTime: 0,
createDynamicsCompressor: function () {
return DynamicsCompressorNode
},
destination: AudioDestinationNode
}
// OfflineAudioContexts = proxy_(OfflineAudioContexts)
window_new = {
SpeechSynthesisUtterance: function () {
},
XMLHttpRequest: function () {
},
SourceBuffer: function () {
},
OfflineAudioContext: function () {
return OfflineAudioContexts
},
addEvenetListener: function () {
},
MediaEncryptedEvent: function () {
},
Path2D: function () {
},
SVGGraphicsElement: function () {
},
CDATASection: function () {
},
PerformancePaintTiming: function () {
},
outerHeighten: function () {
},
sessionStorage: {},
Math: Math,
DOMParser: function () {
},
HTMLFrameSetElement: function () {
},
clearInterval: function clearInterval() {
},
clearTimeout: function clearTimeout() {
},
clientInformation: navigator,
close: function close() {
},
closed: false,
confirm: function confirm() {
},
cookieStore: {onchange: null},
createImageBitmap: function createImageBitmap() {
},
credentialless: false,
crossOriginIsolated: false,
customElements: {},
devicePixelRatio: 1.25,
document: document,
external: {},
frameElement: {},
frames: window,
getComputedStyle: function getComputedStyle() {
},
getScreenDetails: function getScreenDetails() {
},
getSelection: function getSelection() {
},
history: {length: 10, scrollRestoration: 'auto', stat: null},
indexedDB: {},
innerHeight: 0,
innerWidth: 0,
isSecureContext: true,
launchQueue: {},
length: 0,
location: location,
locationbar: {visible: true},
matchMedia: function matchMedia() {
},
menubar: {visible: true},
name: "zhipinFrame",
navigator: navigator,
onabort: null,
onafterprint: null,
onanimationend: null,
onanimationiteration: null,
onanimationstart: null,
onappinstalled: null,
onauxclick: null,
onbeforeinput: null,
onbeforeinstallprompt: null,
onbeforematch: null,
onbeforeprint: null,
onbeforetoggle: null,
onbeforeunload: null,
onbeforexrselect: null,
onblur: null,
oncancel: null,
oncanplay: null,
oncanplaythrough: null,
onchange: null,
onclick: null,
onclose: null,
oncontentvisibilityautostatechange: null,
oncontextlost: null,
oncontextmenu: null,
oncontextrestored: null,
oncuechange: null,
ondblclick: null,
ondevicemotion: null,
ondeviceorientation: null,
ondeviceorientationabsolute: null,
ondrag: null,
ondragend: null,
ondragenter: null,
ondragleave: null,
ondragover: null,
ondragstart: null,
ondrop: null,
ondurationchange: null,
onemptied: null,
onended: null,
onerror: null,
onfocus: null,
onformdata: null,
ongotpointercapture: null,
onhashchange: null,
oninput: null,
oninvalid: null,
onkeydown: null,
onkeypress: null,
onkeyup: null,
onlanguagechange: null,
onload: null,
onloadeddata: null,
onloadedmetadata: null,
onloadstart: null,
onlostpointercapture: null,
onmessage: null,
onmessageerror: null,
onmousedown: null,
onmouseenter: null,
onmouseleave: null,
onmousemove: null,
onmouseout: null,
onmouseover: null,
onmouseup: null,
onmousewheel: null,
onoffline: null,
ononline: null,
onpagehide: null,
onpageshow: null,
onpause: null,
onplay: null,
onplaying: null,
onpointercancel: null,
onpointerdown: null,
onpointerenter: null,
onpointerleave: null,
onpointermove: null,
onpointerout: null,
onpointerover: null,
onpointerrawupdate: null,
onpointerup: null,
onpopstate: null,
onprogress: null,
onratechange: null,
onrejectionhandled: null,
onreset: null,
onresize: null,
onscroll: null,
onscrollend: null,
onsearch: null,
onsecuritypolicyviolation: null,
onseeked: null,
onseeking: null,
onselect: null,
onselectionchange: null,
onselectstart: null,
onslotchange: null,
onstalled: null,
onstorage: null,
onsubmit: null,
onsuspend: null,
ontimeupdate: null,
ontoggle: null,
ontransitioncancel: null,
ontransitionend: null,
ontransitionrun: null,
ontransitionstart: null,
onunhandledrejection: null,
onunload: null,
onvolumechange: null,
onwaiting: null,
onwebkitanimationend: null,
onwebkitanimationiteration: null,
onwebkitanimationstart: null,
onwebkittransitionend: null,
onwheel: null,
open: function open() {
},
openDatabase: function openDatabase() {
},
opener: null,
origin: "http:/www.zhipin.com",
originAgentCluster: false,
outerHeight: 864,
outerWidth: 1536,
pageXOffset: 0,
pageYOffset: 0,
parent: window,
personalbar: {visibl: true},
postMessage: function postMessage() {
},
prompt: function prompt() {
},
queryLocalFonts: function queryLocalFonts() {
},
queueMicrotask: function queueMicrotask() {
},
releaseEvents: function releaseEvents() {
},
reportError: function reportError() {
},
requestAnimationFrame: function requestAnimationFrame() {
},
requestIdleCallback: function requestIdleCallback() {
},
resizeBy: function resizeBy() {
},
resizeTo: function resizeTo() {
},
scheduler: {},
screen: {availWidt: 536, availHeigh: 64, widt: 536, heigh: 64, colorDept: 4},
screenLeft: 0,
screenTop: 0,
screenX: 0,
screenY: 0,
scroll: function scroll() {
},
scrollBy: function scrollBy() {
},
scrollTo: function scrollTo() {
},
scrollX: 0,
scrollY: 0,
scrollbars: {visibl: true},
showDirectoryPicker: function showDirectoryPicker() {
},
showOpenFilePicker: function showOpenFilePicker() {
},
showSaveFilePicker: function showSaveFilePicker() {
},
speechSynthesis: {pendin: false, speakin: false, pause: false, onvoiceschange: null,},
status: "",
statusbar: {visible: true},
stop: function stop() {
},
structuredClone: function structuredClone() {
},
styleMedia: {type: 'screen'},
toolbar: {visible: true},
trustedTypes: {},
window: window,
}
window_new.top = window_new;
Object.assign(window, window_new);
window.top = window_new;
var Object_toString = Object.prototype.toString;
Object.prototype.toString = function () {
let temp = Object_toString.call(this, arguments);
if (temp === '[object global]' || temp === '[object Window]') {
return '[object Window]'
} else if (this.constructor.name === 'String') {
return this.valueOf()
}
return temp
}
var Function_toString = Function.prototype.toString;
Function.prototype.toString = function () {
let temp = Function_toString.call(this, arguments);
if (this.name === 'Window') {
return 'function window() { [native code] }'
} else {
return temp
}
}
CanvasRenderingContext2D = {
name: '2d',
fillRect: function (a, b, c, d) {
return undefined
},
fillText: function (a, b, c, d) {
return undefined
}
}
CanvasRenderingContext2D = new Proxy(CanvasRenderingContext2D, {
set(target, property, value) {
if (value === 'tencent') {
return
}
// console.table([{"类型": 'set', '调用者': target, "调用属性": property, '设置值': value}])
return Reflect.set(...arguments)
},
get(target, property, receiver) {
// console.table([{"类型": 'get', '调用者': target, "调用属性": property, '获取值': target[property]}])
return target[property]
}
})
canvas = {
getContext: function (arg) {
if (arg === '2d') {
return CanvasRenderingContext2D
}
console.log(arg)
},
toDataURL: function () {
return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAACWCAYAAABkW7XSAAAAAXNSR0IArs4c6QAADwtJREFUeF7t23lwVeUZx/HnXCBLESSBGGlEhYBGEQhhCy4VcC06ymYZF+wo5l5iZ5CqNcqgTsticUVsIfcCYQQBUSTYUSwIaF1ABFxAUMpiVUCTuLCbALmn857khiwX34nE8AS//ONInvOe53yem9+c896DI/xBAAEEGoiA00D6pM06FHD94tbhcg1mKSckfN4bzLSiN8oAG/gAf077BNbPUeMYDQIEloYp1HMPBFY9g3O6OhMgsOqMsuEsRGA1nFnRaVUBAutX+IkgsH6FQz9JLpnAOkk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wFIyCNpAAAG7AIFlN6ICAQSUCBBYSgZBGwggYBcgsOxGVCCAgBIBAkvJIGgDAQTsAgSW3YgKBBBQIkBgKRkEbSCAgF2AwLIbUYEAAkoECCwlg6ANBBCwCxBYdiMqEEBAiQCBpWQQtIEAAnYBAstuRAUCCCgRILCUDII2EEDALkBg2Y2oQAABJQIElpJB0AYCCNgFCCy7ERUIIKBEgMBSMgjaQAABuwCBZTeiAgEElAgQWEoGQRsIIGAXILDsRlQggIASAQJLySBoAwEE7AIElt2ICgQQUCJAYCkZBG0ggIBdgMCyG1GBAAJKBAgsJYOgDQQQsAsQWHYjKhBAQIkAgaVkELSBAAJ2AQLLbkQFAggoESCwlAyCNhBAwC5AYNmNqEAAASUCBJaSQdAGAgjYBQgsuxEVCCCgRIDAUjII2kAAAbsAgWU3ogIBBJQIEFhKBkEbCCBgFyCw7EZUIICAEoH/A/Jsi+LV22NtAAAAAElFTkSuQmCC'
}
}
// canvas = proxy_(canvas)
createElement = function (arg) {
if (arg === 'canvas') {
return canvas
}
console.log(arg)
}
document.createElement = createElement
require('./jssss')
function r(t, n) {
(new Date).getTime();
return encodeURIComponent(
new window['ABC']().z(t, parseInt(n) + 60 * (480 + (new Date).getTimezoneOffset()) * 1e3)
)
}
console.log(r('O0g/w1ePRcDnxW8L4GMvtxKUqEEjiTw9Qee2h3AO23A=', '1691716083134'))