好的,所以我一直在研究Java暴力程序,该程序将从txt文件读取密码,并在与String变量中存储的密码匹配时停止。 出于某种原因,我的代码可以继续读取整个txt文件,即使它与正确的密码匹配也不会停止。
这是我的代码。
PasswordCracker2.java
import java.io.*;
public class PasswordCracker2 {
public static void main(String[] args) throws IOException {
String password = "busch@123";
File f = new File("wordlist.txt");
BufferedReader b = new BufferedReader(new FileReader(f));
String readLine = "";
System.out.println("[+] Trying Passwords from wordlist \n");
String guess_password;
while ((guess_password = b.readLine()) != null) {
System.out.println("[+] Password Attempt: " + guess_password);
if(guess_password == password) {
System.out.println("[+] Password Cracked: " + guess_password);
}
}
}
}