Intégration de la branche update-upassword

This commit is contained in:
Jephté Clain 2015-05-22 16:41:32 +04:00
commit d8f20c353d
1 changed files with 39 additions and 5 deletions

View File

@ -4,9 +4,12 @@ compiler=javac
mainClass=upassword
compileAndGo
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
@ -4758,6 +4761,8 @@ public class upassword {
return Pattern.matches("\\d{8}", codEtu);
}
private static boolean ETU_PASSWORD_GROUPS_LOCKED = true;
private static final String[] ETU_PASSWORD_GROUPS = new String[] {
//
"jiPV/09lHKI1uz+a9vUpX0yMUIy9YAeIwfHPXoA81ik=",
@ -4770,10 +4775,13 @@ public class upassword {
"yYjWpZXP2EMWp7VZR+0xPA=="};
private static final void unlockEtuPasswordGroups(String skey) throws Exception {
if (ETU_PASSWORD_GROUPS_LOCKED) {
byte[] key = AESEnc.getKey(skey);
for (int i = 0; i < ETU_PASSWORD_GROUPS.length; i++) {
ETU_PASSWORD_GROUPS[i] = AESEnc.sdecrypt(ETU_PASSWORD_GROUPS[i], key);
}
ETU_PASSWORD_GROUPS_LOCKED = false;
}
}
private static final String getEtuPassword(String codEtu) {
@ -4820,7 +4828,7 @@ public class upassword {
+ "\n avec les options -G, -s, -e et -d"
+ "\n --shell"
+ "\n Afficher les valeurs pour évaluation par le shell");
System.exit(0);
return;
}
EAction action = EAction.HASH_PASSWORD;
@ -5081,7 +5089,33 @@ public class upassword {
}
}
private static final Pattern SPACES = Pattern.compile("\\s+");
public static void main(String[] args) {
new upassword().run(args);
upassword upassword = new upassword();
if (args.length > 0 && args[0].equals("--batch")) {
StringBuilder sb = new StringBuilder();
for (int i = 1; i < args.length; i++) {
if (i > 1) sb.append(" ");
sb.append(args[i]);
}
String after = sb.toString();
if (after.length() == 0) after = null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
try {
while (true) {
String line = br.readLine();
if (line == null) break;
upassword.run(SPACES.split(line));
if (after != null) println(after);
}
} catch (IOException e) {
die(null, e);
}
} else {
upassword.run(args);
}
}
}