| | |
| | | import java.io.Console; |
| | | import java.io.File; |
| | | import java.lang.instrument.Instrumentation; |
| | | import java.nio.charset.Charset; |
| | | |
| | | |
| | | /** |
| | |
| | | char[] pwd; |
| | | |
| | | //读取jar隐藏的密码,无密码启动模式(jar) |
| | | pwd = JarDecryptor.readPassFromJar(new File(JarUtils.getRootPath(null))); |
| | | //pwd = JarDecryptor.readPassFromJar(new File(JarUtils.getRootPath(null))); |
| | | pwd = JarDecryptor.readPassFromJar2(new File(JarUtils.getRootPath(null))); |
| | | |
| | | if (args != null) { |
| | | options.parse(args.split(" ")); |
| | |
| | | } |
| | | |
| | | //验证密码,jar包是才验证 |
| | | byte[] passHash = JarDecryptor.readEncryptedFile(new File(JarUtils.getRootPath(null)), Const.CONFIG_PASSHASH); |
| | | /*System.out.println("验证jar,密码路径"+JarUtils.getRootPath(null)); |
| | | byte[] passHash = JarDecryptor.readEncryptedFile2(new File(JarUtils.getRootPath(null)),Const.FILE_NAME2); |
| | | if (passHash != null) { |
| | | char[] p1 = StrUtils.toChars(passHash); |
| | | char[] p1 = StrUtils.merger(pwd, EncryptUtils.SALT); |
| | | char[] p2 = EncryptUtils.md5(StrUtils.merger(pwd, EncryptUtils.SALT)); |
| | | p2 = EncryptUtils.md5(StrUtils.merger(EncryptUtils.SALT, p2)); |
| | | if (!StrUtils.equal(p1, p2)) { |
| | | Log.println("\nERROR: Startup failed, invalid password.\n"); |
| | | System.exit(0); |
| | | } |
| | | }*/ |
| | | byte[] pwdHash = JarDecryptor.readEncryptedFile2(new File(JarUtils.getRootPath(null)),Const.FILE_NAME2); |
| | | if (pwdHash != null) { |
| | | String pwdTrue = EncryptUtils.deAES(new String(pwdHash, Charset.forName("utf-8")), Const.AES_KEY.toCharArray()); |
| | | pwdTrue = pwdTrue.replace(" ","").replace(",","").replace("[","").replace("]",""); |
| | | pwd = pwdTrue.toCharArray(); |
| | | } |
| | | |
| | | //GO |
| | |
| | | } |
| | | return pwd; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | char[] chars = JarDecryptor.readPassFromJar(new File(JarUtils.getRootPath(null))); |
| | | } |
| | | } |