Jheimys

Desafio code for all

Apr 6th, 2024
2,234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // import all the hacking tools and list of accounts purchased on the black market
  2. var terminal = require('terminal');                                             // login, logout, printFile, getPassword, ....
  3. var toolkit = require('hacker-toolkit');                                        
  4. var accounts = require('blackmarket-accounts');
  5.  
  6. //console.log(accounts);
  7. //console.log(terminal)
  8. //console.log(toolkit)
  9.  
  10. //-------  Variáveis --------------------
  11. var rootPassword  = ''
  12.  
  13.  
  14.  
  15. //---------- Percorre o array e decodifica as senhas -----
  16. var accountsList = accounts.map(item => (
  17.     {
  18.         "username": item.split(':')[0],
  19.         'password':  toolkit.rot13(item.split(':')[1])
  20.        
  21.     })
  22. )
  23.  
  24. //console.log(accountsList)
  25.  
  26.  
  27. //-------- Function brute-force --------------------
  28.  
  29. // bruteForce function needs a terminal to hack, a list of accounts,
  30. // and a function to invoke when the it finds a valid account
  31. // the function will be invoked with a valid username and password as arguments
  32.  
  33. // the list of accounts should be an array of account objects
  34. // an account object is composed by a username and password property e.g:
  35. // var account = {
  36. //    username: 'mr',
  37. //    password: 'robot'
  38. // };
  39.  
  40. toolkit.bruteForce(terminal, accountsList, function(username, password) {
  41.     //console.log('Oi eu sou a função que encontra o valor válido?',username, password);
  42.    
  43.     // login as a user
  44.     var success = terminal.login(username, password);
  45.     //console.log('SUCCESS ===>', success)
  46.    
  47.     if(success){
  48.         // toolkit's spy function will watch the selected user
  49.         // every time the user makes an action,
  50.         // the third argument will be invoked with a description of the action as the argument
  51.         // maybe the root user will do something useful for you to take advantage..
  52.        
  53.         toolkit.spy(terminal, 'root', (action) => {
  54.             console.log('ACTION ==>', action)
  55.            
  56.             if(action.includes('password')){
  57.                 rootPassword = action.split(' ')[action.split(' ').length - 1]
  58.                 //console.log(rootPassword)
  59.                
  60.                 terminal.logout()
  61.                 terminal.login('root', rootPassword)
  62.                 terminal.printFile('/var/logs/ecorp.txt');
  63.             }
  64.         });
  65.     }
  66.    
  67.    
  68.    
  69. });
  70.  
Advertisement
Add Comment
Please, Sign In to add comment