Skip to content

Instantly share code, notes, and snippets.

@haosdent
Created November 7, 2012 18:07
Show Gist options
  • Save haosdent/4033298 to your computer and use it in GitHub Desktop.
Save haosdent/4033298 to your computer and use it in GitHub Desktop.
Pass the auth of cude system auth.
#!/usr/bin/env sh
origin=`curl -i http://202.116.160.166 | egrep '(Cookie)|(VIEW)' --color`
session=`echo $origin | perl -n -e '/SessionId=(\S+);/ && print $1'`
viewstate=`echo $origin | perl -n -e '/value="(\S+)"/ && print $1'`
cookie="Cookie:ASP.NET_SessionId="$session
agent="User-Agent:python/gevent-http-client-1.0a"
curl -H $cookie http://202.116.160.166/CheckCode.aspx > /tmp/test.gif
echo "Type the checkcode by the image in /tmp/test.gif."
read checkcode
params="__VIEWSTATE="$viewstate"&TextBox1=201030720510&TextBox2=msnhaosdent&TextBox3="$checkcode"&RadioButtonList1=%D1%A7%C9%FA&Button1=&lbLanguage="
curl \
-H $cookie \
-H $agent \
-H "Referer: http://202.116.160.166/default2.aspx" \
-H "Content-Length: 177" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d $params http://202.116.160.166/default2.aspx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment