关于某淘宝客插件的分析记录(请忽视这篇文章)
某个淘宝客插件
主要功能是根据淘金点等推广数据生成推广链接等信息
插件是免费的,但是数据接口却是收费的。。。 真是够无聊
没事分析一下自己把接口写出来好了
先记录一下接口两次返回的数据吧
发送的数据:
callback:jsonp1472294562208 _:1472294566200 u:https%3A%2F%2Fitem.taobao.com%2Fitem.htm%3Fid%3D535609541222%26ali_refid%3Da3_430582_1006%3A1110444581%3AN%3A%25E5%2581%25A5%25E8%25BA%25AB%25E6%259C%258D%2B%25E9%2585%25B7%25E5%258A%25A8%25E5%259F%258E%3A541f388a833c5859f9799188ab066381%26ali_trackid%3D1_541f388a833c5859f9799188ab066381%26spm%3Da230r.1.14.1.dedeO9%23detail from:http%3A%2F%2Flocalhost sign:1472294606|6a8fb+j11uwzbte7wtXIcyENUSjNuAn99EY70VZmZ/H/|1472294566 c:p cps:1 desc:1 v:1.6.4
返回的数据:
第一次、、
{ "id": "535609541222", "postfee": 0, "title": "健身服运动套装夏短袖t恤男士短裤青年训练圆领薄款跑步服两件套", "image": "http:\/\/img01.taobaocdn.com\/bao\/uploaded\/i1\/1038643514\/TB22aNqtVXXXXX5XpXXXXXXXXXX_!!1038643514.jpg_430x430.jpg", "sellerId": "1038643514", "price": "109.00", "old_price": "199.00", "shop_nick": "七阿哥小迁", "tkinfo": "<span style=\"color:#f50\">当前通用佣金: ¥3.27 (3%),月支出佣金: ¥493.08 (28笔)<\/span>", "url": "https:\/\/item.taobao.com\/item.htm?id=535609541222", "site": "淘宝网", "mall": "taobao", "baoyou": 1, "tags": "包邮" }
第二次
发送的数据:
callback:jsonp1472294562213 _:1472295853182 u:https%3A%2F%2Fitem.taobao.com%2Fitem.htm%3Fid%3D535609541222 from:http%3A%2F%2Flocalhost sign:1472294606|21ccBzkcqbqFDp6B/QYXciRDn3ONKPXaOX9sw9WcMM5Z3/QeXwSwOggCtH22+ZThev1cDO6iUA|1472295853 c:p cps:1 desc:1 v:1.6.4
返回的数据:
{ "tips": "<font color=\"red\">淘点金推广单元ID不对![<a target=\"_blank\" href=\"http:\/\/blogqun.com\/wptao.html#pid\">教程<\/a>]<\/font>", "id": "535609541222", "tkinfo": "<span style=\"color:#f50\">当前通用佣金: ¥3.27 (3%),月支出佣金: ¥493.08 (28笔)<\/span>", "url": "https:\/\/item.taobao.com\/item.htm?id=535609541222", "price": "109.00", "site": "淘宝网", "mall": "taobao", "old_price": "109.00" }
第一次未设置淘金点等信息
而第二次设置了错误的淘金点信息
可以看出返回的信息是不太一样的
这里传输的数据缺没有太大的不同,可能我分析的不太全面
淘金点信息有可能设置在sign参数里,只不过是被加密了
嗯 确实加密了
不过还好有加密代码
更好的是加密解密代码是在一起的
function key_authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) { $ckey_length = 4; $key = ($key) ? md5($key) : ''; $keya = md5(substr($key, 0, 16)); $keyb = md5(substr($key, 16, 16)); $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), - $ckey_length)) : ''; $cryptkey = $keya . md5($keya . $keyc); $key_length = strlen($cryptkey); $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $keyb), 0, 16) . $string; $string_length = strlen($string); $result = ''; $box = range(0, 255); $rndkey = array(); for($i = 0; $i <= 255; $i++) { $rndkey[$i] = ord($cryptkey[$i % $key_length]); } for($j = $i = 0; $i < 256; $i++) { $j = ($j + $box[$i] + $rndkey[$i]) % 256; $tmp = $box[$i]; $box[$i] = $box[$j]; $box[$j] = $tmp; } for($a = $j = $i = 0; $i < $string_length; $i++) { $a = ($a + 1) % 256; $j = ($j + $box[$a]) % 256; $tmp = $box[$a]; $box[$a] = $box[$j]; $box[$j] = $tmp; $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256])); } if ($operation == 'DECODE') { if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16)) { return substr($result, 26); } else { return ''; } } else { return $keyc . str_replace('=', '', base64_encode($result)); } }