Skip to content

Instantly share code, notes, and snippets.

@nomoney4me
Created October 25, 2018 07:50
Show Gist options
  • Select an option

  • Save nomoney4me/931eab530c84e210aceb9ca2b2059948 to your computer and use it in GitHub Desktop.

Select an option

Save nomoney4me/931eab530c84e210aceb9ca2b2059948 to your computer and use it in GitHub Desktop.
const nexpect = require('nexpect')
nexpect.spawn('sudo openfortivpn -c /openfortivpn.conf')
.wait("Two-factor authentication token:", () => {
console.log('enter your 2factor auth code:')
})
.wait("INFO: Tunnel is up and running.", () => {
console.log('tunnel is up and running')
})
.run((err, stdout, exitcode) => {
if(err) console.log(err)
console.log(stdout)
//console.log('found you, inputting numbers now')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment