开发者

Logging into vbullentin using curl . Need some javascript work

EDIT: solved. I missed a '&'. Trying to log into http://www.t开发者_StackOverflowechenclave.com/forums/ using curl. This is the form:

 <form  action="http://www.techenclave.com/login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
  <input type="text" class="form-field" name="vb_login_username" accesskey="u" tabindex="101" value="User Name" onfocus="if(this.value == 'User Name') {this.value = '';}" onblur="if (this.value == '') {this.value = 'User Name';}" /> 
<More inpUT FIELDS HEre>
.
.
.
<input type="hidden" name="vb_login_md5password_utf" /> </form>

I got this so far:

$ref = "http://www.techenclave.com" ;

       define("WEBBOT_NAME", "Mozilla/5.0 (Windows; U; Windows NT
5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1");
        define("CURL_TIMEOUT", 25);

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "http://www.techenclave.com/login.php?do=login") ;       // Target site
        curl_setopt ($ch, CURLOPT_COOKIEFILE, "C:/cookie-techenclave.txt");         

        curl_setopt($ch, CURLOPT_COOKIEJAR, "C:/cookie-techenclave.txt");
        curl_setopt($ch, CURLOPT_REFERER, $ref);  
        curl_setopt($ch, CURLOPT_TIMEOUT, CURL_TIMEOUT);    // Timeout
        curl_setopt($ch, CURLOPT_USERAGENT, WEBBOT_NAME); 
        curl_setopt ($ch, CURLOPT_POST, 1);
        curl_setopt ($ch, CURLOPT_POSTFIELDS, "vb_login_username=cute.bandar&vb_login_password=".md5("mypass)"
                      ."securitytoken=guest&cookieuser=1&do=login&vb_login_md5password=&vb_login_md5password_utf=");

        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);     // Follow redirects
        curl_setopt($ch, CURLOPT_MAXREDIRS, 4);             // Limit redirections to four
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);     // Return in string  

        $webpage['FILE'] = curl_exec($ch);
        curl_close($ch);
        echo $webpage['FILE'] ;

This doesn't work. Wrong username/password error. MY password is fine, me thinks the problem iscaused by this piece of javascript:

 onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)

Definition of md5hash from the javascript file:

function md5hash(B,A,E,C){
if(navigator.userAgent.indexOf("Mozilla/")==0&&parseInt(navigator.appVersion)>=4){
var D=hex_md5(str_to_ent(trim(B.value)));
A.value=D;if(E){D=hex_md5(trim(B.value));
E.value=D
} if(!C){B.value=""}}return true};

So basically the function md5hash is setting 3/4 vars before they are posted. Do I have to emulate this function is php ? Or is there some other thing that I am over looking ?

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