-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbreach.java
76 lines (66 loc) · 3.34 KB
/
breach.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import com.turn.ttorrent.client.Client;
import com.turn.ttorrent.common.Torrent;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
public class BreachParseInstaller {
public static void main(String[] args) {
String downloadDir = "/path/to/download/dir";
String breachCompilationPath = downloadDir + "/BreachCompilation.tar.gz";
// Step 1: Download the BreachCompilation torrent file.
downloadTorrent(breachCompilationPath);
// Step 2: Extract the contents of the BreachCompilation file.
String extractDir = "/opt/breach-parse"; // Change this to your desired location
extractBreachCompilation(breachCompilationPath, extractDir);
// Step 3: Run breach-parse with the required parameters.
String breachParseCommand = "breach-parse @gmail.com gmail.txt " + extractDir + "/data";
executeBreachParse(breachParseCommand);
}
// Step 1: Download the torrent file using the magnet link.
private static void downloadTorrent(String outputPath) {
String magnetLink = "magnet:?xt=urn:btih:7ffbcd8cee06aba2ce6561688cf68ce2addca0a3&dn=BreachCompilation&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fglotorrents.pw%3A6969&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337";
Client client;
try {
client = new Client(
// Change the port number as per your configuration
new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10 }, 6881
);
Torrent torrent = Torrent.create(new URL(magnetLink));
client.download(torrent, Paths.get(outputPath));
} catch (Exception e) {
e.printStackTrace();
}
}
// Step 2: Extract the contents of the BreachCompilation file.
private static void extractBreachCompilation(String inputPath, String outputPath) {
try (TarArchiveInputStream tarInput = new TarArchiveInputStream(new GzipCompressorInputStream(Files.newInputStream(Paths.get(inputPath))))) {
TarArchiveEntry entry;
while ((entry = tarInput.getNextTarEntry()) != null) {
if (!entry.isDirectory()) {
File outputFile = new File(outputPath + File.separator + entry.getName());
if (!outputFile.getParentFile().exists()) {
outputFile.getParentFile().mkdirs();
}
Files.copy(tarInput, outputFile.toPath());
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
// Step 3: Execute breach-parse command.
private static void executeBreachParse(String command) {
try {
Process process = Runtime.getRuntime().exec(command);
process.waitFor();
// Optionally, you can read and process the output of breach-parse here.
} catch (IOException | InterruptedException e) {
e.printStackTrace();
}
}
}