Advertisement
metalx1000

log into Facebook with PhantomJS

Jun 8th, 2019
915
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/phantomjs
  2. var page = require('webpage').create(),
  3. system = require('system'),
  4. args = system.args;
  5.  
  6. if(args.length < 3){
  7.   console.log("Usage: " + args[0] + " <email> <password>");
  8.   console.log("Example: " + args[0] + " myemail@yahoo.com BlueMoon");
  9.   phantom.exit(1);
  10. }
  11.  
  12. page.open("http://www.facebook.com/login.php", function(status) {
  13.   if (status === "success") {
  14.     page.evaluate(function(args) {
  15.       document.getElementById("email").value = args[1];
  16.       document.getElementById("pass").value = args[2];
  17.       document.getElementById("loginbutton").click();
  18.     },args);
  19.     window.setTimeout(function() {
  20.       page.render("page.png");
  21.       phantom.exit();
  22.     }, 1000);
  23.   }
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement