Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多个JS文件相互关联能用这个加载吗? #2

Open
taylorwin opened this issue Nov 21, 2018 · 6 comments
Open

多个JS文件相互关联能用这个加载吗? #2

taylorwin opened this issue Nov 21, 2018 · 6 comments

Comments

@taylorwin
Copy link

比如
// 加载实现加密算法的js脚本
var wasSuccessful = phantom.injectJs('base64.js');/引入实现加密的js文件/

base64.js 这个JS 依赖另一个 xxx.js 怎么操作呢?

@c0ny1
Copy link
Owner

c0ny1 commented Nov 21, 2018

完全可以。比如某前端加密算法依赖1.js,2.js,3.js这三个js文件,那么就可以写

var wasSuccessful = phantom.injectJs('1.js');
var wasSuccessful = phantom.injectJs('2.js');
var wasSuccessful = phantom.injectJs('3.js');

@taylorwin
Copy link
Author

taylorwin commented Nov 21, 2018

谢谢大牛这么快的回复。
如果这几个js 里有相同的函数名,如 1.js 有一个叫a() 2.js里也有a() 那我调用 a()时候实际是哪个函数呢?

@taylorwin
Copy link
Author

taylorwin commented Nov 21, 2018

! function(t) {
function e(i) {
if (n[i]) return n[i].exports;
var o = n[i] = {
i: i,
l: !1,
exports: {}
};
return t[i].call(o.exports, o, o.exports, e), o.l = !0, o.exports
}
....................................
................................
function r(t) {
var e = t.data._ || +new Date,
n = t.url + "?",
i = {
: e
},
r = ["
"],
s = "";
if ("POST" === t.type.toUpperCase() && t.data) i.data = (0, a["default"])(t.data), r.push("data");
else {
for (var d in t.data)!u(i[d]) || u(t.data[d]) || l(t.data[d]) || "" === t.data[d] || (i[d] = t.data[d], r.push(d));
console.log("this is new yeah!!!!")
}
r.sort(), r.push("paterner_key"), r.map(function(t, n) {
s += t + "=", s += "paterner_key" === t ? e.toString().slice(-6, -1) : decodeURIComponent(i[t]), n !== r.length - 1 && (s += "&")
}), i.xa7w6pf = o(c(s)), "POST" === t.type.toUpperCase() && i.data && delete i.data;
for (var f in i) n += f + "=" + encodeURIComponent(decodeURIComponent(i[f])) + "&";
return n = n.slice(0, n.length - 1), "POST" === t.type.toUpperCase() ? {
url: n,
data: t.data
} : {
url: n
}
}
Object.defineProperty(e, "__esModule", {
value: !0
});
var s = n(20),
a = i(s);

....................................
................................
function(t, e) {
t.exports = function() {
throw new Error("define cannot be used indirect")
}
}
]);
这个js 是微信上运行的,所以不能chrome 等游览器调试。
我现在遇到一个混淆过的js i.xa7w6pf = o(c(s)),由于不能定位 o()
函数,所以我想直接能不能用你的方法运行?尝试了都失败了。

@c0ny1
Copy link
Owner

c0ny1 commented Nov 21, 2018

不知道你的这些js的功能是什么,是不是js加密数据。

@taylorwin
Copy link
Author

不知道你的这些js的功能是什么,是不是js加密数据。

是对提交的数据做签名的。

@c0ny1
Copy link
Owner

c0ny1 commented Nov 22, 2018

你能提供一下一个使用该js做数据签名的小demo么。不然我无法只知道phantomjs能否模拟这个对数据做签名的过程。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants