Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. package com.skionz.spambot;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.File;
  5. import java.io.FileReader;
  6. import java.util.ArrayList;
  7. import java.util.List;
  8.  
  9. public class AttackHandler {
  10. private Attack currentAttack;
  11. private GUIHandler guiHandler;
  12. private Console console;
  13.  
  14. public AttackHandler(GUIHandler guiHandler) {
  15. this.guiHandler = guiHandler;
  16. this.console = this.guiHandler.getConsole();
  17. }
  18.  
  19. public boolean isCurrentAttack() {
  20. return (this.currentAttack != null) ? true : false;
  21. }
  22.  
  23. public Attack getCurrentAttack() {
  24. return this.currentAttack;
  25. }
  26.  
  27. public List<Account> getAccountList(File file) {
  28. List<Account> accounts = new ArrayList<Account>();
  29. try {
  30. BufferedReader reader = new BufferedReader(new FileReader(file));
  31. String line;
  32. while((line = reader.readLine()) != null) {
  33. String[] split = line.split(":");
  34. if(split.length == 2) {
  35. accounts.add(new Account(this.guiHandler, split[0], split[1]));
  36. }
  37. }
  38. reader.close();
  39. } catch(Exception e) {
  40. this.console.println(e.getMessage());
  41. }
  42. return accounts;
  43. }
  44.  
  45. public void startAttack() {
  46. if(this.currentAttack != null) {
  47. this.console.println("Stopping attack...");
  48. this.stopCurrentAttack();
  49. }
  50. this.console.println("Starting new attack...");
  51. if(this.guiHandler.isPortValid()) {
  52. Attack attack = new Attack(this.guiHandler, this.getAccountList(this.guiHandler.getAccountsFile()), this.guiHandler.getIp(), this.guiHandler.getPort(), this.guiHandler.getLoginDelay());
  53. attack.start();
  54. this.currentAttack = attack;
  55. }
  56. else {
  57. this.console.println("Invalid port");
  58. }
  59. }
  60.  
  61. public void stopCurrentAttack() {
  62. this.currentAttack.stop();
  63. this.currentAttack = null;
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement