Skip to content

Instantly share code, notes, and snippets.

Last active August 7, 2021 09:08
Show Gist options
  • Save Arinerron/53b48d1e6d99f2720a7e300d3e2bc447 to your computer and use it in GitHub Desktop.
Save Arinerron/53b48d1e6d99f2720a7e300d3e2bc447 to your computer and use it in GitHub Desktop.
Scrape BTC accounts and their balance. If you see one that isn't 0.0, go to the first URL that it prints somewhere above the BTC account, and you can get the private key for that account from the page.
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) throws Exception {
for(long i = 0; i < Long.MAX_VALUE; i++) {
System.out.println("\n[ " + "" + i + " ]");
for(String s : getBTC(i))
System.out.println(s + " has " + getBalance(s));
public static List<String> getBTC(long index) throws Exception {List<String> list = new ArrayList<>();for(String s : getText("" + index).split(Pattern.quote("")))if(!s.endsWith("</span> <a href=\"") && !s.endsWith("</html>"))list.add(s.split(Pattern.quote("\">"))[0]);List<String> list2 = new ArrayList<>();for(String s : list)if(s.length() == 33)list2.add(s + " ");else list2.add(s);list = null;return list2;}
public static double getBalance(String address) throws Exception {return Double.parseDouble(getText("" + address).split(Pattern.quote("<td id=\"final_balance\"><font color=\"green\"><span data-c=\""))[1].split(Pattern.quote("\""))[0]);}
public static String getText(String url) throws Exception {System.setProperty("http.agent", "");URLConnection connection = new URL(url).openConnection();connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv: Gecko/20100316 Firefox/3.6.2");BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));StringBuilder response = new StringBuilder();String inputLine;while ((inputLine = in.readLine()) != null)response.append(inputLine);in.close();return response.toString();}
Copy link

quinnoaj commented Nov 7, 2017

Hello, I tried to compile the code online and I get the following errors:
[ ] Exception in thread "main" at at at at at at at at<init>( at at at at at at at at at Main.getText( at Main.getBTC( at Main.main( exited with non-zero status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment