Intégration de la branche release-1.14.0

This commit is contained in:
Jephté Clain 2015-05-22 16:41:56 +04:00
commit 6b979d5a0c
3 changed files with 45 additions and 6 deletions

View File

@ -1,3 +1,8 @@
## Version 1.14.0 du 22/05/2015-16:41
d8f20c3 Intégration de la branche update-upassword
dea524a ajout du mode batch
## Version 1.13.0 du 22/05/2015-16:04 ## Version 1.13.0 du 22/05/2015-16:04
275bff8 Intégration de la branche update-upassword 275bff8 Intégration de la branche update-upassword

View File

@ -1 +1 @@
1.13.0 1.14.0

View File

@ -4,9 +4,12 @@ compiler=javac
mainClass=upassword mainClass=upassword
compileAndGo compileAndGo
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -4758,6 +4761,8 @@ public class upassword {
return Pattern.matches("\\d{8}", codEtu); return Pattern.matches("\\d{8}", codEtu);
} }
private static boolean ETU_PASSWORD_GROUPS_LOCKED = true;
private static final String[] ETU_PASSWORD_GROUPS = new String[] { private static final String[] ETU_PASSWORD_GROUPS = new String[] {
// //
"jiPV/09lHKI1uz+a9vUpX0yMUIy9YAeIwfHPXoA81ik=", "jiPV/09lHKI1uz+a9vUpX0yMUIy9YAeIwfHPXoA81ik=",
@ -4770,10 +4775,13 @@ public class upassword {
"yYjWpZXP2EMWp7VZR+0xPA=="}; "yYjWpZXP2EMWp7VZR+0xPA=="};
private static final void unlockEtuPasswordGroups(String skey) throws Exception { private static final void unlockEtuPasswordGroups(String skey) throws Exception {
if (ETU_PASSWORD_GROUPS_LOCKED) {
byte[] key = AESEnc.getKey(skey); byte[] key = AESEnc.getKey(skey);
for (int i = 0; i < ETU_PASSWORD_GROUPS.length; i++) { for (int i = 0; i < ETU_PASSWORD_GROUPS.length; i++) {
ETU_PASSWORD_GROUPS[i] = AESEnc.sdecrypt(ETU_PASSWORD_GROUPS[i], key); ETU_PASSWORD_GROUPS[i] = AESEnc.sdecrypt(ETU_PASSWORD_GROUPS[i], key);
} }
ETU_PASSWORD_GROUPS_LOCKED = false;
}
} }
private static final String getEtuPassword(String codEtu) { private static final String getEtuPassword(String codEtu) {
@ -4820,7 +4828,7 @@ public class upassword {
+ "\n avec les options -G, -s, -e et -d" + "\n avec les options -G, -s, -e et -d"
+ "\n --shell" + "\n --shell"
+ "\n Afficher les valeurs pour évaluation par le shell"); + "\n Afficher les valeurs pour évaluation par le shell");
System.exit(0); return;
} }
EAction action = EAction.HASH_PASSWORD; 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) { 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);
}
} }
} }