V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  airdge  ›  全部回复第 3 页 / 共 4 页
回复总数  65
1  2  3  4  
2018-08-09 18:18:05 +08:00
回复了 xoxo419 创建的主题 程序员 PHP 中的$this->container['request'] instanceof Request 是什么意思?
判断$this->container['request']是不是属于 Request 类
2018-08-09 11:24:06 +08:00
回复了 xoxo419 创建的主题 PHP PHP 数组练习#4#array_intersect_uassoc 疑问
这个函数只使用自定义函数比较键名,不比较键值,所以只输出 b=>brown
在揪出三副本后 总要找一个出来背黑锅
2018-08-08 09:46:34 +08:00
回复了 xoxo419 创建的主题 程序员 PHP 字符串可以直接比较大小?
字符串比较按照从左到右逐个字符对比
也可以可以用 strcmp
strcmp('a','A') //32 97-65
strcmp('ac','ad') //-1 99-100
strcmp('ac','fe') //-5 97-102
2018-08-08 08:29:35 +08:00
回复了 JamesHopbourn 创建的主题 JavaScript JavaScript 书签中添加 replace 后就无法正常执行
code = (document.documentElement.outerHTML);
var re = /msg_title = "(.*)"/g;
var title = re.exec(code) [1];
2018-08-08 08:22:04 +08:00
回复了 JamesHopbourn 创建的主题 JavaScript JavaScript 书签中添加 replace 后就无法正常执行
code.match 返回的是数组
title = title[0].replace(/msg_title = |"/,'');
2018-08-07 18:34:59 +08:00
回复了 xoxo419 创建的主题 程序员 PHP 字符串可以直接比较大小?
$a = 'a';
$b = 'b';
echo $a > $b ? '大' : '小';
$a = 'ab';
$b = 'ac';
echo $a > $b ? '大' : '小';
$a = 'acc';
$b = 'd';
echo $a > $b ? '大' : '小';
//小小小
论数据备份的重要性
2018-08-03 11:16:19 +08:00
回复了 Loooom 创建的主题 Python 今日头条号封 ip 问题
ip 代理池
2018-07-31 16:16:08 +08:00
回复了 VKMEPR 创建的主题 PHP PHP 里这样插入 HTML 合乎规范吗?
echo <<<ABC
xxxxxxxx
ABC;
2018-07-31 16:14:42 +08:00
回复了 VKMEPR 创建的主题 PHP PHP 里这样插入 HTML 合乎规范吗?
echo <<<EOT
xxxxxxxx
EOT;
2018-07-25 17:36:03 +08:00
回复了 netStand 创建的主题 MySQL mysql 问个问题。大神们请不吝赐教。
mysql+redis/memcache
除了一楼说的外
右键那个图标 不是有移除两个字
2018-07-22 20:38:49 +08:00
回复了 bestehen 创建的主题 Node.js js 加密 运行报错
atob 换成这个
function atob(a) {
var b, c, e, d, f, g = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1];
d = a.length;
e = 0;
for (f = ""; e < d;) {
do b = g[a.charCodeAt(e++) & 255]; while (e < d && -1 == b);
if (-1 == b) break;
do c = g[a.charCodeAt(e++) & 255]; while (e < d && -1 == c);
if (-1 == c) break;
f += String.fromCharCode(b << 2 | (c & 48) >> 4);
do {
b = a.charCodeAt(e++) & 255;
if (61 == b) return f;
b = g[b]
} while (e < d && -1 == b);
if (-1 == b) break;
f += String.fromCharCode((c & 15) << 4 | (b & 60) >> 2);
do {
c = a.charCodeAt(e++) & 255;
if (61 == c) return f;
c = g[c]
} while (e < d && -1 == c);
if (-1 == c) break;
f += String.fromCharCode((b & 3) << 6 | c)
}
return f
}
2018-07-22 20:37:02 +08:00
回复了 bestehen 创建的主题 Python 爬虫的 base64 解密问题
@bestehen
控制台调试相关参数 对比 nodejs 输出有哪些异常
I = s(t),
L = 0,
D = e.length,
执行这一行时
浏览器 D 值 26712; nodejs D 值为 25310
就可以知道 Buffer 转码异常
function atob(a) {
var b, c, e, d, f, g = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1];
d = a.length;
e = 0;
for (f = ""; e < d;) {
do b = g[a.charCodeAt(e++) & 255]; while (e < d && -1 == b);
if (-1 == b) break;
do c = g[a.charCodeAt(e++) & 255]; while (e < d && -1 == c);
if (-1 == c) break;
f += String.fromCharCode(b << 2 | (c & 48) >> 4);
do {
b = a.charCodeAt(e++) & 255;
if (61 == b) return f;
b = g[b]
} while (e < d && -1 == b);
if (-1 == b) break;
f += String.fromCharCode((c & 15) << 4 | (b & 60) >> 2);
do {
c = a.charCodeAt(e++) & 255;
if (61 == c) return f;
c = g[c]
} while (e < d && -1 == c);
if (-1 == c) break;
f += String.fromCharCode((b & 3) << 6 | c)
}
return f
}


用这个函数替换 Buffer 就可以了
2018-07-17 14:58:21 +08:00
回复了 bestehen 创建的主题 Python 爬虫的 base64 解密问题
@bestehen
你那个是 nodejs 没初始化,找不到模块
用 buffer 解码下就可以了
function atob(a) {
var b = new Buffer.from(String(a), 'base64')
return b.toString();
}
function btoa(a) {
var b = new Buffer.from(String(a));
return b.toString('base64');
}

console.log(btoa('v2ex.com'));
console.log(atob('djJleC5jb20='));
2018-07-17 10:10:22 +08:00
回复了 bestehen 创建的主题 Python 爬虫的 base64 解密问题
function s(t) {
for (var e, i, a, s = 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), l = new Array(0, 2097152, 134217728, 136314880, 8192, 2105344, 134225920, 136323072, 131072, 2228224, 134348800, 136445952, 139264, 2236416, 134356992, 136454144), c = new Array(0, 262144, 16, 262160, 0, 262144, 16, 262160, 4096, 266240, 4112, 266256, 4096, 266240, 4112, 266256), r = new Array(0, 1024, 32, 1056, 0, 1024, 32, 1056, 33554432, 33555456, 33554464, 33555488, 33554432, 33555456, 33554464, 33555488), d = new Array(0, 268435456, 524288, 268959744, 2, 268435458, 524290, 268959746, 0, 268435456, 524288, 268959744, 2, 268435458, 524290, 268959746), h = new Array(0, 65536, 2048, 67584, 536870912, 536936448, 536872960, 536938496, 131072, 196608, 133120, 198656, 537001984, 537067520, 537004032, 537069568), u = new Array(0, 262144, 0, 262144, 2, 262146, 2, 262146, 33554432, 33816576, 33554432, 33816576, 33554434, 33816578, 33554434, 33816578), p = new Array(0, 268435456, 8, 268435464, 0, 268435456, 8, 268435464, 1024, 268436480, 1032, 268436488, 1024, 268436480, 1032, 268436488), v = new Array(0, 32, 0, 32, 1048576, 1048608, 1048576, 1048608, 8192, 8224, 8192, 8224, 1056768, 1056800, 1056768, 1056800), m = new Array(0, 16777216, 512, 16777728, 2097152, 18874368, 2097664, 18874880, 67108864, 83886080, 67109376, 83886592, 69206016, 85983232, 69206528, 85983744), f = new Array(0, 4096, 134217728, 134221824, 524288, 528384, 134742016, 134746112, 16, 4112, 134217744, 134221840, 524304, 528400, 134742032, 134746128), g = new Array(0, 4, 256, 260, 0, 4, 256, 260, 1, 5, 257, 261, 1, 5, 257, 261), _ = t.length>8 ? 3 : 1, b = new Array(32 * _), y = new Array(0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0), w = 0, C = 0, x = 0; x<_; x++) {
var k = t.charCodeAt(w++) << 24 | t.charCodeAt(w++) << 16 | t.charCodeAt(w++) << 8 | t.charCodeAt(w++),
S = t.charCodeAt(w++) << 24 | t.charCodeAt(w++) << 16 | t.charCodeAt(w++) << 8 | t.charCodeAt(w++);
a = 252645135 & (k >>> 4 ^ S), S ^= a, k ^= a << 4, a = 65535 & (S >>> -16 ^ k), k ^= a, S ^= a << -16, a = 858993459 & (k >>> 2 ^ S), S ^= a, k ^= a << 2, a = 65535 & (S >>> -16 ^ k), k ^= a, S ^= a << -16, a = 1431655765 & (k >>> 1 ^ S), S ^= a, k ^= a << 1, a = 16711935 & (S >>> 8 ^ k), k ^= a, S ^= a << 8, a = 1431655765 & (k >>> 1 ^ S), S ^= a, k ^= a << 1, a = k << 8 | S >>> 20 & 240, k = S << 24 | S << 8 & 16711680 | S >>> 8 & 65280 | S >>> 24 & 240, S = a;
for (var $ = 0; $<y.length; $++) y[$] ? (k = k << 2 | k >>> 26, S = S << 2 | S >>> 26) : (k = k << 1 | k >>> 27, S = S << 1 | S >>> 27), k &= -15, S &= -15, e = s[k >>> 28] | n[k >>> 24 & 15] | o[k >>> 20 & 15] | l[k >>> 16 & 15] | c[k >>> 12 & 15] | r[k >>> 8 & 15] | d[k >>> 4 & 15], i = h[S >>> 28] | u[S >>> 24 & 15] | p[S >>> 20 & 15] | v[S >>> 16 & 15] | m[S >>> 12 & 15] | f[S >>> 8 & 15] | g[S >>> 4 & 15], a = 65535 & (i >>> 16 ^ e), b[C++] = e ^ a, b[C++] = i ^ a << 16
}
return b
}

