Closed Thread
Results 1 to 3 of 3

Thread: Java + Truecrypt + Windows

  1. #1
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Java + Truecrypt + Windows

    Basically I am trying to make a program using Java to mount a Truecrypt container. I am basically using this code now to actually do that part:

    Code:
            Process p = Runtime.getRuntime().exec("C:\\\\Program Files\\truecrypt\\truecrypt /s /v "+container+" /p "+password+" /q");
    Where container is obviously the .tc file and password is the password.

    Right now it has the /s command which means its silent - If I put in the wrong password it wont prompt me to enter in a new one. Which is what I want since its basically going to true a few different passwords. I want it to handle all the errors. But If I have the /s it wont give me anything hince the "silence" part of it. But I want it to let me know if it worked or not. If I use /s it does nothing either way. If I dont use it it will work and then do nothing or prompt me with the truecrypt program.

    My idea now is to set the drive to a known letter and check if the drive exists or something. But that might take too long when you get to 1 billion checks.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Java + Truecrypt + Windows

    Well I tried a few things:
    • Dir
    • cd
    • chdsk

    I finally found one that gave me something close to what I needed and that was "find" lol

    Basically I search for a string in "Z:\\" which is the directory I specify the container to mount to. If it returns "File not found" it does not work if it contains something else it worked.

    It does work sorta... I did a test run and the password being "hello" it got the correct password but didnt get anything until about 10 passwords later.
    ...
    hello
    hell
    heloh
    heloe
    helol
    heloo
    helo
    hel
    heohh
    heohe
    heohl
    heoho
    Password: heoho
    Code:
    try {
    	this.p = Runtime.getRuntime().exec("C:\\\\Program Files\\truecrypt\\truecrypt /s /lz /v G:\\hello.tc /p "+password+" /q");
    	this.p = Runtime.getRuntime().exec("find \"hello\" Z:\\\\");
    	this.stdError = new BufferedReader(new 
    		 InputStreamReader(p.getErrorStream()));
    	if(!this.stdError.readLine().equals("File not found - Z:\\\\")) {
    		System.out.println("Password: "+password);
    		System.exit(1);
    	}
    } catch (IOException e) {
    	e.printStackTrace();
    } catch (NullPointerException e) {
    	e.printStackTrace();
    }

  4. #3
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Java + Truecrypt + Windows

    Well I think I found a decent way to do it so I will go ahead and run it. I am moving tonight. So I will be gone for a few days until I get a computer setup.

    Later!

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Java calling Windows COM DLL's
    By gregwarner in forum Java Help
    Replies: 4
    Last Post: 06-03-2011, 10:18 AM
  2. C++ Brutefocing Truecrypt
    By BlaineSch in forum Member Software/Projects
    Replies: 40
    Last Post: 05-30-2010, 12:17 PM
  3. Replies: 4
    Last Post: 08-05-2009, 08:32 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts