0

I'm using PhantomJS + CasperJS to do some headless web scraping. My application requires the user's login credentials, including an email and password.

Currently, I'm getting the user's password in the following manner:

system = require('system')
casper = require('casper').create()

casper.start('http://url...');

casper.then(function() {
  this.echo('Password?');
  var password = system.stdin.readLine();

  this.fillSelectors('form', {
    'input#Passwd': password
  });
});

This works and does retrieve user input, but it also leaves the user's password exposed on the screen. I need something that lets the user type, lets the application read what the user typed, but without the user's typed text appearing on the screen. Something like the password input when you do sudo some_command. Is there any functionality in Node or PhantomJS that allows this?

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
geoff
  • 2,251
  • 1
  • 19
  • 34
  • I will achieve that by 4 steps: 1. Write a HTML page to collect password(or any necessary information from user input). 2. store the password into database. 3. Implement a rest API for getting password. 4. CasperJS call that rest API instead of input by stdin... Or 2 steps: 1. Get password by HTML input 2. call CasperJS by server side script(PHP or NodeJS) passing password by input arguments... – Sayakiss Sep 09 '16 at 12:22
  • You can certainly call some other program/script which provides you with the option of hiding the input and pass that back to PhantomJS/CasperJS. – Artjom B. Sep 09 '16 at 17:36

0 Answers0