function n(t) {
return JSON.parse(a("5e5062e82f15fe4ca9d24bc561080e0e",atob(t),0,0,"012345677890123",1))
}




var de='这边是加密数据';
console.log(n(de));



自己复制到控制台运行一下就行了

得到的是 object 内容里就有汉字 @bestehen
2018-07-17 10:08:08 +08:00
回复了 bestehen 创建的主题 Python 爬虫的 base64 解密问题
function a(t, e, i, a, n, o) {
var l, c, r, d, h, u, p, v, m, f, g, _, b, y,
w = 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),
x = 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),
k = 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),
S = 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),
$ = 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),
z = 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),
A = 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),
I = s(t),
L = 0,
D = e.length,
T = 0,
P = 32 == I.length ? 3 : 9;
v = 3 == P ? i ? new Array(0, 32, 2) : new Array(30, -2, -2) : i ? new Array(0, 32, 2, 62, 30, -2, 64, 96, 2) : new Array(94, 62, -2, 32, 64, 2, 30, -2, -2), 2 == o ? e += " " : 1 == o ? i && (r = 8 - D % 8, e += String.fromCharCode(r, r, r, r, r, r, r, r), 8 === r && (D += 8)) : o || (e += "\0\0\0\0\0\0\0\0");
var N = "",
M = "";
for (1 == a && (m = n.charCodeAt(L++) << 24 | n.charCodeAt(L++) << 16 | n.charCodeAt(L++) << 8 | n.charCodeAt(L++), g = n.charCodeAt(L++) << 24 | n.charCodeAt(L++) << 16 | n.charCodeAt(L++) << 8 | n.charCodeAt(L++), L = 0); L<D;) {
for (u = e.charCodeAt(L++) << 24 | e.charCodeAt(L++) << 16 | e.charCodeAt(L++) << 8 | e.charCodeAt(L++), p = e.charCodeAt(L++) << 24 | e.charCodeAt(L++) << 16 | e.charCodeAt(L++) << 8 | e.charCodeAt(L++), 1 == a && (i ? (u ^= m, p ^= g) : (f = m, _ = g, m = u, g = p)), r = 252645135 & (u >>> 4 ^ p), p ^= r, u ^= r << 4, r = 65535 & (u >>> 16 ^ p), p ^= r, u ^= r << 16, r = 858993459 & (p >>> 2 ^ u), u ^= r, p ^= r << 2, r = 16711935 & (p >>> 8 ^ u), u ^= r, p ^= r << 8, r = 1431655765 & (u >>> 1 ^ p), p ^= r, u ^= r << 1, u = u << 1 | u >>> 31, p = p << 1 | p >>> 31, c = 0; c<P; c += 3) {
for (b = v[c + 1], y = v[c + 2], l = v[c]; l != b; l += y) d = p ^ I[l], h = (p >>> 4 | p << 28) ^ I[l + 1], r = u, u = p, p = r ^ (C[d >>> 24 & 63] | k[d >>> 16 & 63] | $[d >>> 8 & 63] | A[63 & d] | w[h >>> 24 & 63] | x[h >>> 16 & 63] | S[h >>> 8 & 63] | z[63 & h]);
r = u, u = p, p = r
}
u = u >>> 1 | u << 31, p = p >>> 1 | p << 31, r = 1431655765 & (u >>> 1 ^ p), p ^= r, u ^= r << 1, r = 16711935 & (p >>> 8 ^ u), u ^= r, p ^= r << 8, r = 858993459 & (p >>> 2 ^ u), u ^= r, p ^= r << 2, r = 65535 & (u >>> 16 ^ p), p ^= r, u ^= r << 16, r = 252645135 & (u >>> 4 ^ p), p ^= r, u ^= r << 4, 1 == a && (i ? (m = u, g = p) : (u ^= f, p ^= _)), M += String.fromCharCode(u >>> 24, u >>> 16 & 255, u >>> 8 & 255, 255 & u, p >>> 24, p >>> 16 & 255, p >>> 8 & 255, 255 & p), T += 8, 512 == T && (N += M, M = "", T = 0)
}
if (N += M, N = N.replace(/\0*$/g, ""), !i) {
if (1 === o) {
var D = N.length,
j = 0;
D && (j = N.charCodeAt(D - 1)), j<=8 && (N = N.substring(0, D - j))
}
N = decodeURIComponent(escape(N))
}
return N
}
2018-07-16 20:24:19 +08:00
回复了 bestehen 创建的主题 Python 爬虫的 base64 解密问题
算法位于:http://vip.qimingpian.com/static/js/app.7b6630a6e4c6f54565dd.js
解密函数
function n(t) {
return JSON.parse(a("5e5062e82f15fe4ca9d24bc561080e0e", atob(t), 0, 0, "012345677890123", 1))
}
相关函数在这个 js 里面
解密结果为 object
Object { items=[40], total="110354"}
1  2  3  4  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5432 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 36ms · UTC 08:09 · PVG 16:09 · LAX 00:09 · JFK 03:09
Developed with CodeLauncher
♥ Do have faith in what you're doing.