首页 > 其他分享 >爬虫js逆向-数据解密

爬虫js逆向-数据解密

时间:2024-12-18 12:28:10浏览次数:8  
标签:15 16 32 解密 爬虫 new Array js 33554432

本文所用网站企名片科创平台

在爬虫中只有运用js逆向才算是真正的入门爬虫,在这里我介绍一种简单的数据解密运用到的js逆向,打开网页

是这样的,通过分析下面的新闻在网页源代码里面没有是后端发送的的数据,然后打开开发者工具进行抓包,分析之后要抓取的网页是这个然后分析数据

携带密文的应该是encrypt_data 然后在页面里面搜寻

打开具体内容,然后开始打断点分析

刷新网页发现在Bc处停止然后进入Bc

发现需要用到Nc和rr.decode,然后继续打断点

分别进入具体的函数

其中rr.decode的名字不一样了,但是无伤大雅,后面使用改一下名字就好了

后面执行过程中发现

说明还有Rc函数,继续寻找就好了

然后就完成了解密所需要的所有函数,执行结果可以正常解密

就是正常的,上面执行过程中所需要的函数可以通过调试发现,在页面继续寻找就好了,下面就是全过程中的具体代码,其中数据太长没有包括,需要请自己复制

function Bc(e) {
    return JSON.parse(Nc("sjdqmp20161205#_316@gfmt", rr(e), 0, 0, "012345677890123", 1))
}
function Rc(e) {
    for (var t = new Array(0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964), n = new Array(0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697), o = new Array(0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272), a = new Array(0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144), r = new Array(0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256), i = new Array(0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488), c = new Array(0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746), l = new Array(0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568), s = new Array(0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578), d = new Array(0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488), m = new Array(0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800), w = new Array(0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744), $ = new Array(0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128), P = new Array(0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261), x = e.length > 8 ? 3 : 1, y = new Array(32 * x), C = new Array(0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0), p, S, b = 0, h = 0, v, k = 0; k < x; k++) {
        var g = e.charCodeAt(b++) << 24 | e.charCodeAt(b++) << 16 | e.charCodeAt(b++) << 8 | e.charCodeAt(b++)
          , E = e.charCodeAt(b++) << 24 | e.charCodeAt(b++) << 16 | e.charCodeAt(b++) << 8 | e.charCodeAt(b++);
        v = (g >>> 4 ^ E) & 252645135,
        E ^= v,
        g ^= v << 4,
        v = (E >>> -16 ^ g) & 65535,
        g ^= v,
        E ^= v << -16,
        v = (g >>> 2 ^ E) & 858993459,
        E ^= v,
        g ^= v << 2,
        v = (E >>> -16 ^ g) & 65535,
        g ^= v,
        E ^= v << -16,
        v = (g >>> 1 ^ E) & 1431655765,
        E ^= v,
        g ^= v << 1,
        v = (E >>> 8 ^ g) & 16711935,
        g ^= v,
        E ^= v << 8,
        v = (g >>> 1 ^ E) & 1431655765,
        E ^= v,
        g ^= v << 1,
        v = g << 8 | E >>> 20 & 240,
        g = E << 24 | E << 8 & 16711680 | E >>> 8 & 65280 | E >>> 24 & 240,
        E = v;
        for (var L = 0; L < C.length; L++)
            C[L] ? (g = g << 2 | g >>> 26,
            E = E << 2 | E >>> 26) : (g = g << 1 | g >>> 27,
            E = E << 1 | E >>> 27),
            g &= -15,
            E &= -15,
            p = t[g >>> 28] | n[g >>> 24 & 15] | o[g >>> 20 & 15] | a[g >>> 16 & 15] | r[g >>> 12 & 15] | i[g >>> 8 & 15] | c[g >>> 4 & 15],
            S = l[E >>> 28] | s[E >>> 24 & 15] | d[E >>> 20 & 15] | m[E >>> 16 & 15] | w[E >>> 12 & 15] | $[E >>> 8 & 15] | P[E >>> 4 & 15],
            v = (S >>> 16 ^ p) & 65535,
            y[h++] = p ^ v,
            y[h++] = S ^ v << 16
    }
    return y
}
rr = function(p) {
            l = /[\t\n\f\r ]/g
            c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
            p = String(p).replace(l, "");
            var m = p.length;
            m % 4 == 0 && (p = p.replace(/==?$/, ""),
            m = p.length),
            (m % 4 == 1 || /[^+a-zA-Z0-9/]/.test(p)) && a("Invalid character: the string to be decoded is not correctly encoded.");
            for (var _ = 0, T, w, y = "", E = -1; ++E < m; )
                w = c.indexOf(p.charAt(E)),
                T = _ % 4 ? T * 64 + w : w,
                _++ % 4 && (y += String.fromCharCode(255 & T >> (-2 * _ & 6)));
            return y
        }
