/// <summary> /// Format the Authentication Token. /// </summary> /// <returns>The Formatted Token.</returns> public override string Format() { StringBuilder builder = new StringBuilder(); builder.AppendLine($"<KerberosV{ProtocolVersion} {MessageType}>"); if (!string.IsNullOrEmpty(ClientTime)) { builder.AppendLine($"Client Time : {KerberosUtils.ParseKerberosTime(ClientTime, ClientUSec)}"); } if (!string.IsNullOrEmpty(ClientRealm)) { builder.AppendLine($"Client Realm : {ClientRealm}"); builder.AppendLine($"Client Name : {ClientName}"); } builder.AppendLine($"Server Time : {KerberosUtils.ParseKerberosTime(ServerTime, ServerUSec)}"); builder.AppendLine($"Server Realm : {ServerRealm}"); builder.AppendLine($"Server Name : {ServerName}"); builder.AppendLine($"Error Code : {ErrorCode}"); if (!string.IsNullOrEmpty(ErrorText)) { builder.AppendLine($"Error Text : {ErrorText}"); } if (ErrorData.Length > 0) { builder.AppendLine($"Error Data :"); HexDumpBuilder hex = new HexDumpBuilder(); hex.Append(ErrorData); hex.Complete(); builder.Append(hex); } return(builder.ToString()); }
private protected virtual void FormatData(StringBuilder builder) { HexDumpBuilder hex = new HexDumpBuilder(false, false, true, false, 0); hex.Append(Data); hex.Complete(); builder.AppendLine(hex.ToString()); }
/// <summary> /// Format the authentication token. /// </summary> /// <returns>The token as a formatted string.</returns> public virtual string Format() { if (_data.Length == 0) { return(string.Empty); } HexDumpBuilder builder = new HexDumpBuilder(true, true, true, false, 0); builder.Append(_data); builder.Complete(); return(builder.ToString()); }
internal static void DumpBuffer(bool transport, string title, byte[] buffer) { if (!CheckSwitch(transport)) { return; } Trace.WriteLine($"{title}:"); HexDumpBuilder builder = new HexDumpBuilder(true, true, true, true, 0); builder.Append(buffer); builder.Complete(); Trace.WriteLine(builder.ToString()); }
internal string Format() { StringBuilder builder = new StringBuilder(); builder.AppendLine($"Encryption Type : {EncryptionType}"); builder.AppendLine($"Key Version : {KeyVersion}"); HexDumpBuilder hex = new HexDumpBuilder(false, true, false, false, 0); hex.Append(CipherText); hex.Complete(); builder.AppendLine($"Cipher Text :"); builder.Append(hex); return(builder.ToString()); }
internal string Format() { StringBuilder builder = new StringBuilder(); builder.AppendLine($"Ticket Version : {TicketVersion}"); builder.AppendLine($"ServerName : {ServerName}"); builder.AppendLine($"Realm : {Realm}"); builder.AppendLine($"Encryption Type : {EncryptedData.EncryptionType}"); builder.AppendLine($"Key Version : {EncryptedData.KeyVersion}"); HexDumpBuilder hex = new HexDumpBuilder(false, true, false, false, 0); hex.Append(EncryptedData.CipherText); hex.Complete(); builder.AppendLine($"Cipher Text :"); builder.Append(hex); return(builder.ToString()); }
internal override void Format(StringBuilder builder) { builder.AppendLine("Checksum : GSSAPI"); builder.AppendLine($"Channel Binding : {NtObjectUtils.ToHexString(ChannelBinding)}"); builder.AppendLine($"Context Flags : {ContextFlags}"); if (Credentials != null) { builder.AppendLine($"Delegate Opt ID : {DelegationOptionIdentifier}"); builder.AppendLine(Credentials.Format()); } if (Extensions != null) { HexDumpBuilder hex = new HexDumpBuilder(false, true, true, false, 0); hex.Append(Extensions); hex.Complete(); builder.AppendLine(hex.ToString()); } }
/// <summary> /// Format the authentication token. /// </summary> /// <returns>The token as a formatted string.</returns> public override string Format() { StringBuilder builder = new StringBuilder(); int index = 0; foreach (var record in Records) { builder.AppendLine($"SChannel Record {index++}"); builder.AppendLine($"Type : {record.Type}"); builder.AppendLine($"Version: {record.Version}"); builder.AppendLine("Data :"); HexDumpBuilder hex_builder = new HexDumpBuilder(true, true, true, false, 0); hex_builder.Append(record.Data); hex_builder.Complete(); builder.AppendLine(hex_builder.ToString()); } return(builder.ToString()); }
static void Main(string[] args) { try { if (args.Length < 1) { return; } EnablePrivileges(); using (var dir = OpenReparseDirectory(args[0])) { using (var buffer = new SafeStructureInOutBuffer <FileReparseTagInformation>()) { using (var io_status = new SafeIoStatusBuffer()) { while (true) { NtStatus status = NtSystemCalls.NtQueryDirectoryFile(dir.Handle, SafeKernelObjectHandle.Null, IntPtr.Zero, IntPtr.Zero, io_status, buffer, buffer.Length, FileInformationClass.FileReparsePointInformation, true, null, false); if (status == NtStatus.STATUS_NO_MORE_FILES) { break; } if (status != NtStatus.STATUS_SUCCESS) { throw new NtException(status); } var result = buffer.Result; var filedata = GetFileData(dir, result.Tag, result.FileReferenceNumber); Console.WriteLine("{0} {1}", filedata.FileName, filedata.Reparse.Tag); if (filedata.Reparse is MountPointReparseBuffer mount_point) { Console.WriteLine("Target: {0}", mount_point.SubstitutionName); Console.WriteLine("Print: {0}", mount_point.PrintName); } else if (filedata.Reparse is SymlinkReparseBuffer symlink) { Console.WriteLine("Target: {0}", symlink.SubstitutionName); Console.WriteLine("Print: {0}", symlink.PrintName); Console.WriteLine("Flags: {0}", symlink.Flags); } else if (filedata.Reparse is ExecutionAliasReparseBuffer alias) { Console.WriteLine("Target: {0}", alias.Target); Console.WriteLine("Package: {0}", alias.PackageName); Console.WriteLine("Entry Point: {0}", alias.EntryPoint); Console.WriteLine("AppType: {0}", alias.AppType); } else if (filedata.Reparse is OpaqueReparseBuffer opaque) { HexDumpBuilder builder = new HexDumpBuilder(true, true, true, false, 0); builder.Append(opaque.Data); Console.WriteLine(builder); } } } } } } catch (Exception ex) { Console.WriteLine(ex); } }