- Registriert
- 03.08.10
- Beiträge
- 18
Hallo Kollegen,
ich habe einmal eine wichtige Frage.
Ich habe auf meinem MacBook mehrere TrueCrypt Container, die mit einem Passwort geschützt jedes mal bei Systemstart gemountet werden müssen.
Nun ist es mühsam jedes mal das Passwort einzugeben.
Also dachte ich programmier ich mir was mit Java.
Ich hatte es mir so vorgestellt, dass ich am Anfang im TextFeld das Passwort abfrage und dies dann per Variable an den Terminal Code anhänge.
Nur musste man dazu ja das Kennwort irgendwie in den "Passwort Abfrage Dialog" Eintragen.
Unter Windows ging das mit nem angehängten Suffix nur unter Mac OS bekomme ich es nicht hin.
Ich weiß, dass ich ein "-p" bzw. ein "--password" anhängen müsste nur wie trage ich dann das Kennwort ein?
--passwort="Kennwort" funktioniert nicht. und das ganze ohne Anführungszeichen auch nicht.
Momentan sieht mein Java Code so aus:
Die Oberfläche so: http://img21.imageshack.us/img21/9573/bildschirmfoto20100815u.png
Variable deklariert...alles geht nur wie ergänze ich die Variable in dem Bereich der Anführungszeichen?
Vielleicht so:
Runtime.getRuntime.exec("mount..blabla -p "+Variable" )
?
Ich wäre euch sehr sehr dankbar für Hilfe !
Sollte ich in der Forumssuche etwas übersehen haben entschuldige ich mich aber ich meine das was ich genau suche hatte ich dort nicht gefunden.
Christian
ich habe einmal eine wichtige Frage.
Ich habe auf meinem MacBook mehrere TrueCrypt Container, die mit einem Passwort geschützt jedes mal bei Systemstart gemountet werden müssen.
Nun ist es mühsam jedes mal das Passwort einzugeben.
Also dachte ich programmier ich mir was mit Java.
Ich hatte es mir so vorgestellt, dass ich am Anfang im TextFeld das Passwort abfrage und dies dann per Variable an den Terminal Code anhänge.
Nur musste man dazu ja das Kennwort irgendwie in den "Passwort Abfrage Dialog" Eintragen.
Unter Windows ging das mit nem angehängten Suffix nur unter Mac OS bekomme ich es nicht hin.
Ich weiß, dass ich ein "-p" bzw. ein "--password" anhängen müsste nur wie trage ich dann das Kennwort ein?
--passwort="Kennwort" funktioniert nicht. und das ganze ohne Anführungszeichen auch nicht.
Momentan sieht mein Java Code so aus:
Code:
/*open.java
*
* Created on 15.08.2010, 11:34:28
*/
package open;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author Christian
*/
public class open extends javax.swing.JFrame {
String passwort ="";
/** Creates new form open */
public open() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton3 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("Mount");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("Dismount");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel1.setText("Input TrueCrypt Password");
jTextField1.setText(" ");
jTextField1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
jTextField1KeyPressed(evt);
}
});
jButton3.setText("OK");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(123, 123, 123)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(24, 24, 24)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton3))
.add(jLabel1)
.add(jButton2)
.add(jButton1))
.addContainerGap(80, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(jButton3))
.add(15, 15, 15)
.add(jButton1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jButton2)
.addContainerGap(149, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try {
initComponents();
Runtime.getRuntime().exec("/Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt /users/christian/**/truecryptvolume.tc --explore");
} catch (IOException ex) {
Logger.getLogger(open.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
try {
// TODO add your handling code here:
Runtime.getRuntime().exec("/Applications/TrueCrypt.app/Contents/MacOS/TrueCrypt /users/christian/**/truecryptvolume.tc -d");
} catch (IOException ex) {
Logger.getLogger(open.class.getName()).log(Level.SEVERE, null, ex);
}
}
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jTextField1KeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
passwort=jTextField1.getText();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new open().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JTextField jTextField1;
// End of variables declaration
}
Die Oberfläche so: http://img21.imageshack.us/img21/9573/bildschirmfoto20100815u.png
Variable deklariert...alles geht nur wie ergänze ich die Variable in dem Bereich der Anführungszeichen?
Vielleicht so:
Runtime.getRuntime.exec("mount..blabla -p "+Variable" )
?
Ich wäre euch sehr sehr dankbar für Hilfe !
Sollte ich in der Forumssuche etwas übersehen haben entschuldige ich mich aber ich meine das was ich genau suche hatte ich dort nicht gefunden.
Christian