Skip to content

Instantly share code, notes, and snippets.

@cybor97
Last active November 10, 2019 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cybor97/2e7e9c176c9134808cba525d7f4b5691 to your computer and use it in GitHub Desktop.
Save cybor97/2e7e9c176c9134808cba525d7f4b5691 to your computer and use it in GitHub Desktop.
#!/usr/bin/node
let axios = require('axios');
async function findENDLESSLY(token) {
while (true) {
await axios.post('https://chatous.com/api/enqueue', null, {
headers: {
Cookie: `connect.sid=${token};`
}
})
.then(resp => console.log(resp.data.return_code === 0 ? 'Queued' : resp.data.return_code === 1500 ? 'Waiting(on queue)' : `Unknown return_code ${resp.data}`))
.catch(err => console.error(err))
}
}
async function init(login, password) {
let resp = await axios.post('https://chatous.com/api/login',
`login=${login}&password=${password}`
, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
});
let token = resp.headers['set-cookie'].pop().split('connect.sid=').pop().split(';').shift();
findENDLESSLY(token);
}
init(process.argv[2], process.argv[3]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment