1 Reply Latest reply: Jan 19, 2010 4:07 AM by jwenting RSS

    Find the password with dictionary attack

    843853
      I have 2 files , one zip file (I use the Arcmexer jar ) and one more txt file.I want to find out the password of the zip file with the help of txt file.In txt file I have some words and one of them is the right password.The problem is here , when I put the right word at first the programm works but when i put it everywhere else it doesn't work. I suspect that the problem is here but I don't know where exactly:
      while ((entry = r.nextEntry()) != null && (line = br.readLine()) != null) 
      Here I saw you my programm.
      So if anyone knows something , help!!!!!!!!!!!!!!!!
      The password is "12345678" and is in txt file.
       import java.io.*;  
          import com.javamex.arcmexer.*;  
            
          public class Decryption{  
              public static void main(String[] args) {  
                  //String pw = "12345678";  
                  String line = null;  
                  //int recCount = 0;   
                  int count = 0;  
                 String x = null;  
         try {  
         FileInputStream f = new FileInputStream("C://ReadZip.zip");  
         ArchiveReader r = ArchiveReader.getReader(f);  
         ArchiveEntry entry ;  
         FileReader fr = new FileReader("C://test.txt");  
         BufferedReader br = new BufferedReader(fr);  
         while ((entry = r.nextEntry())!= null && (line = br.readLine())!= null) {  
         String filename = entry.getFilename();  
         System.out.println("What is the password of " + filename + "?");  
         if (entry.isProbablyCorrectPassword(line)){  
         System.out.println("Password found: " + line);  
         count++;  
         if (count==1)  
         x = "st" ;  
         else if (count==2)  
         x="nd";  
         else  
         x="th";  
         System.out.println("We found the password with the: " + count + x + " trial");  
         }else{  
         System.out.println("That password isn't the correct.Try again");  
         }  
         }  
         } catch (Exception e){  
         System.out.println("Exception raised!");  
         e.printStackTrace();  
         }  
         }  
         }