AdminPageScanner.txt

(1 KB) Pobierz
/**
 * Simple admin page scanner. Returns path if there are [200,403,302,401]
 * Author: Ataman
 * Greetz to all RW members.
 * Special thanks to: CrosS, s3rver.exe, satsura, Xenu, Invectus, Dark-X, Versus71 !
 * 
 * Usage:
 * 
 * Place some dictionary file in the same folder where you will execute
 * this program.
 * 
 * Then:
 * java adminScanner http://www.site.com dictionary.txt
 * 
 * P.S. If you remove this comment, u are dumbass.
 */
 import java.net.*;
 import java.io.*;
 import java.util.*;

public class adminScanner
{
	/**
	 * args0 - host
	 * args1 - dictionary file (line by line);
	 */
	public static void main(String[] args) throws IOException
	{	
		// Making an options array:
		String[] opt_array = adminScanner.getDictionaryData(args[1]);
		
		for(int i = 0; i < opt_array.length; i++)
		{		
			URL host_url = new URL(args[0] + opt_array[i]);
			HttpURLConnection connection = (HttpURLConnection)host_url.openConnection();
			connection.setRequestMethod("GET");
			connection.connect();
			
			int code = connection.getResponseCode();
			
			switch(code)
			{
				case 200:
				case 302:
				case 401:
				case 403:
					System.out.println(host_url+":\tstatus "+code);
					continue;
				default:
					continue;
			}
		}
	}
	
	public static String[] getDictionaryData(String file) throws IOException
	{
		FileReader freader = new FileReader(file);
		BufferedReader breader = new BufferedReader(freader);
		List<String> list = new ArrayList<String>();
		
		String line = null;
		
		while((line = breader.readLine()) != null)
			list.add(line);
		
		breader.close();
		
		return list.toArray(new String[list.size()]);
	}
}
Zgłoś jeśli naruszono regulamin