Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package driving;
- import java.io.BufferedWriter;
- import java.io.FileWriter;
- import java.util.LinkedList;
- import java.util.Queue;
- import scripts.accountpumper.AccountRequest;
- import scripts.accountpumper.FCProxy;
- import utils.Utils;
- public class Main
- {
- //constants
- public final static AccountCreatorGUI GUI = new AccountCreatorGUI();
- private final static String OUTPUT_FILE = System.getProperty("user.dir") + "/fcaccounts.txt";
- private final static Queue<FCProxy> PROXIES = new LinkedList<>();
- private final static int MIN_PASS_LENGTH = 6;
- //variables
- public static boolean isRunning = true;
- public static boolean isWaitingForGUI = true;
- public static String accessUser;
- public static String accessPin;
- public static String customPassword = null;
- private static int accountsCreated;
- private static long startTime = -1;
- private static AccountRequest request;
- public static void main(String[] args)
- {
- GUI.setVisible(true);
- while(isRunning)
- {
- try
- {
- mainLogic();
- Thread.sleep(100);
- }
- catch(Exception e)
- {
- e.printStackTrace();
- }
- }
- if(request != null)
- request.closeResources();
- }
- private static void mainLogic() throws InterruptedException
- {
- if(!isWaitingForGUI)
- {
- if(startTime == -1)
- startTime = System.currentTimeMillis();
- makeAccounts();
- updateStatusFrame();
- }
- }
- private static void makeAccounts() throws InterruptedException
- {
- FCProxy proxy = null;
- if(!PROXIES.isEmpty())
- {
- proxy = PROXIES.poll();
- PROXIES.add(proxy);
- System.out.println("Using proxy: " + proxy.getHost() + ":" + proxy.getPort());
- }
- String custom = customPassword != null && customPassword.length() >= MIN_PASS_LENGTH ? customPassword : null;
- request = new AccountRequest(accessUser, accessPin, proxy, custom);
- if(request.request())
- {
- recordAccount(request);
- accountsCreated++;
- }
- else
- {
- System.out.println("Sleeping 10 seconds before trying again...");
- Thread.sleep(10000);
- }
- }
- private static void recordAccount(AccountRequest request)
- {
- System.out.println(request.accountInfo.username);
- System.out.println(request.accountInfo.password);
- System.out.println("Proxy used: " + request.accountInfo.proxy);
- try(FileWriter fW = new FileWriter(OUTPUT_FILE, true);
- BufferedWriter bW = new BufferedWriter(fW))
- {
- bW.newLine();
- bW.write(request.accountInfo.username + ":" + request.accountInfo.password + ":" + request.accountInfo.proxy);
- }
- catch(Exception e)
- {
- e.printStackTrace();
- System.out.println("There was an error writing the account to the output file!");
- }
- }
- private static void updateStatusFrame()
- {
- GUI.updateAccountsCreated(accountsCreated);
- GUI.updateAccountsPerHour(calculateAccountsPerHour());
- }
- private static long calculateAccountsPerHour()
- {
- //return the projected amount per hour
- return Math.round(accountsCreated / (Utils.timeFromMark(startTime) / 3600000.0));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement