Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Find the password with dictionary attack

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Find the password with dictionary attack

    I have 2 files , one zip file 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. Also I use the Arcmexer jar for my program.I suspect that the problem is here:

    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();  
       }  
       }  
       }


  2. #2
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: Find the password with dictionary attack

    I think you will find it is because you keep looping through the entries in the zip file, im guessing you only have one! Stop looping through grab the entry once and keep it.

Similar Threads

  1. where can i find the tmp/foo directory?
    By Idy in forum Java IDEs
    Replies: 11
    Last Post: January 19th, 2010, 11:21 AM
  2. [SOLVED] Password screens
    By Dave in forum AWT / Java Swing
    Replies: 7
    Last Post: August 26th, 2009, 06:37 AM
  3. password
    By 5723 in forum Algorithms & Recursion
    Replies: 9
    Last Post: July 9th, 2009, 05:26 AM
  4. [SOLVED] java password
    By pwngrammer in forum File I/O & Other I/O Streams
    Replies: 6
    Last Post: June 15th, 2009, 09:49 AM
  5. Java password generator program to generate 8 random integers
    By Lizard in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 16th, 2009, 07:49 AM