wget/curl 下载某些网站的图片,直接给 jpg 链接都只有 403,为啥?

2018-09-13 21:19:53 +08:00
 purezhang
<title>403 Forbidden</title> <center>

403 Forbidden

</center>
<center>nginx</center> <script src="/aes.js" type="text/javascript"></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("171bd056f97a595e95a9ef2231b52dad");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://fujisaki.000a.biz/okkam/nude129/images/okm129h_hikaru_003.jpg?i=1";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript>[
2714 次点击
所在节点    问与答
9 条回复
purezhang
2018-09-13 21:20:06 +08:00
有啥办法解决吗?用什么参数?。
NickCarter
2018-09-13 21:29:24 +08:00
加个 header 试试? referer
purezhang
2018-09-13 21:33:18 +08:00
wget -U 'Mozilla/5.0 (X11; Linux x86_64; rv:30.0) Gecko/20100101 Firefox/30.0' http://fujisaki.000a.biz/okkam/nude129/images/okm129h_hikaru_003.jpg
--2018-09-13 20:57:31-- http://fujisaki.000a.biz/okkam/nude129/images/okm129h_hikaru_003.jpg
Resolving fujisaki.000a.biz... 185.27.134.147
Connecting to fujisaki.000a.biz|185.27.134.147|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 871 [text/html]
Saving to: `okm129h_hikaru_003.jpg'

100%[==========================================================================================================================>] 871 --.-K/s in 0s

2018-09-13 20:57:32 (139 MB/s) - `okm129h_hikaru_003.jpg' saved [871/871]


871 字节,一样的提示,都是下载一个 403
westoy
2018-09-13 21:42:12 +08:00
这个 403 页面里的 js 很清楚了啊, 服务端有做 cookie 验证, 验证失败就输出这个 403 页面写入 cookie, 再做一次跳转
Wincer
2018-09-13 21:44:11 +08:00
需要加 Cookie 和其它一些参数。
curl 'http://fujisaki.000a.biz/okkam/nude129/images/okm129h_hikaru_003.jpg?i=1' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.170 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Referer: http://fujisaki.000a.biz/okkam/nude129/images/okm129h_hikaru_003.jpg' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: zh-CN,zh;q=0.9' -H 'Cookie: __test=d1bef3f56c1a7418dd54e5dc8b1f8240' --compressed

(提醒,图片 NSFW
purezhang
2018-09-13 21:50:55 +08:00
@Wincer
curl 'http://fujisaki.000a.biz/okkam/nude129/images/okm129h_hikaru_003.jpg?i=1' -H 'Connection: keep-alive' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.170 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8' -H 'Referer: http://fujisaki.000a.biz/okkam/nude129/images/okm129h_hikaru_003.jpg' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: zh-CN,zh;q=0.9' -H 'Cookie: __test=d1bef3f56c1a7418dd54e5dc8b1f8240' --compressed

<html><body><script type="text/javascript" src="/aes.js" ></script><script>function toNumbers(d){var e=[];d.replace(/(..)/g,function(d){e.push(parseInt(d,16))});return e}function toHex(){for(var d=[],d=1==arguments.length&&arguments[0].constructor==Array?arguments[0]:arguments,e="",f=0;f<d.length;f++)e+=(16>d[f]?"0":"")+d[f].toString(16);return e.toLowerCase()}var a=toNumbers("f655ba9d09a112d4968c63579db590b4"),b=toNumbers("98344c2eee86c3994890592585b49f80"),c=toNumbers("171bd056f97a595e95a9ef2231b52dad");document.cookie="__test="+toHex(slowAES.decrypt(c,2,a,b))+"; expires=Thu, 31-Dec-37 23:55:55 GMT; path=/"; location.href="http://fujisaki.000a.biz/okkam/nude129/images/okm129h_hikaru_003.jpg?i=2";</script><noscript>This site requires Javascript to work, please enable Javascript in your browser or use a browser with Javascript support</noscript></body></html>
Wincer
2018-09-13 21:57:45 +08:00
@purezhang 你用 Chrome 打开图片后,在开发者工具 network 选项卡选择右键 copy as curl
purezhang
2018-09-13 23:58:28 +08:00
@Wincer 上面的地址就是用 chrome 打开后 copy 的图片链接,我都打开源码看来。
crab
2018-09-14 01:34:54 +08:00
cookies __test

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/489109

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX