Saturday 7 September 2013

Using wget to download an ASP site

You can download an ASPX site, which asks for username/password for log in as follows:

First provide the username/password to the login page and save the cookie file.

wget --mirror -r \
--user-agent="" \
--keep-session-cookies --save-cookies cookies.txt \
--post-data '__VIEWSTATE=%2FwEPDwULLTE3MDc5MjQzOTdkZIP%2Fxc105yfz2jGFj4Nd3tPvrEeNara43fIRI5oAW%2Bwv&__EVENTVALIDATION=%2FwEWBAKisoyCAwLB2tiHDgK1qbSRCwL2k8O9DUQa5owMFDWzFnBoIDusNkznjB65a6zRyNETOEZfBM1o&txtUser=admin&txtPassword=admin&login_btn=Sign+In' \
-E -k -p http://www.xyz.com/Login.aspx

Then you can access other pages in the next step using the above generated cookie files.

wget --mirror -r \
--user-agent="" \
--keep-session-cookies --load-cookies cookies.txt \
-E -k -p http://www.xyz.com/Index.aspx

For details of the options, refer to the WGET manual i.e "man wget" :)

No comments:

Post a Comment