오늘도 wget 여러 옵션들을 테스트해봤습니다.
그동안 제일 궁금했던 것이
--user-agent=agent-string
등으로 user-agent를 속이는데 서버에서는 어떻게 인식하는지가 제일 궁금해서
http://browsers.garykeith.com/tools/your-browser.asp
에 접속해봤습니다.

 wget  --user-agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"  http://browsers.garykeith.com/tools/your-browser.asp
했더니 튕기더군요.
----------------------------------
Access Denied
You do not appear to be using this form in accordance with my Terms of Use.
Continued abuse will eventually result in you losing access to this server!
It's also possible you are using security software that modifies the HTTP_REFERER header.
If I can't confirm the referrer is valid then you can't have access to my forms.
--------------------------------

그래서 이번에는 --referer 옵션까지 설정을 해서 다시 시도해봤습니다.
wget  --user-agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"  --referer="http://browsers.garykeith.com/tools/property-docs.asp" http://browsers.garykeith.com/tools/your-browser.asp
이번에는 성공!!!
-------------------------------
Your Browser
User Agent
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
.... 이하 생략
--------------------------------

어찌보면 당연한 결론이지만  --user-agent, --referer 두가지다 제대로 작동합니다.

더 무서운것은 --save-cookie, --load-cookies,  --post-data=string, --post-file=file 입니다.

--save-cookie "cookie.txt" --post-data "user_id=myid&password=mypassword"
옵션을 주니까 멋있게 로그인까지 하고 쿠키를 저장해두더군요.

다시
 --load-cookies "cookie.txt" 하니까 회원만 가능한 곳 어디든지 정상접속됩니다.

post.dat라는 화일에 게시판에 필요한 변수를 입력해두고
 --load-cookies "cookie.txt"  --post-file "post.dat" 하니까 게시판에 글도 씁니다.

잘만 활용하면 좋겠는데
까딱하면 스팸로봇이 따로 필요없습니다.
2010/06/03 23:59 2010/06/03 23:59

Trackback Address :: https://youngsam.net/trackback/1215