function Nc(e, t, n, o, a, r) {
    var i = new Array(16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756), c = new Array(-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344), l = new Array(520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584), s = new Array(8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928), d = new Array(256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080), m = new Array(536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312), w = new Array(2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154), $ = new Array(268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696), P = Rc(e), x = 0, y, C, p, S, b, h, v, k, g, E, L, F, R, V, H = t.length, U = 0, ce = P.length == 32 ? 3 : 9;
    ce == 3 ? k = n ? new Array(0,32,2) : new Array(30,-2,-2) : k = n ? new Array(0,32,2,62,30,-2,64,96,2) : new Array(94,62,-2,32,64,2,30,-2,-2),
    r == 2 ? t += "        " : r == 1 ? n && (p = 8 - H % 8,
    t += String.fromCharCode(p, p, p, p, p, p, p, p),
    p === 8 && (H += 8)) : r || (t += "\0\0\0\0\0\0\0\0");
    var Y = ""
      , f = "";
    for (o == 1 && (g = a.charCodeAt(x++) << 24 | a.charCodeAt(x++) << 16 | a.charCodeAt(x++) << 8 | a.charCodeAt(x++),
    L = a.charCodeAt(x++) << 24 | a.charCodeAt(x++) << 16 | a.charCodeAt(x++) << 8 | a.charCodeAt(x++),
    x = 0); x < H; ) {
        for (h = t.charCodeAt(x++) << 24 | t.charCodeAt(x++) << 16 | t.charCodeAt(x++) << 8 | t.charCodeAt(x++),
        v = t.charCodeAt(x++) << 24 | t.charCodeAt(x++) << 16 | t.charCodeAt(x++) << 8 | t.charCodeAt(x++),
        o == 1 && (n ? (h ^= g,
        v ^= L) : (E = g,
        F = L,
        g = h,
        L = v)),
        p = (h >>> 4 ^ v) & 252645135,
        v ^= p,
        h ^= p << 4,
        p = (h >>> 16 ^ v) & 65535,
        v ^= p,
        h ^= p << 16,
        p = (v >>> 2 ^ h) & 858993459,
        h ^= p,
        v ^= p << 2,
        p = (v >>> 8 ^ h) & 16711935,
        h ^= p,
        v ^= p << 8,
        p = (h >>> 1 ^ v) & 1431655765,
        v ^= p,
        h ^= p << 1,
        h = h << 1 | h >>> 31,
        v = v << 1 | v >>> 31,
        C = 0; C < ce; C += 3) {
            for (R = k[C + 1],
            V = k[C + 2],
            y = k[C]; y != R; y += V)
                S = v ^ P[y],
                b = (v >>> 4 | v << 28) ^ P[y + 1],
                p = h,
                h = v,
                v = p ^ (c[S >>> 24 & 63] | s[S >>> 16 & 63] | m[S >>> 8 & 63] | $[S & 63] | i[b >>> 24 & 63] | l[b >>> 16 & 63] | d[b >>> 8 & 63] | w[b & 63]);
            p = h,
            h = v,
            v = p
        }
        h = h >>> 1 | h << 31,
        v = v >>> 1 | v << 31,
        p = (h >>> 1 ^ v) & 1431655765,
        v ^= p,
        h ^= p << 1,
        p = (v >>> 8 ^ h) & 16711935,
        h ^= p,
        v ^= p << 8,
        p = (v >>> 2 ^ h) & 858993459,
        h ^= p,
        v ^= p << 2,
        p = (h >>> 16 ^ v) & 65535,
        v ^= p,
        h ^= p << 16,
        p = (h >>> 4 ^ v) & 252645135,
        v ^= p,
        h ^= p << 4,
        o == 1 && (n ? (g = h,
        L = v) : (h ^= E,
        v ^= F)),
        f += String.fromCharCode(h >>> 24, h >>> 16 & 255, h >>> 8 & 255, h & 255, v >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255),
        U += 8,
        U == 512 && (Y += f,
        f = "",
        U = 0)
    }
    if (Y += f,
    Y = Y.replace(/\0*$/g, ""),
    !n) {
        if (r === 1) {
            var H = Y.length
              , _ = 0;
            H && (_ = Y.charCodeAt(H - 1)),
            _ <= 8 && (Y = Y.substring(0, H - _))
        }
        Y = decodeURIComponent(escape(Y))
    }
    return Y
}
e="encrypt_data"
console.log(Bc(e))

标签:15,16,32,解密,爬虫,new,Array,js,33554432
From: https://blog.csdn.net/xuexueyouzi/article/details/144552806

相关文章

  • 说说你认为js的黑科技有哪些?
    在前端开发中,JavaScript(JS)的黑科技涵盖了多个方面,这些技术能够提升开发效率、增强用户体验和优化性能。以下是一些我认为值得一提的JS黑科技:1.响应式设计与布局媒体查询:通过使用HTML5和CSS3的媒体查询功能,网页可以自动适应不同设备的屏幕大小,为用户提供最佳的浏览体验。流式......
  • 探索Node.js的奇妙世界:从零开始的入门之旅
    引言:在现代Web开发领域,Node.js已经成为了一颗耀眼的新星。它不仅改变了服务器端编程的游戏规则,还为开发者们提供了一种全新的方式来构建高效、可扩展的网络应用。无论你是前端开发者还是后端开发者,了解和掌握Node.js都将为你的开发生涯增添一份强大的技能。本文将带你踏上......
  • 深入理解 Node.js 模块系统:构建高效、可维护的 JavaScript 代码
    摘要:Node.js的模块系统是其强大功能的核心之一,它允许开发者将代码组织成模块化的结构,从而提高代码的可维护性和重用性。本文将深入探讨Node.js模块系统的各个方面,包括模块概述、成员导出与导入、ModuleWrapperFunction以及Node.js内置模块,帮助你更好地理解和利用这......
  • 深入理解NPM:Node.js的包管理器
    在现代Web开发中,Node.js已经成为不可或缺的工具之一。它不仅简化了JavaScript在服务器端的执行过程,还提供了丰富的模块系统和包管理工具。而NPM(NodePackageManager)作为Node.js的官方包管理器,更是让开发者能够轻松地安装、管理和更新各种功能模块。本文将详细探讨NPM的核心......
  • 360.大学生HTML5期末大作业 —【漫威电影网站(页)】 Web前端网页制作 html5+css3+js
    目录一、网页简介二、网页文件三、网页效果四、代码展示1.html2.CSS3.JS五、总结1.简洁实用2.使用方便3.整体性好4.形象突出5.交互式强欢迎来到我的CSDN主页!您的支持是我创作的动力!Web前端网页制作、网页完整代码、大学生期末大作业案例模板完整代码、技术交......
  • Vue.js前端框架教程1:Vue应用启动和Vue组件
    文章目录Vue应用Vue应用的主要组成部分:启动Vue应用:Vue组件基础组件组件注册父子组件组件插槽(Slots)动态组件和`keep-alive`Vue应用Vue应用由几个主要部分组成,每个部分都有其特定的角色和职责。以下是Vue应用的主要组成部分以及如何启动一个Vue应用的......
  • 使用pjsip封装自定义软电话sdk
    环境:window10_x64&vs2022pjsip版本:2.14.1python版本:3.9.13近期有关于windows环境下软电话sdk开发的需求,需要开发动态库给上层应用调用,今天整理下使用pjsip封装简单的自定义软电话sdk笔记,并提供相关资源下载。我将从以下几个方面展开:功能说明接口设计接口实现接口调用......
  • js如何获取元素的高度的几种方式
    在JavaScript中,你可以使用多种方法来获取元素的高度。以下是一些常见的方法:使用offsetHeight属性:offsetHeight属性返回元素的像素高度,包括元素的边框、内边距和水平滚动条(如果存在)。constelement=document.getElementById("myElement");constheight=element.offs......
  • node.js毕设大学校园兼职网站程序+论文
    本系统(程序+源码+数据库+调试部署+开发环境)带文档lw万字以上,文末可获取源码系统程序文件列表开题报告内容一、选题背景关于大学校园兼职的研究,现有研究主要以大学生兼职的社会现象、兼职权益保障等为主。专门针对大学校园兼职网站这种专门化平台的构建、运营及相关影响的......
  • node.js毕设大学校园公益闲置物品回收程序+论文
    本系统(程序+源码+数据库+调试部署+开发环境)带文档lw万字以上,文末可获取源码系统程序文件列表开题报告内容一、选题背景关于闲置物品回收的研究,现有研究主要集中在社会层面的商业回收模式等为主,专门针对大学校园公益性质的闲置物品回收的研究较少。在校园中,随着学生生活水......