Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.skionz.spambot;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileReader;
- import java.util.ArrayList;
- import java.util.List;
- public class AttackHandler {
- private Attack currentAttack;
- private GUIHandler guiHandler;
- private Console console;
- public AttackHandler(GUIHandler guiHandler) {
- this.guiHandler = guiHandler;
- this.console = this.guiHandler.getConsole();
- }
- public boolean isCurrentAttack() {
- return (this.currentAttack != null) ? true : false;
- }
- public Attack getCurrentAttack() {
- return this.currentAttack;
- }
- public List<Account> getAccountList(File file) {
- List<Account> accounts = new ArrayList<Account>();
- try {
- BufferedReader reader = new BufferedReader(new FileReader(file));
- String line;
- while((line = reader.readLine()) != null) {
- String[] split = line.split(":");
- if(split.length == 2) {
- accounts.add(new Account(this.guiHandler, split[0], split[1]));
- }
- }
- reader.close();
- } catch(Exception e) {
- this.console.println(e.getMessage());
- }
- return accounts;
- }
- public void startAttack() {
- if(this.currentAttack != null) {
- this.console.println("Stopping attack...");
- this.stopCurrentAttack();
- }
- this.console.println("Starting new attack...");
- if(this.guiHandler.isPortValid()) {
- Attack attack = new Attack(this.guiHandler, this.getAccountList(this.guiHandler.getAccountsFile()), this.guiHandler.getIp(), this.guiHandler.getPort(), this.guiHandler.getLoginDelay());
- attack.start();
- this.currentAttack = attack;
- }
- else {
- this.console.println("Invalid port");
- }
- }
- public void stopCurrentAttack() {
- this.currentAttack.stop();
- this.currentAttack = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement