Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Java bot, downloads files from CPP
- //edit the first two variables with your key and your path, read comments
- //Compile and run easily with Netbeans or whatever
- package downloader;
- import java.io.*;
- import java.net.*;
- public class Main {
- //set i to your starting key, number ends with L
- //set resultspath to your results folder, path ends with /
- static long i = 4750806412L;
- static String resultspath = "R:/pedesta/";
- static FileOutputStream fes;
- public static void daemon() throws MalformedURLException, FileNotFoundException, IOException {
- BufferedInputStream in = null;
- byte data[] = new byte[1024];
- String error = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Error><Code>NoSuchKey";
- int count = -1;
- int k = 0;
- for( ; i < 9999999999L; i++ ){
- System.out.println("now at "+i);
- try {
- in = new BufferedInputStream( new URL("http://www.cometpingpong.com/app/download/"+i+"/"+i+".txt").openStream() );
- count = in.read( data, 0, 1024 );
- }catch( java.io.FileNotFoundException fnfe ){
- //fnfe.printStackTrace();
- fes.write( (i+",Didn't get Bytes 404?").getBytes() );
- continue;
- }
- if( count == -1 ){
- System.out.println("404");
- fes.write( (i+",Didn't get Bytes 404?").getBytes() );
- continue;
- }else{
- String s = new String(data);
- if( s.equals(error)){
- System.out.println("error");
- //fes.write( (i+",Error page retrieved.").getBytes() );
- continue;
- }
- }
- System.out.println("********** HIT: "+i);
- fes.write( (i+",HIT").getBytes() );
- // if file doesnt exists, then create it
- File file = new File(resultspath+i+".txt");
- if (!file.exists()) {
- file.createNewFile();
- }
- FileOutputStream fos = new FileOutputStream(file.getAbsoluteFile());
- while( (count = in.read(data,0,1024)) != -1 ){
- fos.write(data, 0, count);
- }
- fos.flush();
- fos.close();
- }
- }
- public static void main(String[] args) {
- try {
- File errors = new File(resultspath+"errors.txt");
- fes = new FileOutputStream(errors);
- while( i < 4999999999L ){
- try {
- daemon();
- }catch( MalformedURLException mue ){
- mue.printStackTrace();
- fes.write( (i+",Malformed URL").getBytes() );
- }catch( IOException ioe ){
- ioe.printStackTrace();
- }
- try{
- Thread.sleep( 5000 );
- }catch( InterruptedException ie ){
- ie.printStackTrace();
- }
- }
- fes.flush();
- fes.close();
- }catch( IOException ioe ){
- ioe.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement