From dea524a87bb73c69cac73d0d9fae2e85f5b96374 Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Fri, 22 May 2015 16:41:26 +0400 Subject: [PATCH 1/2] ajout du mode batch --- upassword | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/upassword b/upassword index 5105cb2..6c4a8f6 100755 --- a/upassword +++ b/upassword @@ -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,9 +4775,12 @@ public class upassword { "yYjWpZXP2EMWp7VZR+0xPA=="}; private static final void unlockEtuPasswordGroups(String skey) throws Exception { - 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); + 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; } } @@ -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); + } } } From 3b86fbd88d109240cbe49a8e39ab52d82afe30fe Mon Sep 17 00:00:00 2001 From: Jephte CLAIN Date: Fri, 22 May 2015 16:41:56 +0400 Subject: [PATCH 2/2] Init changelog & version 1.14.0 --- CHANGES.txt | 5 +++++ VERSION.txt | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index d1bf764..0af303e 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 275bff8 Intégration de la branche update-upassword diff --git a/VERSION.txt b/VERSION.txt index feaae22..850e742 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -1.13.0 +1.14.0