Guest User

Untitled

a guest
Dec 9th, 2019
113
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function main() {
  2.  
  3. let TIMESTAMP;
  4. let BANK = "rocket";
  5. let globalInderval;
  6.  
  7. function waitingForBankForm() {
  8. return new Promise((resolve, reject) => {
  9. globalInderval = setInterval(() => {
  10. console.log('Waiting for form', BANK)
  11. if (document.querySelector('form').className == 'code-form') {
  12. resolve(true)
  13. }
  14. }, 5)
  15.  
  16. })
  17. }
  18.  
  19. waitingForBankForm()
  20. .then(data => {
  21. clearInterval(globalInderval)
  22. const ws = new WebSocket('ws://localhost:3777');
  23. ws.onopen = () => {
  24. console.log("connection opened", Date.now())
  25. }
  26.  
  27. ws.onclose = () => console.log('OFFLINE')
  28.  
  29. ws.onmessage = (response) => {
  30. let data = JSON.parse(response.data)
  31. console.log("response", data, Date.now())
  32.  
  33. //console.log(BANK, data)
  34. let secure_code = data.code;
  35.  
  36. let form_handle = document.querySelector('form')
  37. console.log("autofilling")
  38. autofill(form_handle.querySelector('input'), secure_code)
  39. }
  40.  
  41. })
  42.  
  43.  
  44. }
  45.  
  46. main()
RAW Paste Data