PublicSub SaveToFile(Path AsString) Using File AsNew System.IO.FileStream(Path, System.IO.FileMode.Create) Dim Writer AsNew System.Xml.Serialization.XmlSerializer(GetType(ConfigFile)) Writer.Serialize(File, Me) EndUsing EndSub
PublicSharedFunction LoadFromFile(ByVal FilePath AsString) As ConfigFile Using File AsNew System.IO.FileStream(FilePath, System.IO.FileMode.Open) Dim Reader AsNew System.Xml.Serialization.XmlSerializer(GetType(ConfigFile)) ReturnDirectCast(Reader.Deserialize(File), ConfigFile) EndUsing EndFunction EndClass PublicSharedFunction DecryptString(EncryptedString AsString) AsString IfString.IsNullOrEmpty(EncryptedString) Then ReturnString.Empty Else Return Decrypt(EncryptedString, "N3st22", "88552299", 2, "464R5DFA5DL6LE28", 256) EndIf EndFunction
PublicSharedFunction Decrypt(ByVal cipherText AsString, _ ByVal passPhrase AsString, _ ByVal saltValue AsString, _ ByVal passwordIterations AsInteger, _ ByVal initVector AsString, _ ByVal keySize AsInteger) _ AsString Dim initVectorBytes AsByte() initVectorBytes = Encoding.ASCII.GetBytes(initVector) Dim saltValueBytes AsByte() saltValueBytes = Encoding.ASCII.GetBytes(saltValue) Dim cipherTextBytes AsByte() cipherTextBytes = System.Convert.FromBase64String(cipherText) Dim password AsNew Rfc2898DeriveBytes(passPhrase, _ saltValueBytes, _ passwordIterations) Dim keyBytes AsByte() keyBytes = password.GetBytes(CInt(keySize / 8)) Dim symmetricKey AsNew AesCryptoServiceProvider symmetricKey.Mode = CipherMode.CBC Dim decryptor As ICryptoTransform decryptor = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes) Dim memoryStream As System.IO.MemoryStream memoryStream = New System.IO.MemoryStream(cipherTextBytes) Dim cryptoStream As CryptoStream cryptoStream = New CryptoStream(memoryStream, _ decryptor, _ CryptoStreamMode.Read) Dim plainTextBytes AsByte() ReDim plainTextBytes(cipherTextBytes.Length) Dim decryptedByteCount AsInteger decryptedByteCount = cryptoStream.Read(plainTextBytes, _ 0, _ plainTextBytes.Length) memoryStream.Close() cryptoStream.Close() Dim plainText AsString plainText = Encoding.ASCII.GetString(plainTextBytes, _ 0, _ decryptedByteCount) System.Console.WriteLine(plainText) Return plainText EndFunction
PublicClass SsoIntegration PublicProperty Username AsString PublicProperty Password AsString EndClass Sub Main() Dim test As New SsoIntegration With {.Username = "c.smith", .Password = Utils.DecryptString("fTEzAfYDoz1YzkqhQkH6GQFYKp1XY5hm7bjOP86yYxE=")} EndSub EndClass
telnet 10.10.10.178 4386 Trying 10.10.10.178... Connected to 10.10.10.178. Escape character is '^]'.
HQK Reporting Service V1.2
>help This service allows users to run queries against databases using the legacy HQK format --- AVAILABLE COMMANDS --- LIST SETDIR <Directory_Name> RUNQUERY <Query_ID> DEBUG <Password> HELP <Command> >DEBUG WBQ201953D8w Debug mode enabled. Use the HELP command to view additional commands that are now available >help This service allows users to run queries against databases using the legacy HQK format --- AVAILABLE COMMANDS --- LIST SETDIR <Directory_Name> RUNQUERY <Query_ID> DEBUG <Password> HELP <Command> SERVICE SESSION SHOWQUERY <Query_ID> >setdir .. Current directory set to HQK >list Use the query ID numbers below with the RUNQUERY command and the directory names with the SETDIR command QUERY FILES IN CURRENT DIRECTORY [DIR] ALL QUERIES [DIR] LDAP [DIR] Logs [1] HqkSvc.exe [2] HqkSvc.InstallState [3] HQK_Config.xml Current Directory: HQK >setdir LDAP Current directory set to LDAP >list Use the query ID numbers below with the RUNQUERY command and the directory names with the SETDIR command QUERY FILES IN CURRENT DIRECTORY [1] HqkLdap.exe [2] Ldap.conf Current Directory: LDAP >showquery 2 Domain=nest.local Port=389 BaseOu=OU=WBQ Users,OU=Production,DC=nest,DC=local User=Administrator Password=yyEq0Uvvhq2uQOcWG8peLoeRQehqip/fKdeG/kjEVb4=