Commit f2a189ce authored by fxb's avatar fxb

Proxy-per-Thread Feature, really awesome this is working (there must

be some bugs!)
parent 2bd21975
......@@ -4,4 +4,28 @@
<artifactId>search_and_destroy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>name</name>
<build>
<plugins>
<plugin>
<!-- Build an executable JAR -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>Main.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
......@@ -9,14 +9,43 @@ package Core.Utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Authenticator;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.PasswordAuthentication;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import javax.net.ssl.HttpsURLConnection;
import SelectModus.Automatik.AutoConfig;
public class ConnectHTTP {
public static String URLContent(String url) throws IOException {
URL page = new URL(url);
HttpURLConnection connection = (HttpURLConnection) page.openConnection();
public static String URLContent(String url, final AutoConfig.ProxyPerEngine proxyConfig) throws IOException {
URLConnection page;// = new URL(url);
Authenticator authenticator;
Proxy p;
if(proxyConfig.isActivated()) {
if(proxyConfig.getUser() != null && !proxyConfig.getUser().isEmpty() && proxyConfig.getPass() != null && !proxyConfig.getPass().isEmpty()) {
authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(proxyConfig.getUser(),
proxyConfig.getPass().toCharArray()));
}
};
Authenticator.setDefault(authenticator);
}
if(proxyConfig.isSocks()) {
p = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(proxyConfig.getHost(), proxyConfig.getPort()));
} else {
p = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyConfig.getHost(), proxyConfig.getPort()));
}
page = new URL(url).openConnection(p);
} else {
page = new URL(url).openConnection();
}
HttpURLConnection connection = (HttpURLConnection) page;
connection.setReadTimeout(300000);
connection.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
connection.addRequestProperty("Referer", "google.com");
......@@ -31,10 +60,40 @@ public class ConnectHTTP {
in.close();
return html.toString();
}
public static String HTTPSURLContent(String url) throws IOException {
System.setProperty("jsse.enableSNIExtension", "false");
URL page = new URL(url);
HttpsURLConnection connection = (HttpsURLConnection) page.openConnection();
public static String HTTPSURLContent(String url, final AutoConfig.ProxyPerEngine proxyConfig) throws IOException {
/*
* This is usually not a good idea (really bad), but we do not care about security here,
* we care about speed. Testing is required -> How many threads throw what SSL exception.
* Maybe some Mutex is needed between the threads, but that would be "really slow".
* Nearly as slow as the sleep loop eating up cpu cycles because of my lazy barrier "solution".
*/
System.setProperty("jsse.enableSNIExtension", "false");
System.setProperty("https.protocols", "TLSv1.1");
URLConnection page;// = new URL(url);
Authenticator authenticator;
Proxy p;
if(proxyConfig.isActivated()) {
if(proxyConfig.getUser() != null && !proxyConfig.getUser().isEmpty() && proxyConfig.getPass() != null && !proxyConfig.getPass().isEmpty()) {
authenticator = new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return (new PasswordAuthentication(proxyConfig.getUser(),
proxyConfig.getPass().toCharArray()));
}
};
Authenticator.setDefault(authenticator);
}
if(proxyConfig.isSocks()) {
p = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(proxyConfig.getHost(), proxyConfig.getPort()));
} else {
p = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyConfig.getHost(), proxyConfig.getPort()));
}
page = new URL(url).openConnection(p);
} else {
page = new URL(url).openConnection();
}
HttpsURLConnection connection = (HttpsURLConnection) page;
connection.setReadTimeout(300000);
connection.addRequestProperty("Accept-Language", "en-US,en;q=0.8");
connection.addRequestProperty("Referer", "google.com");
......
package Main;
import java.io.IOException;
import java.util.Vector;
import javax.xml.parsers.ParserConfigurationException;
import org.xml.sax.SAXException;
import SelectModus.Automatik.Automatik;
import SelectModus.Automatik.Install;
import SelectModus.Automatik.XML;
import SelectModus.Generator.Generator;
import SelectModus.MultiDork.MultiDork;
import SelectModus.SingleDork.SingleDork;
......@@ -46,7 +52,7 @@ public class Main {
System.out.println("[ERROR] You can only use one, --singledork or --multidork.");
return;
}
/**
/*
* Parsing and starting SingleDork Mode!
*/
if(A.singledork == true) {
......@@ -81,7 +87,7 @@ public class Main {
}
new SingleDork(A.engine, A.dork, A.rpd, A.inFile, A.outFile, A.output).doJob();
}
/**
/*
* Parsing and starting MultiDork Mode!
*/
if(A.multidork == true) {
......@@ -118,12 +124,26 @@ 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) {
/*
try {
System.out.println(new XML().getAutoConfig("/home/fxb/search_and_destroy/search_and_destroy.xml").toString());
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
*/
new Install().doJob();
}
if(A.generator == true) {
......@@ -148,4 +168,4 @@ public class Main {
A.doJob();
*/
}
}
\ No newline at end of file
}
......@@ -6,17 +6,19 @@ import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import SelectModus.Automatik.AutoConfig;
public class Bing extends SearchEngine {
public Bing(Vector<String> DORKS, int ID, SearchProgress PROGRESS, int RESULTS_PER_DORK, Vector<String> RESULT_MEMORY) {
super(DORKS, ID, PROGRESS, RESULTS_PER_DORK, RESULT_MEMORY);
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);
}
/*
These vars you can find in SearchEngine.
search is a method from SearchEngine.
*/
public void fetchResults(int NR, String DORK) throws IOException, URISyntaxException {
search(false, "http://www.bing.com/search?q=" + DORK + "&first=", NR, "href=\"http",4, "\"");
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);
}
/*
Here we crawl an url to get some results. see search for more information.
......@@ -24,7 +26,7 @@ public class Bing extends SearchEngine {
public void run() {
for (int i=0;i<DORKS.size();i++) {
try {
fetchResults(RESULTS_PER_DORK, java.net.URLEncoder.encode(DORKS.elementAt(i)));
fetchResults(RESULTS_PER_DORK, java.net.URLEncoder.encode(DORKS.elementAt(i)), proxy);
if(PROGRESS != null) PROGRESS.updateStatus(i, ID);
} catch (IOException ex) {
Logger.getLogger(Startpage.class.getName()).log(Level.SEVERE, null, ex);
......
......@@ -6,17 +6,19 @@ import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import SelectModus.Automatik.AutoConfig;
public class Google extends SearchEngine {
public Google(Vector<String> cuttedDorks, int ID, SearchProgress PROGRESS, int RESULTS_PER_DORK, Vector<String> RESULT_MEMORY) {
super(cuttedDorks, ID, PROGRESS, RESULTS_PER_DORK, RESULT_MEMORY);
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);
}
/*
These vars you can find in SearchEngine.
search is a method from SearchEngine.
*/
public void fetchResults(int NR, String DORK) throws IOException, URISyntaxException {
search(false, "http://www.google.de/search?q=" + DORK + "&hl=us&start=", NR, "href=\"/url?q=http",4, "&amp;");
search(false, "http://www.google.de/search?q=" + DORK + "&hl=us&start=", NR, "href=\"/url?q=http",4, "&amp;", proxy);
}
/*
Here we crawl an url to get some results. see search for more information.
......
......@@ -6,17 +6,19 @@ import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import SelectModus.Automatik.AutoConfig;
public class Ixquick extends SearchEngine {
public Ixquick(Vector<String> DORKS, int ID, SearchProgress PROGRESS, int RESULTS_PER_DORK, Vector<String> RESULT_MEMORY) {
super(DORKS, ID, PROGRESS, RESULTS_PER_DORK, RESULT_MEMORY);
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);
}
/*
These vars you can find in SearchEngine.
search is a method from SearchEngine.
*/
public void fetchResults(int NR, String DORK) throws IOException, URISyntaxException {
search(true, "https://ixquick.com/do/search?q=" + DORK + "&startat=", NR, "<h3><a href='", 0, "'");
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);
}
/*
Here we crawl an url to get some results. see search for more information.
......@@ -24,7 +26,7 @@ public class Ixquick extends SearchEngine {
public void run() {
for (int i=0;i<DORKS.size();i++) {
try {
fetchResults(RESULTS_PER_DORK, DORKS.elementAt(i));
fetchResults(RESULTS_PER_DORK, DORKS.elementAt(i), proxy);
if(PROGRESS != null) PROGRESS.updateStatus(i, ID);
} catch (IOException ex) {
Logger.getLogger(Startpage.class.getName()).log(Level.SEVERE, null, ex);
......
......@@ -12,12 +12,14 @@ 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, int RESULTS_PER_DORK, Vector<String> RESULT_VECTOR) {
SearchEngine(Vector<String> DORKS, int ID, SearchProgress PROGRESS, AutoConfig.ProxyPerEngine proxy, int RESULTS_PER_DORK, Vector<String> RESULT_VECTOR) {
this.DORKS = DORKS;
this.ID = ID;
this.PROGRESS = PROGRESS;
this.proxy = proxy;
this.RESULTS_PER_DORK = RESULTS_PER_DORK;
this.RESULT_VECTOR = RESULT_VECTOR;
}
......@@ -25,6 +27,7 @@ public abstract class SearchEngine implements Runnable {
int ID;
int RESULTS_PER_DORK;
SearchProgress PROGRESS;
AutoConfig.ProxyPerEngine proxy;
Vector<String> RESULT_VECTOR;
/*
......@@ -69,11 +72,11 @@ public abstract class SearchEngine implements Runnable {
HTML = null;
}*/
void search(boolean https, String URL, int NR, String keystring, int var, String endstring) throws IOException {
void search(boolean https, String URL, int NR, String keystring, int var, String endstring, AutoConfig.ProxyPerEngine proxy) throws IOException {
StringBuilder HTML = new StringBuilder();
for(int i=0;i<NR;i=i+10) {
if (https == true) HTML.append(HTTPSURLContent(URL + i));
if (https == false) HTML.append(URLContent(URL + i));
if (https == true) HTML.append(HTTPSURLContent(URL + i, proxy));
if (https == false) HTML.append(URLContent(URL + i, proxy));
}
int pos = 0;
String h = HTML.toString();
......
......@@ -7,10 +7,12 @@ import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import SelectModus.Automatik.AutoConfig;
public class Startpage extends SearchEngine {
public Startpage(Vector<String> DORKS, int ID, SearchProgress PROGRESS, int RESULTS_PER_DORK, Vector<String> RESULT_MEMORY) {
super(DORKS, ID, PROGRESS, RESULTS_PER_DORK, RESULT_MEMORY);
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);
}
/*
These vars you can find in SearchEngine.
......@@ -20,16 +22,16 @@ public class Startpage extends SearchEngine {
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"));
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));
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) throws IOException, URISyntaxException {
public void fetchResults(int NR, String DORK, AutoConfig.ProxyPerEngine proxy) throws IOException, URISyntaxException {
String QID = makeQID();
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, "'");
search(true, url, NR, "<h3><a href='", 0, "'", proxy);
}
/*
fetchResults crafts a special url, with a new generated startpage id.
......@@ -38,7 +40,7 @@ public class Startpage extends SearchEngine {
public void run() {
for (int i=0;i<DORKS.size();i++) {
try {
fetchResults(RESULTS_PER_DORK, DORKS.elementAt(i));
fetchResults(RESULTS_PER_DORK, DORKS.elementAt(i), proxy);
if(PROGRESS != null) PROGRESS.updateStatus(i, ID);
} catch (IOException ex) {
Logger.getLogger(Startpage.class.getName()).log(Level.SEVERE, null, ex);
......
package SelectModus.Automatik;
import Core.Utils.*;
public class AutoConfig {
public class ProxyPerEngine {
@Override
public String toString() {
return "ProxyPerEngine [user=" + user + ", pass=" + pass
+ ", host=" + host + ", port=" + port + ", socks=" + socks
+ ", ACTIVATED=" + activated + "]";
}
private String user = new String();
private String pass = new String();
private String host = new String();
private Integer port;
private boolean socks;
private boolean activated;
public boolean isSocks() {
return socks;
}
public void setSocks(boolean socks) {
this.socks = socks;
}
public boolean isActivated() {
return activated;
}
public void setActivated(boolean activated) {
this.activated = activated;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
}
boolean Bing;
int BingThreads;
String BingDorks;
String BingDorks = new String();
ProxyPerEngine BingProxy = new ProxyPerEngine();
//String BingInResults;
//String BingOutResults;
boolean Startpage;
int StartpageThreads;
String StartpageDorks;
String StartpageDorks = new String();
ProxyPerEngine StartpageProxy = new ProxyPerEngine();
//String StartpageInResults;
//String StartpageOutResults;
boolean Ixquick;
int IxquickThreads;
String IxquickDorks;
String IxquickDorks = new String();
ProxyPerEngine IxquickProxy = new ProxyPerEngine();
//String IxquickInResults;
//String IxquickOutResults;
String output;
String inFile;
String output = new String();
String inFile = new String();
public String getInFile() {
......@@ -35,8 +97,9 @@ public class AutoConfig {
public void setOutFile(String outFile) {
this.outFile = outFile;
}
String outFile;
/**
String outFile = new String();
/*
public String getBingInResults() {
return BingInResults;
......@@ -75,7 +138,7 @@ public class AutoConfig {
IxquickOutResults = ixquickOutResults;
}
**/
*/
public boolean isBing() {
return Bing;
......@@ -137,21 +200,43 @@ public class AutoConfig {
public void setIxquickDorks(String ixquickDorks) {
IxquickDorks = ixquickDorks;
}
public ProxyPerEngine getBingProxy() {
return BingProxy;
}
public void setBingProxy(ProxyPerEngine bingProxy) {
BingProxy = bingProxy;
}
public ProxyPerEngine getStartpageProxy() {
return StartpageProxy;
}
public void setStartpageProxy(ProxyPerEngine startpageProxy) {
StartpageProxy = startpageProxy;
}
public ProxyPerEngine getIxquickProxy() {
return IxquickProxy;
}
public void setIxquickProxy(ProxyPerEngine ixquickProxy) {
IxquickProxy = ixquickProxy;
}
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("\n[ " + "Bing" + " | " + Bing + " ]\n");
sb.append("[ " + "BingDorks" + " | " + BingDorks + " ]\n");
sb.append("[ " + "BingThreads" + " | " + BingThreads + " ]\n");
if(BingProxy != null) sb.append(BingProxy.toString() + "\n");
//sb.append("[ " + "Bing-InResults" + " | " + BingInResults + "]\n");
//sb.append("[ " + "Bing-OutResults" + " | " + BingOutResults + "]\n");
sb.append("\n[ " + "Ixquick" + " | " + Ixquick + " ]\n");
sb.append("[ " + "IxquickDorks" + " | " + IxquickDorks + " ]\n");
sb.append("[ " + "IxquickThreads" + " | " + IxquickThreads + " ]\n");
if(IxquickProxy != null) sb.append(IxquickProxy.toString() + "\n");
//sb.append("[ " + "Ixquick-InResults" + " | " + IxquickInResults + "]\n");
//sb.append("[ " + "Ixquick-OutResults" + " | " + IxquickOutResults + "]\n");
sb.append("\n[ " + "Startpage" + " | " + Startpage + " ]\n");
sb.append("[ " + "StartpageDorks" + " | " + StartpageDorks + " ]\n");
sb.append("[ " + "StartpageThreads" + " | " + StartpageThreads + " ]\n");
if(StartpageProxy != null) sb.append(StartpageProxy.toString() + "\n");
//sb.append("[ " + "Startpage-InResults" + " | " + StartpageInResults + "]\n");
//sb.append("[ " + "Startpage-OutResults" + " | " + StartpageOutResults + "]\n");
sb.append("\n[ " + "output" + " | " + output + " ]");
......@@ -159,4 +244,5 @@ public class AutoConfig {
sb.append("\n[ " + "outFile" + " | " + outFile + " ]");
return sb.toString();
}
}
......@@ -7,7 +7,7 @@
package SelectModus.Automatik;
import static Core.Utils.FileOperations.checkIfFileExists;
import static SelectModus.Automatik.XML_Library.getAutoConfig;
import static SelectModus.Automatik.XML.getAutoConfig;
import java.io.File;
import java.io.IOException;
......
......@@ -20,7 +20,7 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
public class XML_Library {
public class XML {
public static AutoConfig getAutoConfig(String INSTALLATIONFILE) throws ParserConfigurationException, SAXException, IOException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
......@@ -28,7 +28,7 @@ public class XML_Library {
AutoConfig A = new AutoConfig();
NodeList nList = doc.getElementsByTagName("profile");
for (int temp = 0; temp < nList.getLength(); temp++) {
Node nNode = nList.item(temp);
Node nNode = nList.item(temp);
if (nNode.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) nNode;
if(eElement.getElementsByTagName("Bing").item(0).getTextContent().equalsIgnoreCase("1")) {
......@@ -65,10 +65,54 @@ public class XML_Library {
A.setOutput(eElement.getElementsByTagName("output").item(0).getTextContent());
A.setInFile(eElement.getElementsByTagName("inFile").item(0).getTextContent());
A.setOutFile(eElement.getElementsByTagName("outFile").item(0).getTextContent());
if(eElement.getElementsByTagName("Proxy").item(0).getNodeName().equalsIgnoreCase("Proxy")) {
NodeList nl = doc.getElementsByTagName("Proxy");
for(int i=0;i<nl.getLength();i++) {
Node n = nl.item(i);
if (n.getNodeType() == Node.ELEMENT_NODE) {
Element e = (Element) n;
if(e.getElementsByTagName("Bing").item(0).getTextContent().equalsIgnoreCase("0")) {
A.BingProxy.setActivated(false);
} else {
A.BingProxy.setActivated(true);
A.BingProxy.setHost(e.getElementsByTagName("Bing").item(0).getAttributes().getNamedItem("host").getNodeValue());
A.BingProxy.setPort(Integer.parseInt(e.getElementsByTagName("Bing").item(0).getAttributes().getNamedItem("port").getNodeValue()));
A.BingProxy.setUser(e.getElementsByTagName("Bing").item(0).getAttributes().getNamedItem("user").getNodeValue());
A.BingProxy.setPass(e.getElementsByTagName("Bing").item(0).getAttributes().getNamedItem("pass").getNodeValue());
if(e.getElementsByTagName("Bing").item(0).getAttributes().getNamedItem("socks").getNodeValue().equalsIgnoreCase("true")) A.BingProxy.setSocks(true);
else A.BingProxy.setSocks(false);
}
if(e.getElementsByTagName("Ixquick").item(0).getTextContent().equalsIgnoreCase("0")) {
A.IxquickProxy.setActivated(false);
} else {
A.IxquickProxy.setActivated(true);
A.IxquickProxy.setHost(e.getElementsByTagName("Ixquick").item(0).getAttributes().getNamedItem("host").getNodeValue());
A.IxquickProxy.setPort(Integer.parseInt(e.getElementsByTagName("Ixquick").item(0).getAttributes().getNamedItem("port").getNodeValue()));
A.IxquickProxy.setUser(e.getElementsByTagName("Ixquick").item(0).getAttributes().getNamedItem("user").getNodeValue());
A.IxquickProxy.setPass(e.getElementsByTagName("Ixquick").item(0).getAttributes().getNamedItem("pass").getNodeValue());
if(e.getElementsByTagName("Ixquick").item(0).getAttributes().getNamedItem("socks").getNodeValue().equalsIgnoreCase("true")) A.IxquickProxy.setSocks(true);
else A.IxquickProxy.setSocks(false);
}
if(e.getElementsByTagName("Startpage").item(0).getTextContent().equalsIgnoreCase("0")) {
A.StartpageProxy.setActivated(false);
} else {
A.StartpageProxy.setActivated(true);
A.StartpageProxy.setHost(e.getElementsByTagName("Startpage").item(0).getAttributes().getNamedItem("host").getNodeValue());
A.StartpageProxy.setPort(Integer.parseInt(e.getElementsByTagName("Startpage").item(0).getAttributes().getNamedItem("port").getNodeValue()));
A.StartpageProxy.setUser(e.getElementsByTagName("Startpage").item(0).getAttributes().getNamedItem("user").getNodeValue());
A.StartpageProxy.setPass(e.getElementsByTagName("Startpage").item(0).getAttributes().getNamedItem("pass").getNodeValue());
if(e.getElementsByTagName("Startpage").item(0).getAttributes().getNamedItem("socks").getNodeValue().equalsIgnoreCase("true")) A.StartpageProxy.setSocks(true);
else A.StartpageProxy.setSocks(false);
}
}
}
}
}
}
return A;
}
public static void makeAwesomeXML(String INSTALLATIONFILE) throws ParserConfigurationException, SAXException, IOException, TransformerException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
......@@ -83,6 +127,7 @@ public class XML_Library {
StreamResult result = new StreamResult(new File(INSTALLATIONFILE));
transformer.transform(source, result);
}
public static void installEmpty(String INSTALLATIONFILE) throws TransformerException, ParserConfigurationException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
......@@ -101,8 +146,8 @@ public class XML_Library {
//StreamResult result = new StreamResult(System.out);
StreamResult result = new StreamResult(new File(INSTALLATIONFILE));
transformer.transform(source, result);
}
public static void installAutomatic(String INSTALLATIONFILE, AutoConfig A) throws ParserConfigurationException, TransformerException, SAXException, IOException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
......@@ -152,6 +197,40 @@ public class XML_Library {
Element outFile = doc.createElement("outFile");
outFile.appendChild(doc.createTextNode(A.getOutFile()));
profile.appendChild(outFile);
Element proxy = doc.createElement("Proxy");
Element bingChild = doc.createElement("Bing");
bingChild.setAttribute("user", A.BingProxy.getUser());
bingChild.setAttribute("pass", A.BingProxy.getPass());
bingChild.setAttribute("host", A.BingProxy.getHost());
bingChild.setAttribute("port", A.BingProxy.getPort().toString());
bingChild.setAttribute("socks", String.valueOf(A.BingProxy.isSocks()));
if(A.BingProxy.isActivated()) bingChild.appendChild(doc.createTextNode("1"));
else bingChild.appendChild(doc.createTextNode("0"));
proxy.appendChild(bingChild);
Element ixquickChild = doc.createElement("Ixquick");
ixquickChild.setAttribute("user", A.IxquickProxy.getUser());
ixquickChild.setAttribute("pass", A.IxquickProxy.getPass());
ixquickChild.setAttribute("host", A.IxquickProxy.getHost());
ixquickChild.setAttribute("port", A.IxquickProxy.getPort().toString());
ixquickChild.setAttribute("socks", String.valueOf(A.IxquickProxy.isSocks()));
if(A.IxquickProxy.isActivated()) ixquickChild.appendChild(doc.createTextNode("1"));
else ixquickChild.appendChild(doc.createTextNode("0"));
proxy.appendChild(ixquickChild);
Element startpageChild = doc.createElement("Startpage");
startpageChild.setAttribute("user", A.StartpageProxy.getUser());
startpageChild.setAttribute("pass", A.StartpageProxy.getPass());
startpageChild.setAttribute("host", A.StartpageProxy.getHost());
startpageChild.setAttribute("port", A.StartpageProxy.getPort().toString());
startpageChild.setAttribute("socks", String.valueOf(A.StartpageProxy.isSocks()));
if(A.StartpageProxy.isActivated()) startpageChild.appendChild(doc.createTextNode("1"));
else startpageChild.appendChild(doc.createTextNode("0"));
proxy.appendChild(startpageChild);
profile.appendChild(proxy);
/*
Element threads = doc.createElement("Threads");
threads.appendChild(doc.createTextNode(String.valueOf(A.getThreads())));
......@@ -167,12 +246,13 @@ public class XML_Library {
StreamResult result = new StreamResult(new File(INSTALLATIONFILE));
transformer.transform(source, result);
}
public static void remove(String mode, String INSTALLATIONFILE) throws SAXException, IOException, ParserConfigurationException, TransformerException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(INSTALLATIONFILE);
Node search_and_destroy = doc.getFirstChild();
for(int i=0;i<doc.getElementsByTagName("profile").getLength();i++) {
Node profile = doc.getElementsByTagName("profile").item(i);
NamedNodeMap attr = profile.getAttributes();
......
......@@ -53,7 +53,7 @@ public class MultiDork {
if (ENGINE.equalsIgnoreCase("B")) {
for(int i=0;i<NUMBER_OF_THREADS;i++) {
RESULT_MEMORY_ARRAY[i] = new Vector<String>();
T.add(new Thread(new Bing(cuttedDorks[i], i, PROGRESS, RESULTS_PER_DORK, RESULT_MEMORY_ARRAY[i])));
T.add(new Thread(new Bing(cuttedDorks[i], i, PROGRESS, null