Commit 9bbe7d3a authored by Felix Bilstein's avatar Felix Bilstein

backup - nothing works currently, wait for like 30 fixes. captchas are

cruel.
parent e44ec54a
......@@ -6,6 +6,12 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
......
......@@ -23,10 +23,10 @@ import SelectModus.Automatik.AutoConfig;
public class ConnectHTTP {
public static String URLContent(String url, final AutoConfig.ProxyPerEngine proxyConfig) throws IOException {
URLConnection page;// = new URL(url);
URLConnection page; // = new URL(url);
Authenticator authenticator;
Proxy p;
if(proxyConfig.isActivated()) {
if(proxyConfig != null && proxyConfig.isActivated()) {
if(proxyConfig.getUser() != null && !proxyConfig.getUser().isEmpty() && proxyConfig.getPass() != null && !proxyConfig.getPass().isEmpty()) {
authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
......@@ -74,7 +74,7 @@ public class ConnectHTTP {
Authenticator authenticator;
Proxy p;
if(proxyConfig.isActivated()) {
if(proxyConfig != null && proxyConfig.isActivated()) {
if(proxyConfig.getUser() != null && !proxyConfig.getUser().isEmpty() && proxyConfig.getPass() != null && !proxyConfig.getPass().isEmpty()) {
authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
......
......@@ -12,6 +12,16 @@ import java.util.Scanner;
import java.util.Vector;
public class StringEngine {
public static String fixAmpersand(String in) {
String amp = "&amp;";
while(in.contains(amp)) {
int firstChar = in.indexOf(amp);
in = in.substring(0, firstChar) + "&" + in.substring(firstChar + amp.length(), in.length());
}
return in;
}
public static Vector<String> removeDuplicates(Vector<String> D) {
HashSet<String> set = new HashSet<String>();
for(int i=0;i<D.size();i++) {
......
......@@ -26,10 +26,6 @@ public class Main {
*
*/
public static void main(String[] args) {
System.setProperty("socksProxyHost", "127.0.0.1");
System.setProperty("socksProxyPort", "9050");
Arguments A = new Parser().parseIt(args);
if(A == null) {
System.out.println("[ERROR] Error while parsing your Arguments. See --help flag.");
......@@ -110,7 +106,10 @@ public class Main {
}
if(A.output.isEmpty()) {
System.out.println("[WARNING] You have to set an output directory, we set it to your home directory now.");
A.output = System.getProperty("user.home");
A.output = System.getProperty("user.home")
+ System.getProperty("file.separator")
+ "search-and-destroy-multidork_"
+ new Core.Utils.date().getDateAndTime();
}
if(A.inFile.isEmpty()) {
System.out.println("[WARNING] You have decided to not clean your Results with an inFile.");
......@@ -124,9 +123,6 @@ public class Main {
System.out.println("[STATUS] Shutting Search and Destroy down now.");
return;
}
/*
* ToDo: MultiDork mit A.output als fifth argument verwenden.
*/
new MultiDork(A.engine, A.dorkFile,A.inFile, A.outFile, A.rpd, A.threads, A.output).doJob();
}
if(A.install == true) {
......
......@@ -93,7 +93,7 @@ public class Parser {
if(args.length > i+1) {
A.inFile = args[i+1];
} else {
System.out.println("[ERROR] You have to select a inFile after --inFile String!");
System.out.println("[ERROR] You have to select an inFile after --inFile String!");
return null;
}
}
......@@ -101,7 +101,7 @@ public class Parser {
if(args.length > i+1) {
A.outFile = args[i+1];
} else {
System.out.println("[ERROR] You have to select a outFile after --outFile String!");
System.out.println("[ERROR] You have to select an outFile after --outFile String!");
return null;
}
}
......
......@@ -13,12 +13,14 @@ public class Print {
" --auto Automatikk Mode \n" +
" --generate Generator Mode \n" +
" --singledork 'inurl:example.txt' Use a single dork for search \n" +
" --multidork '/home/evilguy/dorks.txt' Use a file \n" +
" --multidork '/home/user/dorks.txt' Use a file \n" +
" --threads 16 How many threads to use (only in --multidork usable) \n" +
" --engine B Select B for Bing, I=Ixquick, G=Google, S=Startpage (only --singledork or --multidork)\n" +
" --output '/home/evilguy' Folder for output \n" +
" --inFile '/home/user/inFile.txt' Select a file containing line-by-line strings that have to be in every result url \n" +
" --outFile '/home/user/outFile.txt' Select a file containing line-by-line strings that musn't be in every result url \n" +
" --output '/home/user/output.txt' Folder for output \n" +
" --rpd 100 results per dork from engine \n" +
" --timeout 30 timeout in seconds \n" +
// " --timeout 30 timeout in seconds \n" +
// " --verbosity 0-3 verbosity level. 1 is default \n" +
" --gui Not implemented yet! \n");
}
......
......@@ -13,17 +13,28 @@ import SelectModus.Automatik.AutoConfig;
public class Bing extends SearchEngine {
public Bing(Vector<String> DORKS, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, Vector<String> RESULT_MEMORY) {
super(DORKS, ID, PROGRESS, proxy, RESULTS_PER_DORK, RESULT_MEMORY);
final String captcha = "";
public Bing(Vector<String> DORKS, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, int SLEEP, Vector<String> RESULT_MEMORY) {
super(DORKS, ID, PROGRESS, proxy, RESULTS_PER_DORK, SLEEP, RESULT_MEMORY);
}
/*
These vars you can find in SearchEngine.
search is a method from SearchEngine.
*/
/* Backup! before doing crazy new solution
void search(boolean https, String URL, int NR, String keystring, int var, String endstring, AutoConfig.ProxyPerEngine proxy) throws IOException {
StringBuilder HTML = new StringBuilder();
//100 current default (has to become variable, no const), so we search 0,10,20,...,80,90
/*
* Wrong. Fast, but wrong. Use:
* for-loop
* HTML-Append
* while-loop
* count->if while loop finds less than 10 hits, break after HTML-Append section out of for loop.
* Maybe print dork and count for debug purposes, later we can improve this by writing it into db file
*
for(int i=0;i<NR;i=i+10) {
if (https == true) HTML.append(HTTPSURLContent(URL + i, proxy));
if (https == false) HTML.append(URLContent(URL + i, proxy));
......@@ -37,18 +48,70 @@ public class Bing extends SearchEngine {
while(h.indexOf(keystring, pos)>-1) {
int start = h.indexOf(keystring, pos)+keystring.length()-var;
int ende = h.indexOf(endstring, start)-0;
System.out.println("Start: " + start + " End: " + ende);
//System.out.println("Start: " + start + " End: " + ende);
String result = java.net.URLDecoder.decode(h.substring(start,ende), "UTF-8");
System.out.println("Result: " + result);
//System.out.println("Result: " + result);
RESULT_VECTOR.add(result);
pos=ende;
}
//System.out.println("[DEBUG] URL: " + URL);
HTML = null;
}
*/
/*
void search(boolean https, String URL, int NR, String keystring, int var, String endstring, AutoConfig.ProxyPerEngine proxy) throws IOException {
final int resultsOnOnePage = 10;
//100 current default (has to become variable, no const), so we search 0,10,20,...,80,90
/*
* Wrong. Fast, but wrong. Use:
* for-loop
* HTML-Append
* while-loop
* count->if while loop finds less than 10 hits, break after HTML-Append section out of for loop.
* Maybe print dork and count for debug purposes, later we can improve this by writing it into db file
*
int i=0;
while(i<NR) {
System.out.println("[THREAD: " + super.ID +"] We are in: " + i);
int counter = 0;
StringBuilder HTML = new StringBuilder();
if (https == true) {
HTML.append(HTTPSURLContent(URL + i, proxy));
} else {
HTML.append(URLContent(URL + i, proxy));
}
int pos = 0;
String h = HTML.toString();
//System.out.println("BEGIN: String h: " + h);
//DEBUG
//Core.Utils.FileOperations.WriteStringToFile(h, "/home/fxb/search_and_destroy/debug-ausgabe.txt");
while(h.indexOf(keystring, pos)>-1) {
int start = h.indexOf(keystring, pos)+keystring.length()-var;
int ende = h.indexOf(endstring, start)-0;
//System.out.println("Start: " + start + " End: " + ende);
String result = java.net.URLDecoder.decode(h.substring(start,ende), "UTF-8");
result = Core.Utils.StringEngine.fixAmpersand(result);
//result = Core.Utils.StringEngine.fixAmpersand(result);
//System.out.println("Result: " + result);
RESULT_VECTOR.add(result);
counter++;
pos=ende;
}
i=i+resultsOnOnePage;
if(counter < resultsOnOnePage) {
System.out.println("[THREAD: " + super.ID +"] DEBUG: We had only "
+ counter + " Elements on this site, not all " + resultsOnOnePage + "!");
System.out.println("[THREAD: " + super.ID + "] DEBUG: url was: " + URL);
break;
}
//System.out.println("[DEBUG] URL: " + URL);
}
}*/
public void fetchResults(int NR, String DORK, AutoConfig.ProxyPerEngine proxy) throws IOException, URISyntaxException {
search(false, "http://www.bing.com/search?q=" + DORK + "&first=", NR, "href=\"http",4, "\"", proxy);
search(false, "http://www.bing.com/search?q=" + DORK + "&first=", NR, "href=\"http",4, "\"", proxy, captcha);
}
/*
Here we crawl an url to get some results. see search for more information.
......
......@@ -13,8 +13,8 @@ import SelectModus.Automatik.AutoConfig;
public class Google extends SearchEngine {
public Google(Vector<String> cuttedDorks, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, Vector<String> RESULT_MEMORY) {
super(cuttedDorks, ID, PROGRESS, proxy, RESULTS_PER_DORK, RESULT_MEMORY);
public Google(Vector<String> cuttedDorks, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, int SLEEP, Vector<String> RESULT_MEMORY) {
super(cuttedDorks, ID, PROGRESS, proxy, RESULTS_PER_DORK, SLEEP, RESULT_MEMORY);
}
/*
These vars you can find in SearchEngine.
......
......@@ -13,14 +13,17 @@ import SelectModus.Automatik.AutoConfig;
public class Ixquick extends SearchEngine {
public Ixquick(Vector<String> DORKS, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, Vector<String> RESULT_MEMORY) {
super(DORKS, ID, PROGRESS, proxy, RESULTS_PER_DORK, RESULT_MEMORY);
public Ixquick(Vector<String> DORKS, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, int SLEEP, Vector<String> RESULT_MEMORY) {
super(DORKS, ID, PROGRESS, proxy, RESULTS_PER_DORK, SLEEP, RESULT_MEMORY);
}
final String captcha = "Completing the CAPTCHA below helps us reduce";
/*
These vars you can find in SearchEngine.
search is a method from SearchEngine.
*/
/*
void search(boolean https, String URL, int NR, String keystring, int var, String endstring, AutoConfig.ProxyPerEngine proxy) throws IOException {
StringBuilder HTML = new StringBuilder();
//100 current default (has to become variable, no const), so we search 0,10,20,...,80,90
......@@ -46,9 +49,9 @@ public class Ixquick extends SearchEngine {
//System.out.println("[DEBUG] URL: " + URL);
HTML = null;
}
*/
public void fetchResults(int NR, String DORK, AutoConfig.ProxyPerEngine proxy) throws IOException, URISyntaxException {
search(true, "https://ixquick.com/do/search?q=" + DORK + "&startat=", NR, "<h3><a href='", 0, "'", proxy);
search(true, "https://ixquick.com/do/search?q=" + DORK + "&startat=", NR, "<h3><a href='", 0, "'", proxy, captcha);
}
/*
Here we crawl an url to get some results. see search for more information.
......
......@@ -8,12 +8,15 @@ SingeDork: You only use fetchResults from every subclass and search is used in t
package SearchEngine;
import static Core.Utils.ConnectHTTP.HTTPSURLContent;
import static Core.Utils.ConnectHTTP.URLContent;
import java.io.IOException;
import java.util.Vector;
import SelectModus.Automatik.AutoConfig;
public abstract class SearchEngine implements Runnable {
SearchEngine(Vector<String> DORKS, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, Vector<String> RESULT_VECTOR) {
SearchEngine(Vector<String> DORKS, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, int sleep, Vector<String> RESULT_VECTOR) {
this.DORKS = DORKS;
this.ID = ID;
this.PROGRESS = PROGRESS;
......@@ -71,7 +74,61 @@ public abstract class SearchEngine implements Runnable {
HTML = null;
}*/
void search(boolean https, String URL, int NR, String keystring, int var, String endstring, AutoConfig.ProxyPerEngine proxy, String captcha) throws IOException {
final int resultsOnOnePage = 10;
//100 current default (has to become variable, no const), so we search 0,10,20,...,80,90
/*
* Wrong. Fast, but wrong. Use:
* for-loop
* HTML-Append
* while-loop
* count->if while loop finds less than 10 hits, break after HTML-Append section out of for loop.
* Maybe print dork and count for debug purposes, later we can improve this by writing it into db file
*/
int i=0;
while(i<NR) {
System.out.println("[THREAD: " + ID +"] We are in: " + i);
int counter = 0;
StringBuilder HTML = new StringBuilder();
if (https == true) {
HTML.append(HTTPSURLContent(URL + i, proxy));
} else {
HTML.append(URLContent(URL + i, proxy));
}
System.out.println("[DEBUG] URL: " + URL + i);
i=i+resultsOnOnePage;
int pos = 0;
String h = HTML.toString();
if(h.contains(captcha)) {
System.out.println("[THREAD: " + ID + "] Captcha!");
break;
}
//System.out.println("BEGIN: String h: " + h);
//DEBUG
Core.Utils.FileOperations.WriteStringToFile(h, "/home/fxb/search_and_destroy/debug-ausgabe.txt");
while(h.indexOf(keystring, pos)>-1) {
int start = h.indexOf(keystring, pos)+keystring.length()-var;
int ende = h.indexOf(endstring, start)-0;
System.out.println("Start: " + start + " End: " + ende);
String result = java.net.URLDecoder.decode(h.substring(start,ende), "UTF-8");
result = Core.Utils.StringEngine.fixAmpersand(result);
//result = Core.Utils.StringEngine.fixAmpersand(result);
System.out.println("Result: " + result);
RESULT_VECTOR.add(result);
counter++;
pos=ende;
}
if(counter < resultsOnOnePage) {
System.out.println("[THREAD: " + ID +"] DEBUG: We had only "
+ counter + " Elements on this site, not all " + resultsOnOnePage + "!");
System.out.println("[THREAD: " + ID + "] DEBUG: url was: " + URL);
break;
}
}
}
/*
......
......@@ -13,14 +13,17 @@ import SelectModus.Automatik.AutoConfig;
public class Startpage extends SearchEngine {
public Startpage(Vector<String> DORKS, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, Vector<String> RESULT_MEMORY) {
super(DORKS, ID, PROGRESS, proxy, RESULTS_PER_DORK, RESULT_MEMORY);
//final String captcha = "As part of StartPage's ongoing mission to provide the best experience for our users, we occasionally need to confirm that you are a legitimate user. Completing the CAPTCHA below helps us reduce abuse and improve the quality of our services.";
final String captcha = "Completing the CAPTCHA below helps us reduce";
public Startpage(Vector<String> DORKS, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, int SLEEP, Vector<String> RESULT_MEMORY) {
super(DORKS, ID, PROGRESS, proxy, RESULTS_PER_DORK, SLEEP, RESULT_MEMORY);
}
/*
These vars you can find in SearchEngine.
search is a method from SearchEngine.
*/
/*
void search(boolean https, String URL, int NR, String keystring, int var, String endstring, AutoConfig.ProxyPerEngine proxy) throws IOException {
StringBuilder HTML = new StringBuilder();
//100 current default (has to become variable, no const), so we search 0,10,20,...,80,90
......@@ -46,21 +49,23 @@ public class Startpage extends SearchEngine {
//System.out.println("[DEBUG] URL: " + URL);
HTML = null;
}
String makeQID() throws IOException {
*/
String makeQID(String dork) throws IOException {
String qid = null;
String location = "<input type=\"hidden\" name=\"qid\" value=\"";
StringBuilder HTML = new StringBuilder();
HTML.append(HTTPSURLContent("https://startpage.com/do/search?cmd=process_search&language=english&rcount=&rl=NONE&abp=-1&query=default&cat=web&engine0=v1all&startat=10", proxy));
HTML.append(HTTPSURLContent("https://startpage.com/do/search?cmd=process_search&language=english&rcount=&rl=NONE&abp=-1&query=" + dork + "&cat=web&engine0=v1all&startat=0", proxy));
qid = HTML.substring(HTML.toString().indexOf(location)+location.length(), HTML.toString().indexOf(location)+12+location.length());
return qid;
}
public void fetchResults(int NR, String DORK, AutoConfig.ProxyPerEngine proxy) throws IOException, URISyntaxException {
String QID = makeQID();
String QID = makeQID(DORK);
String url = "https://startpage.com/do/search?cmd=process_search&language=english&qid=" + QID +
"&rcount=&rl=NONE&abp=-1&query=" + DORK + "&cat=web&engine0=v1all&startat=";
search(true, url, NR, "<h3><a href='", 0, "'", proxy);
//search(true, url, NR, "<h3><a href='", 0, "'", proxy);
//Update
search(true, url, NR, "<h3 class='clk'><a href='", 0, "'", proxy, captcha);
}
/*
fetchResults crafts a special url, with a new generated startpage id.
......
......@@ -18,7 +18,7 @@ public class AutoConfig {
private String host = new String();
private Integer port;
private boolean socks;
private boolean activated;
private boolean activated = false;
public boolean isSocks() {
......
......@@ -18,7 +18,7 @@ public class GenerateSimpleDorks {
else if (Engine.equalsIgnoreCase("Ixquick")) {
current = getSimpleIxquickDork(current);
}
else if (Engine.equalsIgnoreCase("startpage")) {
else if (Engine.equalsIgnoreCase("Startpage")) {
current = getSimpleStartpageDork(current);
}
else return null;
......@@ -37,18 +37,36 @@ public class GenerateSimpleDorks {
}
public static String getSimpleBingDork(String dork) {
if(dork.charAt(dork.length()-1) == '=') {
StringBuilder tmp = new StringBuilder();
tmp.append(dork);
tmp.deleteCharAt(tmp.length()-1);
dork = tmp.toString();
}
String ext = filetype(dork);
if(ext != null) return "inanchor:" + dork + "+ext:" + ext;
else return "inanchor:" + dork;
}
public static String getSimpleIxquickDork(String dork) {
if(dork.charAt(dork.length()-1) == '=') {
StringBuilder tmp = new StringBuilder();
tmp.append(dork);
tmp.deleteCharAt(tmp.length()-1);
dork = tmp.toString();
}
return "'" + dork + "'";
}
public static String getSimpleStartpageDork(String dork) {
if(dork.charAt(dork.length()-1) == '=') {
StringBuilder tmp = new StringBuilder();
tmp.append(dork);
tmp.deleteCharAt(tmp.length()-1);
dork = tmp.toString();
}
String ext = filetype(dork);
if(ext != null) return "inurl:" + dork + "+filetype:" + ext;
if(ext != null) return "inurl:" + dork + " filetype:" + ext;
else return "inurl:" + dork;
}
......
......@@ -10,7 +10,7 @@ import java.util.Vector;
public class Generator {
Vector<String> OUT = new Vector<String>();
Vector<String> out = new Vector<String>();
public void doJob() {
try {
......@@ -46,9 +46,9 @@ public class Generator {
chosen = false;
}
}
Vector<String> IN = Core.Utils.FileOperations.ReadInDorkFile(templatefile);
OUT = generateSimpleDorks(engine, IN);
OUT = askForSpecificSite(engine, OUT);
Vector<String> in = Core.Utils.FileOperations.ReadInDorkFile(templatefile);
out = generateSimpleDorks(engine, in);
out = askForSpecificSite(engine, out);
WriteDorks(engine);
}
......@@ -56,7 +56,7 @@ public class Generator {
java.util.Date d= new java.util.Date();
String date = new Timestamp(d.getTime()).toString().replace(" ", "_");
String output = "/home/fxb/search_and_destroy" + System.getProperty("file.separator") + date + "-" + engine.toUpperCase() + ".dorks";
Core.Utils.FileOperations.WriteResultsToFile(OUT, output);
Core.Utils.FileOperations.WriteResultsToFile(out, output);
System.out.println("Located at " + output);
}
......
......@@ -103,7 +103,7 @@ public class MultiDork {
int i=0;
System.out.println("[STATUS] All Threads initialized...");
System.out.println("[THREADS] " + T.size() + " - " + "[DORKS] " + 0 + "/" + DORK_VECTOR.size() + " - " + "[" + 0.0 + "%]");
System.out.println(RESULT_MEMORY_ARRAY.length);
//DEBUG System.out.println(RESULT_MEMORY_ARRAY.length);
/*
Before first release, be sure you corrected the formatPrint. PrintLN(\r)! this is kind of important
......@@ -124,9 +124,8 @@ public class MultiDork {
if(i==T.size()) checkpoint = false;
}
System.out.println("[THREADS] " + T.size() + " - " + "[DORKS] " + DORK_VECTOR.size() + "/" + DORK_VECTOR.size() + " - " + "[" + 100.0 + "%]");
System.out.println("[STATUS] Search is done, storing now your results...");
Vector<String> RESULT_MEMORY = new Vector<String>();
System.out.println(RESULT_MEMORY_ARRAY.length);
for(int n=0;n<RESULT_MEMORY_ARRAY.length;n++) {
for(int m=0;m<RESULT_MEMORY_ARRAY[n].size();m++) {
RESULT_MEMORY.add(RESULT_MEMORY_ARRAY[n].elementAt(m));
......@@ -171,6 +170,7 @@ public class MultiDork {
try {
FileOperations.WriteStringToFile(SB.toString(), OUTPUT);
System.out.println("[STATUS] Shutting Search and Destroy down now...");
} catch (IOException e) {
e.printStackTrace();
System.out.println("We are unable to save your dorks.. I will print them now in your shell window.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment