js代码
var CryptoJS = require("crypto-js")
const media_key = CryptoJS[String.fromCharCode(101) + String.fromCharCode(110) + String.fromCharCode(99)][String.fromCharCode(85) + String.fromCharCode(116) + String.fromCharCode(102) + String.fromCharCode(56)][`${String.fromCharCode(112)}arse`]("102_53_100_57_54_53_100_102_55_53_51_51_54_50_55_48"
.split("_")
.map((a) => String.fromCharCode(parseInt(a)))
.join(""));
const media_iv = CryptoJS[String.fromCharCode(101) + String.fromCharCode(110) + String.fromCharCode(99)][String.fromCharCode(85) + String.fromCharCode(116) + String.fromCharCode(102) + String.fromCharCode(56)][`${String.fromCharCode(112)}arse`]("57_55_98_54_48_51_57_52_97_98_99_50_102_98_101_49"
.split("_")
.map((a) => String.fromCharCode(parseInt(a)))
.join(""));
function decryptImage(word) {
const decrypt = CryptoJS[String.fromCharCode(65) + String.fromCharCode(69) + String.fromCharCode(83)]["100_101_99_114_121_112_116"
.split("_")
.map((a) => String.fromCharCode(parseInt(a)))
.join("")](word, media_key, {
iv: media_iv,
mode: CryptoJS["109_111_100_101"
.split("_")
.map((a) => String.fromCharCode(parseInt(a)))
.join("")][String.fromCharCode(67) + String.fromCharCode(66) + String.fromCharCode(67)],
padding: CryptoJS[`${String.fromCharCode(112)}ad`][`${String.fromCharCode(78)}o${String.fromCharCode(80)}adding`],
});
return decrypt.toString(CryptoJS.enc.Base64);
}
// word = "3eKMR0wnLS34vbK+a7RYOz1jggBWqlcz9m/TYYinJegc/CKBVmUDu6TQrA2OdWjols+Wua9v2XrOjOoGTZN4U6mloqgxFTHrJtIh2Y/Lu+d4CLqeRDxcfX41WpMDcSsAOc8BtMjomk8H1tQryyVeM2a+s33HnbX3SMn9V+Ws0n7I0JnjhhUB5zwX8PbdJWNBC1CtqIkMbA6DCoqKsN6+OmOazKV2PvmgXyeRS5mfDMO6JoefyoZkuji3CFEbxLqdE8FhI4qbXxb0KmCTbVZpTMg0UQ1XLKyAZ94XdY9/NGLxjRWywsn3gmJCqMU7eH0GfXWLP3MA798+Shh/s6ZqIuGIOnMZ1fEZReEhCA19w1tj+thzGiTluHXeCHqQ22EC2jDG9sH0kRkZaMrISKj3e5Ok1TdL+6q1GXAaMpmkNS9xKgByxf66R0iOqA/L4KXLEGxNJjIj1CIa9a3c6gGiFg=="
//
// console.log(decryptImage(word))
python代码
import re
import base64
import requests
import execjs
#get请求目标地址,匹配jpeg文件url
def getUrls():
url = 'https://xxx.com/xxx/xxx.html'
response = requests.get(url)
html = response.text
pattern = r'http[s]?://.*?\.jpeg'
jpeg_links = re.findall(pattern, html)
return jpeg_links
#解密
def getImages(word):
with open("decryptImage.js", "r") as f:
javascriptCode = f.read()
jsCompile = execjs.compile(javascriptCode)
imgBase64 = jsCompile.call('decryptImage',str(word))
return imgBase64
#发起图片get请求,最后保存
i = 0
jpeg_links = getUrls()
for url in jpeg_links:
res = requests.get(url)
fileBase64 = base64.b64encode(res.content)
#转换成base64
img = getImages(str(fileBase64,"utf-8"))
#解密函数
img_data = base64.b64decode(img)
#解码
filename = 'images/' + str(i) + '.jpg'
with open(filename, 'wb') as f:
f.write(img_data)
#保存文件
i += 1
# if i == 1 :
# break