...
 
Commits (18)
/target/
.settings/org.eclipse.jdt.core.prefs
......@@ -21,9 +21,16 @@ Every Search Enginge will try to block you.
Startpage does not block tor users, so I recommend you to use tor.
Bing will try to block you if you use tor, so see ToDo.
- Binary copy:
You find a working binary copy with all dependencies inside at target/search_and_destroy-*-jar-with-dependencies.jar
Run it with:
```
java -jar search_and_destroy-*-jar-with-dependencies.jar
```
#### == ToDo ==
- High Priority: 1st stable Release
- Proxy per search engine
- Maybe even proxy per search key session (maybe several tor instances @ different ports)
- Random user agents per search engine
\ No newline at end of file
- Random user agents per search engine
......@@ -4,28 +4,90 @@
<artifactId>search_and_destroy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>name</name>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<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>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
Main.Main
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!--
static build as a library:
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptor>jar-with-dependencies</descriptor>
</descriptorRefs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
-->
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -6,6 +6,7 @@ import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
import java.util.Vector;
public class FileOperations {
......@@ -55,4 +56,24 @@ public class FileOperations {
return file.exists();
}
/*
* From https://stackoverflow.com/questions/326390/how-do-i-create-a-java-string-from-the-contents-of-a-file
* as it is a good and robust solution
*/
public static String readFile(String pathname) throws IOException {
File file = new File(pathname);
StringBuilder fileContents = new StringBuilder((int)file.length());
Scanner scanner = new Scanner(file);
String lineSeparator = System.getProperty("line.separator");
try {
while(scanner.hasNextLine()) {
fileContents.append(scanner.nextLine() + lineSeparator);
}
return fileContents.toString();
} finally {
scanner.close();
}
}
}
......@@ -23,12 +23,12 @@ public class StringEngine {
}
public static Vector<String> removeDuplicates(Vector<String> D) {
HashSet<String> set = new HashSet<String>();
for(int i=0;i<D.size();i++) {
set.add(D.elementAt(i));
}
D.clear();
D.addAll(set);
HashSet<String> set = new HashSet<String>();
for(int i=0;i<D.size();i++) {
set.add(D.elementAt(i));
}
D.clear();
D.addAll(set);
return D;
}
......
......@@ -126,21 +126,7 @@ public class Main {
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();
new Install().createConfigurationFile();
}
if(A.generator == true) {
new Generator().doJob();
......@@ -164,4 +150,4 @@ public class Main {
A.doJob();
*/
}
}
}
\ No newline at end of file
......@@ -20,8 +20,8 @@ public class Print {
" --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" +
// " --verbosity 0-3 verbosity level. 1 is default \n" +
" --timeout 30 timeout in seconds \n" +
" --verbosity 0-3 verbosity level. 1 is default \n" +
" --gui Not implemented yet! \n");
}
......
......@@ -71,15 +71,16 @@ public class Attack {
}
System.out.println("[THREADS] " + threadVector.size() + " - " + "[DORKS] " + (dorkVectorBing.size()+dorkVectorIxquick.size()+dorkVectorStartpage.size()) + "/" + (dorkVectorBing.size()+dorkVectorIxquick.size()+dorkVectorStartpage.size()) + " - " + "[" + 100.0 + "%]");
Vector<String> RESULT_MEMORY = new Vector<String>();
Vector<String> resultMemory = new Vector<String>();
for(int n=0;n<resultMemoryArray.length;n++) {
for(int m=0;m<resultMemoryArray[n].size();m++) {
RESULT_MEMORY.add(resultMemoryArray[n].elementAt(m));
resultMemory.add(resultMemoryArray[n].elementAt(m));
}
}
RESULT_MEMORY = removeDuplicates(RESULT_MEMORY);
RESULT_MEMORY = betterYourResults(RESULT_MEMORY, in, out);
resultMemory = removeDuplicates(resultMemory);
resultMemory = betterYourResults(resultMemory, in, out);
/*
Methods betterYourResults and removeDuplicates create better results.
If you use Automatik Mode, you can run install this tool. Than you can use a config file.
......@@ -95,7 +96,7 @@ public class Attack {
* Print also a ne [Status]
*/
Core.Utils.FileOperations.WriteResultsToFile(RESULT_MEMORY, A.output);
Core.Utils.FileOperations.WriteResultsToFile(resultMemory, A.output);
System.out.println("[STATUS] File is at " + A.output + "");
/*
for(i=0;i<RESULT_MEMORY.size();i++) {
......@@ -122,6 +123,7 @@ public class Attack {
}
}
@SuppressWarnings("unchecked")
private void initThreads() throws IOException {
preConfig();
System.out.println("[INFO] We are running " + numberOfThreads + " Threads now.");
......
......@@ -18,31 +18,26 @@ import org.xml.sax.SAXException;
public class Automatik {
public static String DIR_OF_INSTALLATION = System.getProperty("user.home") + System.getProperty("file.separator") + "search_and_destroy";
public static String INSTALLATIONFILE = DIR_OF_INSTALLATION + System.getProperty("file.separator") + "search_and_destroy.xml";
public static String installationDirectory = System.getProperty("user.home") + System.getProperty("file.separator") + "search_and_destroy";
public static String installationFile = installationDirectory + System.getProperty("file.separator") + "search_and_destroy.json";
public void doJob() {
AutoConfig A = new AutoConfig();
try {
A = getConfig();
} catch (ParserConfigurationException e) {
} catch (IOException e1) {
// 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();
e1.printStackTrace();
}
if(A == null || checkIfFileExists(INSTALLATIONFILE) == false) {
if(A == null || checkIfFileExists(installationFile) == false) {
System.out.println("Install first using --install. check out help menu -h");
} else {
System.out.println("We read the following config: ");
System.out.println(A.toString());
Attack ATT= new Attack(A);
Attack attack = new Attack(A);
try {
ATT.attack(A);
attack.attack(A);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
......@@ -50,14 +45,15 @@ public class Automatik {
}
}
public AutoConfig getConfig() throws ParserConfigurationException, SAXException, IOException {
new File(DIR_OF_INSTALLATION).mkdirs();
if (checkForInstallation(INSTALLATIONFILE)) {
return getAutoConfig(INSTALLATIONFILE);
public AutoConfig getConfig() throws IOException {
new File(installationDirectory).mkdirs();
if (checkForInstallation(installationFile)) {
return getAutoConfig(installationFile);
} else {
return null;
}
}
private static boolean checkForInstallation(String dir) {
if(checkIfFileExists(dir)) {
return true;
......
package SelectModus.Automatik;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class ConfigFile {
public ConfigFile(AutoConfig A, String fileName) {
this.A = A;
this.fileName = fileName;
}
AutoConfig A = new AutoConfig();
String fileName = new String();
public void generateFile() throws Exception {
File f = new File(fileName);
if(f.exists())
throw new RuntimeException();
assert(f.exists() == false);
f.createNewFile();
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(A);
try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName), StandardCharsets.UTF_8))) {
writer.write(json);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
......@@ -20,12 +20,11 @@ import javax.xml.transform.TransformerException;
import org.xml.sax.SAXException;
public class Install {
public static String dirOfInstallation = System.getProperty("user.home") + System.getProperty("file.separator") + "search_and_destroy";
public static String installationFile = dirOfInstallation + System.getProperty("file.separator") + "search_and_destroy.xml";
public static String installationDirectory = System.getProperty("user.home") + System.getProperty("file.separator") + "search_and_destroy";
public static String installationFile = installationDirectory + System.getProperty("file.separator") + "search_and_destroy.json";
public static AutoConfig runAssistant() {
new File(dirOfInstallation).mkdirs();
new File(installationDirectory).mkdirs();
AutoConfig A = new AutoConfig();
boolean chosen = false;
String choice;
......@@ -105,7 +104,7 @@ public class Install {
// System.out.print("Enter the file containing keywords that must be in every result: ");
// A.setIxquickInResults(readIn());
// System.out.print("Enter the file containing keywords that are forbidden in every result: ");
// A.setIxquickOutResults(readIn());
// A.setIxquickOutResults(readIn());
/*
* Proxy check
......@@ -223,7 +222,39 @@ public class Install {
return A;
}
public void doJob() {
public void createConfigurationFile() {
boolean doIt = true;
if(checkIfFileExists(installationFile)) {
doIt = false;
}
if(doIt == false) {
System.out.println("We found a config at: ");
System.out.println(installationFile);
System.out.println("Remove this file, otherwise you won't be able to install Search & Destroy");
} else {
AutoConfig A = runAssistant();
try {
new ConfigFile(A, installationFile).generateFile();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("File was written to:");
System.out.println(installationFile);
System.out.println();
System.out.println(A.toString());
}
}
/*
* old method, was a quick and dirty solution. We will fix this now with a library.
*
public void createConfigurationFile() {
boolean doIt = true;
if(checkIfFileExists(installationFile)) {
doIt = false;
......@@ -260,4 +291,7 @@ public class Install {
System.out.println(A.toString());
}
}
*/
}
\ No newline at end of file
......@@ -20,97 +20,17 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import Core.Utils.FileOperations;
public class XML {
public static AutoConfig getAutoConfig(String INSTALLATIONFILE) throws ParserConfigurationException, SAXException, IOException {
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document doc = docBuilder.parse(INSTALLATIONFILE);
AutoConfig A = new AutoConfig();
NodeList nList = doc.getElementsByTagName("profile");
for (int temp = 0; temp < nList.getLength(); 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")) {
A.setBing(true);
A.setBingDorks(eElement.getElementsByTagName("Bing").item(0).getAttributes().item(0).getNodeValue());
//A.setBingInResults(eElement.getElementsByTagName("Bing").item(0).getAttributes().item(1).getNodeValue());
//A.setBingOutResults(eElement.getElementsByTagName("Bing").item(0).getAttributes().item(2).getNodeValue());
A.setBingThreads(Integer.parseInt(eElement.getElementsByTagName("Bing").item(0).getAttributes().item(1).getNodeValue()));
} else {
A.setBing(false);
A.setBingDorks(null);
}
if(eElement.getElementsByTagName("Ixquick").item(0).getTextContent().equalsIgnoreCase("1")) {
A.setIxquick(true);
A.setIxquickDorks(eElement.getElementsByTagName("Ixquick").item(0).getAttributes().item(0).getNodeValue());
//A.setIxquickInResults(eElement.getElementsByTagName("Ixquick").item(0).getAttributes().item(1).getNodeValue());
//A.setIxquickOutResults(eElement.getElementsByTagName("Ixquick").item(0).getAttributes().item(2).getNodeValue());
A.setIxquickThreads(Integer.parseInt(eElement.getElementsByTagName("Ixquick").item(0).getAttributes().item(1).getNodeValue()));
} else {
A.setIxquick(false);
A.setIxquickDorks(null);
}
if(eElement.getElementsByTagName("Startpage").item(0).getTextContent().equalsIgnoreCase("1")) {
A.setStartpage(true);
A.setStartpageDorks(eElement.getElementsByTagName("Startpage").item(0).getAttributes().item(0).getNodeValue());
//A.setStartpageInResults(eElement.getElementsByTagName("Startpage").item(0).getAttributes().item(1).getNodeValue());
//A.setStartpageOutResults(eElement.getElementsByTagName("Startpage").item(0).getAttributes().item(2).getNodeValue());
A.setStartpageThreads(Integer.parseInt(eElement.getElementsByTagName("Startpage").item(0).getAttributes().item(1).getNodeValue()));
} else {
A.setStartpage(false);
A.setStartpageDorks(null);
}
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 AutoConfig getAutoConfig(String configFile) throws IOException {
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = FileOperations.readFile(configFile);
AutoConfig A = gson.fromJson(json, AutoConfig.class);
return A;
}
public static void makeAwesomeXML(String INSTALLATIONFILE) throws ParserConfigurationException, SAXException, IOException, TransformerException {
......
......@@ -182,6 +182,5 @@ public class MultiDork {
System.out.println("[STATUS] Shutting Search and Destroy down now...");
}
}
}
}
\ No newline at end of file
package output_data;
import java.util.ArrayList;
class Data {
/*
* Every Thread needs a new object of the type Data. You should have a link to a storeable.
*/
public ArrayList<Result> results;
}
package output_data;
public class FileStorage implements I_DataStorer {
/* This will be our Store-to-file Class.
* We need to be able to do this while getting new results and store buffered.
*
*/
private static final long serialVersionUID = 1L;
public void store(Data data) {
// TODO Auto-generated method stub
}
}
package output_data;
import java.io.Serializable;
interface I_DataStorer extends Serializable {
/*
* Every implementing class should have a pointer to Data class Data.java
* like:
*
* Data data = new Data();
*/
public abstract void store(Data data);
}
\ No newline at end of file
package output_data;
class Result {
/*
* category: Define, if it is a php, asp, html or whatever site.
* Try to use the ending of this website.
*/
public String searchEngine;
public String foundWebsite;
public String date;
public String category;
}