Advertisement
Guest User

Untitled

a guest
Jun 13th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4. <p id="demo"></p>
  5.  
  6. <script>
  7.  
  8. const http = new XMLHttpRequest();
  9. var response;
  10. const url = 'http://page/';
  11. http.open('get', url, false);
  12. //Send the proper header information along with the request
  13. http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  14.  
  15.   http.onreadystatechange = function ()
  16.     {
  17.         if(http.readyState === 4)
  18.         {
  19.             if(http.status === 200 || http.status == 0)
  20.             {
  21.                 let str = (http.responseText);
  22.                 let pattern =/\bgetObj\("Frm_Logintoken"\)\.value = "([^"]+)";/;
  23.                 let results = str.match(pattern)[1];
  24.                 alert(results)
  25.                 response = results;
  26.  
  27.             }
  28.            
  29.         }
  30.     }
  31.    
  32. http.send();
  33.      
  34. var test;
  35. setTimeout(function(){
  36.    
  37. const http1 = new XMLHttpRequest();
  38. var params1 = 'frashnum=&action=login&Frm_Logintoken='+response+'&Username=admin&Password=test';
  39. const url1 = 'http://page/';
  40. http1.open('post', url, false);
  41. //Send the proper header information along with the request
  42. http1.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  43. test = params1;
  44. http1.send(test);
  45. alert(test)
  46. }, 1000);
  47.  
  48. </script>
  49. </body>
  50. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement