20240120爬虫更新JS逆向

This commit is contained in:
markilue 2024-01-20 13:35:16 +08:00
parent 4fb91924f6
commit c41fa032c9
16 changed files with 2733 additions and 0 deletions

View File

@ -0,0 +1,8 @@
#-*- encoding:utf-8 -*-
'''
@Author : dingjiawen
@Date : 2024/1/11 16:45
@Usage :
@Desc :
'''

View File

@ -0,0 +1,8 @@
# -*- encoding:utf-8 -*-
'''
@Author : dingjiawen
@Date : 2024/01/12 15:50
@Usage :
@Desc :
'''

View File

@ -0,0 +1,17 @@
function hook(object, attr) {
var func = object[attr]
object[attr] = function () {
console.log('hooked', object, attr)
var ret = func.apply(object, arguments)
debugger
return ret
}
}
hook(window, 'btoa')
const form = {
username: "admin",
password: "admin"
}
const a = window['btoa'].apply(JSON.stringify(form))
console.log(a)

View File

@ -0,0 +1,8 @@
# -*- encoding:utf-8 -*-
'''
@Author : dingjiawen
@Date : 2024/01/12 20:04
@Usage :
@Desc :
'''

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
// const ciphertext = CryptoJS.encrypt(message, key).toString();
//
//
// function getToken(player) {
// let key = CryptoJS.enc.Utf8.parse("fipFfVsZsTda94hJNKJfLoaqyqMZFFimwLt")
// const {name, birthday, height, weight} = player
// let base64Name = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(name))
// let encrypted = CryptoJS.DES.encrypt(`${base64Name}${birthday}${height}${weight}`, key, {
// mode: CryptoJS.mode.ECB,
// padding: CryptoJS.pad.Pkcs7
// })
// return encrypted.toString()
// }
!(function(a,b){console.log('result',a,b)})(1,2)

View File

@ -0,0 +1,14 @@
# -*- encoding:utf-8 -*-
'''
@Author : dingjiawen
@Date : 2024/01/12 20:11
@Usage :
@Desc :测试执行js的环境
'''
import execjs
print(execjs.get().name)

View File

@ -0,0 +1,30 @@
# -*- encoding:utf-8 -*-
'''
@Author : dingjiawen
@Date : 2024/01/12 20:28
@Usage :
@Desc :模拟执行crypto
'''
import execjs
import json
player = {
"name": "凯文-杜兰特",
"image": "durant.png",
"birthday": "1988-09-29",
"height": "208cm",
"weight": "108.9KG"
}
file = 'crypto.js'
node = execjs.get()
ctx = node.compile(open(file).read())
js = f"getToken({json.dumps(player, ensure_ascii=False)})"
print(js)
result = ctx.eval(js)
print(result)

View File

@ -0,0 +1,8 @@
#-*- encoding:utf-8 -*-
'''
@Author : dingjiawen
@Date : 2024/1/11 16:46
@Usage :
@Desc :
'''

View File

@ -0,0 +1,20 @@
//前提:安装 npm i -D javascript-obfuscator
const code = `
let x = '1'+1
console.log('x',x)
`
const options = {
compact: false,
controlFlowFlattening: true
}
const obfuscator = require('javascript-obfuscator')
function obfuscate(code, options) {
return obfuscator.obfuscate(code, options).getObfuscatedCode()
}
console.log(obfuscate(code, options))

View File

@ -0,0 +1,20 @@
//代码压缩
const code = `
let x = '1'+1
console.log('x',x)
`
const options = {
compact: true,
}
const obfuscator = require('javascript-obfuscator')
function obfuscate(code, options) {
return obfuscator.obfuscate(code, options).getObfuscatedCode()
}
console.log(obfuscate(code, options))

View File

@ -0,0 +1,33 @@
//变量混淆
// const code = `
// let x = '1'+1
// console.log('x',x)
// `
// const options = {
// compact: true,
// identifierNamesGenerator:'mangled'
// }
// const options = {
// identifiersPrefix:'germey'
// }
const code = `
var $ = function(id){
return document.getElementById(id);
};
`
const options = {
renameGlobals: true
}
const obfuscator = require('javascript-obfuscator')
function obfuscate(code, options) {
return obfuscator.obfuscate(code, options).getObfuscatedCode()
}
console.log(obfuscate(code, options))

View File

@ -0,0 +1,25 @@
//字符串混淆
const code = `
var a = 'hello world'
`
// const options = {
// stringArray: true,
// rotateStringArray: true,
// stringArrayEncoding: ['none'], // none, 'base64', 'rc4'
// stringArrayThreshold: 1,
//
// }
const options = {
compact: false,
unicodeEscapeSequence: true
}
const obfuscator = require('javascript-obfuscator')
function obfuscate(code, options) {
return obfuscator.obfuscate(code, options).getObfuscatedCode()
}
console.log(obfuscate(code, options))

View File

@ -0,0 +1,17 @@
//代码自我保护
const code = `
console.log('hello world')
`
const options = {
selfDefending: true
}
const obfuscator = require('javascript-obfuscator')
function obfuscate(code, options) {
return obfuscator.obfuscate(code, options).getObfuscatedCode()
}
console.log(obfuscate(code, options))

View File

@ -0,0 +1,22 @@
//无用代码注入
const code = `
console.log('abc');
console.log('cde');
console.log('efg');
console.log('hij');
`
const options = {
compact: false,
deadCodeInjection: true,
deadCodeInjectionThreshold: 1
}
const obfuscator = require('javascript-obfuscator')
function obfuscate(code, options) {
return obfuscator.obfuscate(code, options).getObfuscatedCode()
}
console.log(obfuscate(code, options))

View File

@ -0,0 +1,13 @@
# -*- encoding:utf-8 -*-
'''
@Author : dingjiawen
@Date : 2024/01/12 14:28
@Usage :
@Desc :
'''
a ="eyJ1c2VybmFtZSI6ImFkbWluIiwicGFzc3dvcmQiOiJhZG1pbiJ9"
print(len(a))