Welcome! Here is all the code from the video!
MD5 PASSCRACK CODE:
package pkg.haxtoolz;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author x
*/
public class passCrack {
public static void main(String[] args) throws IOException, NoSuchAlgorithmException {
String wordlist = "test.txt";
//load data from dict - newline seperated
String hashtocrack = "21232f297a57a5a743894a0e4a801fc3";
//load hash to crack
//try all combinations
//System.out.println(new File(".").getAbsolutePath());
//admin - 21232f297a57a5a743894a0e4a801fc3
//user123 - 6ad14ba9986e3615423dfca256d04e3f
String algorithm = "MD5";
boolean verbose = true;
try (BufferedReader br = new BufferedReader(new FileReader(wordlist))) {
System.out.println("[*] Wordlist read. Starting the cracking process... [*]\n");
String line;
while ((line = br.readLine()) != null) {
line = line.replace("\n", "");
//System.out.println(line);
//md5 it
byte[] bytesOfMessage = line.getBytes("UTF-8");
MessageDigest md = MessageDigest.getInstance(algorithm);
//System.out.println(md);
byte[] thedigest = md.digest(bytesOfMessage);
//System.out.println(thedigest);
BigInteger bigInt = new BigInteger(1,thedigest);
String hashtext = bigInt.toString(16);
if(verbose == true){
System.out.println("Trying >" + hashtext);
}
if(hashtocrack.contains(hashtext)){
System.out.println("[+] CRACKED PASSWORD : " + hashtext + " -> " + line);
}
}
} catch (FileNotFoundException ex) {
Logger.getLogger(passCrack.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
PORT SCANNER CODE:
package pkg.haxtoolz;
/**
*
* @author X
*/
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import javax.swing.JOptionPane;
public class portScanner {
public static void main(String[] args) throws Exception {
String host = JOptionPane.showInputDialog("Enter the IP you want to scan:");
// 127.0.0.1
int rangeone = Integer.parseInt(JOptionPane.showInputDialog("Enter the port range (starting port):"));
int rangetwo = Integer.parseInt(JOptionPane.showInputDialog("Enter the port range (ending port):"));
//rangeone = 20
//rangetwo = 23
InetAddress ip = InetAddress.getByName(host);
for(; rangeone <= rangetwo; rangeone++) {
//System.out.println(rangeone);
try {
Socket socket = new Socket(ip, rangeone);
System.out.println("[+] Found Opened : " + rangeone + " on " + ip);
socket.close();
} catch (IOException e) {
System.out.print(".");
}
}
}
}
WEBSITE DIRECTORY SCANNER:
package pkg.haxtoolz;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.HttpURLConnection;
//import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
/**
*
* @author X
*/
public class dirbScanner {
public static void main(String[] args) throws FileNotFoundException {
String url = null;
HttpURLConnection con = null;
String wordlist = "common.txt";
//IMPLEMENT FOR LOOP TO ITERATE OVER DIRBLIST
String exty = "";
try ( BufferedReader br = new BufferedReader(new FileReader(wordlist))) {
System.out.println("[*] Wordlist read. Starting the dirb process... [*]\n");
String line;
try {
url = JOptionPane.showInputDialog("Enter the host you want to scan (with protocol - ex. https://www.facebook.com) :");
} catch (Exception ex) {
System.out.println("Could not set the URL variable");
}
while ((line = br.readLine()) != null) {
//System.out.println(line);
line = line.replace("\n", "");
exty = line;
String EXT = "/" + exty;
System.out.println(EXT);
try {
url = url + EXT;
//
URL urly = new URL(url);
con = (HttpURLConnection) urly.openConnection();
} catch (IOException ex) {
System.out.println("[-]" + ex);
}
try {
con.setRequestMethod("GET");
} catch (ProtocolException ex) {
System.out.println("Cant Set method (GET) - " + ex);
}
try {
if (con.getResponseCode() == 200) {
System.out.println("Found 200 on Dir : " + EXT);
//System.out.println(con.getResponseMessage());
} else {
System.out.println("Found " + con.getResponseCode() + " on Dir : " + EXT);
}
} catch (IOException ex) {
Logger.getLogger(dirbScanner.class.getName()).log(Level.SEVERE, null, ex);
}
}
} catch (IOException ex) {
Logger.getLogger(dirbScanner.class.getName()).log(Level.SEVERE, null, ex);
}
//HERE
}
}
Big thanks to everyone for watching! If you have any questions leave them down below I always answer. This video is simple and its a beginner level learning – This video is for educational purposes only, it is designed to explain how tools pentesters use every day work, I do not support any illegal activities nor will i ever.
And let me know if you have any suggestions, questions or similar. You can also join my discord or contact me on instagram, links are on my website!
TAGS: easy, simple, programming, java, educational, information security, cybersecurity, tools, java programs, cybersecurity tools, pentesting tools, penetration testing, secure environment, virtual machine, java programming, educational