├── src ├── net │ ├── Titanis.Socks │ │ ├── References.txt │ │ ├── ISocks5Callback.cs │ │ ├── SocksResultCode.cs │ │ └── Titanis.Socks.csproj │ ├── msrpc │ │ ├── Titanis.Msrpc.Msdcom │ │ │ ├── References.txt │ │ │ ├── ICustomDcomMarshal.cs │ │ │ └── IUnmarshaler.cs │ │ ├── Titanis.Msrpc.Mswmi │ │ │ ├── References.txt │ │ │ ├── Problems.txt │ │ │ ├── Wmio │ │ │ │ ├── Decoration.cs │ │ │ │ ├── CountedEncodingBlock.cs │ │ │ │ ├── EncodingUnitSignature.cs │ │ │ │ ├── PropertyLookupTable.cs │ │ │ │ └── PropertyInfo.cs │ │ │ └── WmiReference.cs │ │ ├── Titanis.Msrpc.Msscmr.Core │ │ │ ├── ServiceTriggerAction.cs │ │ │ ├── ServiceErrorControl.cs │ │ │ ├── ServiceStates.cs │ │ │ ├── ServiceStartType.cs │ │ │ ├── ServiceState.cs │ │ │ ├── ScmAccess.cs │ │ │ ├── ServiceType.cs │ │ │ ├── ServiceFailureAction.cs │ │ │ ├── Titanis.Msrpc.Msscmr.Core.csproj │ │ │ ├── ServiceTriggerType.cs │ │ │ ├── ServiceAccess.cs │ │ │ ├── ServiceControl.cs │ │ │ └── ServiceControls.cs │ │ ├── Titanis.Msrpc.Mssrvs │ │ │ ├── SharePermissions.cs │ │ │ ├── ShareType.cs │ │ │ └── OpenFileInfo.cs │ │ ├── Titanis.Msrpc.Msscmr │ │ │ ├── ServiceReader.cs │ │ │ ├── ScmLockStatus.cs │ │ │ ├── ServiceFailureActions.cs │ │ │ ├── ScmLock.cs │ │ │ ├── ServiceRpcObjectBase.cs │ │ │ ├── Security │ │ │ │ ├── ServiceAuditRule.cs │ │ │ │ └── ServiceAccessRule.cs │ │ │ ├── ServiceConfig.cs │ │ │ └── EnumServiceStatusInfo.cs │ │ ├── Titanis.Msrpc.Msdfsnm │ │ │ └── DfsnmClient.cs │ │ ├── Titanis.Msrpc.Mslsar │ │ │ ├── LsaNameType.cs │ │ │ ├── UserRightInfo.cs │ │ │ ├── SecretInfo.cs │ │ │ ├── DomainInfo.cs │ │ │ ├── AuditLogInfo.cs │ │ │ ├── LsaSecret.cs │ │ │ ├── LsaAccountMapping.cs │ │ │ ├── SystemAccessRights.cs │ │ │ └── PolicySystemAccessMode.cs │ │ └── Titanis.Msrpc.Mssamr │ │ │ ├── SamMemberInfo.cs │ │ │ ├── SamDomainLogoffInfo.cs │ │ │ ├── SamUserHomeInfo.cs │ │ │ ├── SamDomainModifiedInfo.cs │ │ │ ├── SamUserPreferencesInfo.cs │ │ │ ├── SamAliasGeneralInfo.cs │ │ │ ├── SamDomainModifiedInfo2.cs │ │ │ ├── SamGroupGeneralInfo.cs │ │ │ ├── SamDomainGeneralInfo2.cs │ │ │ └── SamUserGeneralInfo.cs │ ├── Titanis.Smb2 │ │ ├── References.txt │ │ ├── HashAlgorithmId.cs │ │ ├── Smb2ShareType.cs │ │ ├── CompressionCaps.cs │ │ ├── RdmaTransformId.cs │ │ ├── Smb2CloseOptions.cs │ │ ├── SigningAlgorithm.cs │ │ ├── Smb2ReadOptions.cs │ │ ├── Smb2WriteOptions.cs │ │ ├── CompressionAlgorithm.cs │ │ ├── Smb2OplockLevel.cs │ │ ├── Smb2ImpersonationLevel.cs │ │ ├── PreauthHashAlgorithm.cs │ │ ├── Smb2SecurityMode.cs │ │ ├── Smb2ShareCaps.cs │ │ ├── Smb2SessionOptions.cs │ │ ├── Smb2ShareOptions.cs │ │ ├── Smb2Dialect.cs │ │ ├── Pdus │ │ │ ├── Smb2PduFlags.cs │ │ │ ├── Smb2Command.cs │ │ │ ├── Smb2PduAsyncHeader.cs │ │ │ ├── Smb2TreeDisconnectRequest.cs │ │ │ └── Smb2TreeDisconnectResponse.cs │ │ ├── Smb2ShareAccess.cs │ │ ├── Smb2OpenFileAttributes.cs │ │ ├── Smb2ChangeFilter.cs │ │ ├── Cipher.cs │ │ ├── FileStreamInfo.cs │ │ ├── ISmbOptionsService.cs │ │ ├── Smb2ShareFlags.cs │ │ ├── CopyChunk.cs │ │ ├── Smb2Priority.cs │ │ ├── ResumeKey.cs │ │ ├── ISmb2ConnectionOwner.cs │ │ ├── Smb2SymlinkLoopException.cs │ │ ├── Smb2NicInfo.cs │ │ ├── Smb2FileHandle.cs │ │ └── Smb2DirectoryAccessRights.cs │ ├── Titanis.DceRpc.Core │ │ ├── References.txt │ │ ├── IRpcObject.cs │ │ ├── IRpcFixedStruct.cs │ │ ├── IRpcObjectProxy.cs │ │ ├── IRpcClientProxy.cs │ │ ├── MaybeAttribute.cs │ │ ├── RpcContextHandle.cs │ │ ├── BroadcastAttribute.cs │ │ ├── IdempotentAttribute.cs │ │ ├── RpcPointerType.cs │ │ ├── ReflectDeletionsAttribute.cs │ │ ├── Client │ │ │ └── IRpcRequestBuilder.cs │ │ ├── RpcAuthLevel.cs │ │ ├── NdrContextHandle.cs │ │ ├── RpcAuthType.cs │ │ ├── IRpcStruct.cs │ │ ├── Server │ │ │ └── OperationImplFunc.cs │ │ ├── RpcVersionAttribute.cs │ │ └── RpcPointer.cs │ ├── Titanis.X11 │ │ ├── References.txt │ │ └── Titanis.X11.csproj │ ├── Titanis.Ssh │ │ ├── References.txt │ │ ├── SshString.cs │ │ ├── Titanis.Ssh.csproj │ │ └── SshPacket.cs │ ├── Titanis.DceRpc │ │ ├── Client │ │ │ ├── OrpcInfo.cs │ │ │ └── IEndpointMapper.cs │ │ ├── AssemblyInfo.cs │ │ ├── WireProtocol │ │ │ ├── RpcFaultCode.cs │ │ │ ├── ContextDefResult.cs │ │ │ ├── ProviderReason.cs │ │ │ ├── PortAny.cs │ │ │ ├── PortAnyHeader.cs │ │ │ ├── FaultPdu.cs │ │ │ ├── BindNakPdu.cs │ │ │ ├── ResponsePdu.cs │ │ │ ├── BindAckPduHeader.cs │ │ │ ├── PfcFlags.cs │ │ │ ├── RequestPdu.cs │ │ │ ├── BindNakPduHeader.cs │ │ │ ├── BindPdu.cs │ │ │ ├── ContextResultListHeader.cs │ │ │ ├── BindRejectReason.cs │ │ │ ├── BindAckPdu.cs │ │ │ ├── RequestPduHeader.cs │ │ │ ├── PduType.cs │ │ │ ├── ResponsePduHeader.cs │ │ │ ├── FaultPduHeader.cs │ │ │ ├── PresContext.cs │ │ │ ├── BindPduHeader.cs │ │ │ └── PduHeader.cs │ │ ├── RpcString.cs │ │ ├── RpcStateMachine.cs │ │ ├── RpcAssocGroup.cs │ │ ├── Tracing │ │ │ ├── RpcTraceTransport.cs │ │ │ └── RpcTraceChannel.cs │ │ ├── IRpcCallback.cs │ │ ├── COMVERSION.cs │ │ └── Communication │ │ │ └── PduFragGroup.cs │ ├── Titanis.Dbus │ │ └── Titanis.Dbus.csproj │ ├── Titanis.Msrpc.Core │ │ └── GenericAccessRights.cs │ └── Titanis.DceRpc.Ndr │ │ └── RpcReaderExtensions.cs ├── base │ ├── Titanis.Core │ │ ├── References.txt │ │ ├── DisplayAlignment.cs │ │ ├── IHaveErrorCode.cs │ │ ├── INamedObject.cs │ │ ├── compat │ │ │ ├── MaybeNullAttribute.cs │ │ │ ├── NullableAttributes.cs │ │ │ ├── ArraySegmentExtensions.cs │ │ │ ├── CallerArgumentExpressionAttribute.cs │ │ │ └── ArrayHelper.cs │ │ ├── FileSizeAttribute.cs │ │ ├── LogFormat.cs │ │ ├── AttributeExtensions.cs │ │ ├── Documentation │ │ │ └── SpecTypes.cs │ │ ├── Singleton.cs │ │ ├── Enumerable.cs │ │ └── StringHelper.cs │ ├── Titanis.Winterop.ErrorCodes │ │ └── References.txt │ ├── Titanis.Winterop.FileInfo │ │ ├── References.txt │ │ ├── VolumeInfo.cs │ │ ├── FileAttributes.cs │ │ └── Titanis.Winterop.FileInfo.csproj │ ├── Titanis.Dynamic │ │ ├── IStubHandler.cs │ │ ├── IStub.cs │ │ ├── AssemblyGenerator.cs │ │ ├── StubGenerateParams.cs │ │ └── MethodDeclInfo.cs │ ├── Titanis.Winterop.Security │ │ ├── Titanis.Winterop.Security.csproj │ │ ├── StandardAccessRights.cs │ │ └── SecurityInfo.cs │ ├── Titanis.Cli │ │ ├── OutputStyle.cs │ │ ├── IValidateParameters.cs │ │ ├── MandatoryAttribute.cs │ │ ├── IOutputFormatter.cs │ │ ├── CommandAttribute.cs │ │ ├── CommandFrame.cs │ │ ├── SubcommandAttribute.cs │ │ ├── IDocWriter.cs │ │ ├── ITerminal.cs │ │ ├── IParameterGroup.cs │ │ ├── ExampleAttribute.cs │ │ ├── ParameterCategories.cs │ │ ├── PlaceholderAttribute.cs │ │ ├── EnumNameListAttribute.cs │ │ ├── FieldListProvider.cs │ │ └── AliasAttribute.cs │ ├── Titanis.PduStruct │ │ ├── PduParameterAttribute.cs │ │ ├── PduIgnoreAttribute.cs │ │ ├── PduPositionAttribute.cs │ │ ├── PduByteOrder.cs │ │ ├── PduFieldAttribute.cs │ │ ├── PduAlignmentAttribute.cs │ │ ├── PduArgumentsAttribute.cs │ │ ├── PduStructAttribute.cs │ │ ├── PduConditionalAttribute.cs │ │ └── PduStringAttribute.cs │ ├── Titanis.Cli.Workflow │ │ └── Titanis.Cli.Workflow.csproj │ ├── Titanis.Mocks │ │ ├── Arg.cs │ │ ├── IExpect.cs │ │ └── Titanis.Mocks.csproj │ ├── Titanis.IO │ │ ├── BufferUnderflowException.cs │ │ ├── IHaveStreamPosition.cs │ │ └── AsyncStream.cs │ ├── Titanis.Reflection.Emit │ │ └── Titanis.Reflection.Emit.csproj │ └── Titanis.Reflection │ │ └── Titanis.Reflection.csproj ├── security │ ├── Titanis.Security.Ntlm │ │ ├── LMSecret.txt │ │ ├── INtlmAuthStore.cs │ │ ├── AuthenticationException.cs │ │ ├── NtlmTraceContext.cs │ │ ├── NtlmNegotiateMessage.cs │ │ ├── NtlmChallenge.cs │ │ ├── NtlmExchange.cs │ │ └── NtlmFeaturesUnsupportedException.cs │ ├── Titanis.Security │ │ ├── References.txt │ │ ├── AuthServerContext.cs │ │ ├── AuthTraceContext.cs │ │ └── PrincipalNameType.cs │ ├── Titanis.Security.Kerberos │ │ ├── AssemblyInfo.cs │ │ ├── KeyIntent.cs │ │ ├── AuthzDataType.cs │ │ ├── ICryptHandler.cs │ │ ├── APOptions.cs │ │ ├── AddressType.cs │ │ ├── GssChannelBinding.cs │ │ ├── KrbMessageType.cs │ │ ├── PacOptions.cs │ │ ├── PacBufferType.cs │ │ ├── EncChecksumType.cs │ │ ├── EType.cs │ │ ├── KdcInfo.cs │ │ └── IKdcLocator.cs │ ├── Titanis.Security.Spnego │ │ └── References.txt │ ├── Titanis.NFold │ │ └── Titanis.NFold.csproj │ └── Titanis.Certificates │ │ └── Titanis.Certificates.csproj ├── interop │ └── Titanis.Windows.Interop │ │ ├── NativeMethods.txt │ │ └── Titanis.Windows.Interop.csproj ├── formats │ ├── Titanis.Cdrom │ │ └── CdromImage.cs │ └── Titanis.Asn1 │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Serialization │ │ ├── IAsn1EncoderCallback.cs │ │ ├── IAsn1DerEncodable.cs │ │ ├── Asn1Encoding.cs │ │ └── IAsn1DerEncodableTlv.cs │ │ ├── Metadata │ │ ├── IModuleVisitor.cs │ │ ├── Asn1ConstructedType.cs │ │ ├── Asn1TypeKind.cs │ │ ├── Asn1Constraint.cs │ │ ├── Asn1ValueSetConstraint.cs │ │ ├── ITypeVisitor.cs │ │ ├── Asn1ContainedSubtypeConstraint.cs │ │ ├── Asn1NamedBit.cs │ │ ├── Asn1Enumeration.cs │ │ ├── Asn1NamedNumber.cs │ │ ├── Asn1IntersectionConstraint.cs │ │ ├── Asn1WithComponentsConstraint.cs │ │ ├── Asn1SizeConstraint.cs │ │ ├── Asn1ValueRange.cs │ │ ├── Asn1PrimitiveTypeBase.cs │ │ └── Asn1UnresolvedType.cs │ │ ├── IAsn1Tag.cs │ │ ├── Asn1TagMode.cs │ │ ├── References.txt │ │ ├── compat │ │ └── NumericExtensions.cs │ │ ├── Asn1SetAttribute.cs │ │ ├── Asn1ChoiceAttribute.cs │ │ ├── Asn1SequenceAttribute.cs │ │ ├── Asn1BuiltinValues.cs │ │ ├── Asn1TagClass.cs │ │ ├── Asn1Implicit.cs │ │ ├── Asn1Oids.cs │ │ └── Asn1Enumerated.cs ├── crypto │ ├── Titanis.Crypto.Aes128Cmac │ │ ├── References.txt │ │ └── Titanis.Crypto.Aes128Cmac.csproj │ ├── Titanis.Crypto.AesCcm │ │ └── References.txt │ ├── Titanis.Crypto │ │ ├── IHashBuffer.cs │ │ └── IHashContext.cs │ └── Titanis.Crypto.Des │ │ ├── References.txt │ │ └── Titanis.Crypto.Des.csproj ├── Titanis.Smb2.PowerShell │ ├── Titanis.Smb2.Powershell.psd1 │ ├── SmbGetContentParams.cs │ └── ConnectSmbServer.cs ├── build │ ├── Titanis.SourceGen │ │ ├── AnalyzerReleases.Shipped.md │ │ └── AnalyzerReleases.Unshipped.md │ └── Titanis.ToolDocBuilder │ │ └── Titanis.ToolDocBuilder.csproj └── Directory.Build.targets ├── test ├── formats │ └── Titanis.Asn1.Test │ │ ├── Usings.cs │ │ └── Titanis.Asn1.Test.csproj ├── base │ ├── Titanis.Winterop.Test │ │ ├── MSTestSettings.cs │ │ └── Titanis.Winterop.Test.csproj │ ├── Titanis.IO.Test │ │ └── Titanis.IO.Test.csproj │ └── Titanis.Dynamic.Test │ │ └── Titanis.Dynamic.Test.csproj ├── net │ └── Msrpc │ │ └── Titanis.Msrpc.Mswmi.Test │ │ └── GlobalUsings.cs ├── security │ ├── Titanis.Security.Spnego.Test │ │ └── TestData │ │ │ ├── spnego1.dat │ │ │ ├── spnego-NTLM_AUTH.bin │ │ │ ├── spnego-NTLM_CHALLENGE.bin │ │ │ ├── spnego-NTLM_NEGOTIATE.bin │ │ │ ├── gssapi-spnego-NTLM_AUTH.bin │ │ │ ├── gssapi-spnego-NTLM_CHALLENGE.bin │ │ │ ├── gssapi-spnego-NTLM_NEGOTIATE.bin │ │ │ └── gssapi-spnego-NegTokenInit2.bin │ ├── Titanis.Security.Kerberos.Test │ │ └── TestData │ │ │ ├── aprep-cifs-dc1.bin │ │ │ ├── aprep-cifs-wks.bin │ │ │ ├── aprep-nrpc-dc1.bin │ │ │ ├── apreq-cifs-dc1.bin │ │ │ ├── apreq-cifs-wks.bin │ │ │ ├── apreq-nrpc-dc1.bin │ │ │ ├── asrep-testuser.bin │ │ │ ├── asreq-testuser.bin │ │ │ ├── dcerpc-encStub.bin │ │ │ ├── miclist-nrpc.bin │ │ │ ├── aprep2-nrpc-dc1.bin │ │ │ ├── miclist-sig-nrpc.bin │ │ │ ├── dcerpc-encTrailer.bin │ │ │ ├── asrep-nopreauthtestuser.bin │ │ │ ├── asreq-nopreauthtestuser.bin │ │ │ ├── asreq-testuser-preauth.bin │ │ │ ├── tgsrep-testuser-cifs-dc1.bin │ │ │ ├── tgsrep-testuser-ldap-dc1.bin │ │ │ ├── tgsreq-testuser-cifs-dc1.bin │ │ │ ├── tgsreq-testuser-ldap-dc1.bin │ │ │ ├── asrep-testuser-preauth-req.bin │ │ │ ├── tgsrep-testuser-host-desktop.bin │ │ │ └── tgsreq-testuser-host-desktop.bin │ └── Titanis.NFold.Test │ │ └── Titanis.NFold.Test.csproj ├── Directory.Build.props └── crypto │ ├── Titanis.Crypto.AesCcm.Test │ └── Titanis.Crypto.AesCcm.Test.csproj │ ├── Titanis.Crypto.Aes128Cmac.Test │ └── Titanis.Crypto.Aes128Cmac.Test.csproj │ └── Titanis.Crypto.Sp800_108.Test │ ├── KdfTest.cs │ └── Titanis.Crypto.Sp800_108.Test.csproj ├── Contributors.md ├── samples ├── Directory.Build.props ├── CommandSample │ └── TimeParameters.cs ├── TerminalLogSample │ └── TerminalLogSample.csproj ├── WorkflowSample │ └── WorkflowSample.csproj ├── PduStructSample │ └── PduStructSample.csproj └── dcom │ └── MmcExec │ └── MmcExec.csproj ├── doc └── DevGuide │ ├── UsingSmb.md │ └── Versioning.md ├── tools ├── rpc │ ├── Lsa │ │ ├── LsaCommand.cs │ │ ├── WhoamiCommand.cs │ │ └── Lsa.csproj │ ├── Epm │ │ └── Program.cs │ ├── Sam │ │ └── Program.cs │ ├── Wmi │ │ ├── LsclassCommand.cs │ │ └── LsnsCommand.cs │ └── Scm │ │ └── Program.cs ├── net │ └── smb2 │ │ └── Smb2Client │ │ ├── StringHelper.cs │ │ ├── Smb2NewShareCommand.cs │ │ └── ServerServiceRpcCommand.cs ├── security │ └── Kerb │ │ ├── KeytabCommand.cs │ │ ├── Program.cs │ │ └── Kerb.csproj └── Directory.Build.props └── BuildToolDocIndex ├── template.md └── BuildToolDocIndex.csproj /src/net/Titanis.Socks/References.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/References.txt: -------------------------------------------------------------------------------- 1 | [RFC 4648] - Base64 -------------------------------------------------------------------------------- /src/security/Titanis.Security.Ntlm/LMSecret.txt: -------------------------------------------------------------------------------- 1 | KGS!@#$% -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msdcom/References.txt: -------------------------------------------------------------------------------- 1 | [MS-DCOM] 2 | -------------------------------------------------------------------------------- /src/interop/Titanis.Windows.Interop/NativeMethods.txt: -------------------------------------------------------------------------------- 1 | PrjStartVirtualizing -------------------------------------------------------------------------------- /src/base/Titanis.Winterop.ErrorCodes/References.txt: -------------------------------------------------------------------------------- 1 | [MS-ERREF] - Windows Error Codes 2 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/References.txt: -------------------------------------------------------------------------------- 1 | [MS-SMB2] 2 | 3 | [MS-FSCC] 4 | 5 | [MS-DFSC] 6 | -------------------------------------------------------------------------------- /src/base/Titanis.Winterop.FileInfo/References.txt: -------------------------------------------------------------------------------- 1 | [MS-FSCC] - File System Control Codes 2 | -------------------------------------------------------------------------------- /test/formats/Titanis.Asn1.Test/Usings.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.VisualStudio.TestTools.UnitTesting; -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mswmi/References.txt: -------------------------------------------------------------------------------- 1 | [MS-WMI] 2 | [MS-WMIO] 3 | 4 | [DMTF-DSP0004] 5 | -------------------------------------------------------------------------------- /src/security/Titanis.Security/References.txt: -------------------------------------------------------------------------------- 1 | [RFC 1509] - Generic Security Service API : C-bindings 2 | -------------------------------------------------------------------------------- /test/base/Titanis.Winterop.Test/MSTestSettings.cs: -------------------------------------------------------------------------------- 1 | [assembly: Parallelize(Scope = ExecutionScope.MethodLevel)] 2 | -------------------------------------------------------------------------------- /test/net/Msrpc/Titanis.Msrpc.Mswmi.Test/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.VisualStudio.TestTools.UnitTesting; -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/References.txt: -------------------------------------------------------------------------------- 1 | [C706] - The Open Group - DCE 1.1: Remote Procedure Call 2 | 3 | [MS-RPCE] 4 | -------------------------------------------------------------------------------- /src/formats/Titanis.Cdrom/CdromImage.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Cdrom 2 | { 3 | public class CdromImage 4 | { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/crypto/Titanis.Crypto.Aes128Cmac/References.txt: -------------------------------------------------------------------------------- 1 | RFC 4493 - The AES-CMAC Algorithm 2 | https://datatracker.ietf.org/doc/html/rfc4493 3 | -------------------------------------------------------------------------------- /src/crypto/Titanis.Crypto.AesCcm/References.txt: -------------------------------------------------------------------------------- 1 | RFC 3610 - Counter with CBC-MAC (CCM) 2 | https://datatracker.ietf.org/doc/html/rfc3610 3 | -------------------------------------------------------------------------------- /src/net/Titanis.X11/References.txt: -------------------------------------------------------------------------------- 1 | [X11-SYS] X11 System Protocol 2 | https://www.x.org/releases/X11R7.7/doc/xproto/x11protocol.html 3 | 4 | -------------------------------------------------------------------------------- /Contributors.md: -------------------------------------------------------------------------------- 1 | |Handle|Contact| 2 | |------|-------| 3 | |codewhisperer84|codewhisp84@gmail.com| 4 | |freefirex|christopher.paschen@trustedsec.com| -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/HashAlgorithmId.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Smb2 2 | { 3 | public enum HashAlgorithmId : ushort 4 | { 5 | Sha512 = 1, 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/Titanis.Smb2.PowerShell/Titanis.Smb2.Powershell.psd1: -------------------------------------------------------------------------------- 1 | @{ 2 | ModuleVersion = '1.0', 3 | FunctionsToExport = '*', 4 | FormatsToProcess = 'Format.ps1xml' 5 | } -------------------------------------------------------------------------------- /src/net/Titanis.Ssh/References.txt: -------------------------------------------------------------------------------- 1 | [RFC 4253] - The Secure Shell (SSH) Transport Layer Protocol 2 | [SSH-ARCH] - RFC 4251 - The Secure Shell (SSH) Protocol Architecture -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] -------------------------------------------------------------------------------- /src/base/Titanis.Dynamic/IStubHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Dynamic 2 | { 3 | public interface IStubHandler 4 | { 5 | public void HandleCall(MethodCallMessage message); 6 | } 7 | } -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mswmi/Problems.txt: -------------------------------------------------------------------------------- 1 | In ReadQualifierSet, sometimes the encoding length is 0, which obviously doesn't include the length of EncodingLength itself. 2 | 3 | -------------------------------------------------------------------------------- /test/security/Titanis.Security.Spnego.Test/TestData/spnego1.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Spnego.Test/TestData/spnego1.dat -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/Client/OrpcInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.DceRpc.Client 4 | { 5 | internal class OrpcProxyInfo 6 | { 7 | internal Guid objectId; 8 | } 9 | } -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2ShareType.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Smb2 2 | { 3 | public enum Smb2ShareType : byte 4 | { 5 | Disk = 1, 6 | Pipe = 2, 7 | Print = 3 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceTriggerAction.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Msscmr 2 | { 3 | public enum ServiceTriggerAction 4 | { 5 | Start = 1, 6 | Stop = 2, 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/aprep-cifs-dc1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/aprep-cifs-dc1.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/aprep-cifs-wks.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/aprep-cifs-wks.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/aprep-nrpc-dc1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/aprep-nrpc-dc1.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/apreq-cifs-dc1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/apreq-cifs-dc1.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/apreq-cifs-wks.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/apreq-cifs-wks.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/apreq-nrpc-dc1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/apreq-nrpc-dc1.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/asrep-testuser.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/asrep-testuser.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/asreq-testuser.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/asreq-testuser.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/dcerpc-encStub.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/dcerpc-encStub.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/miclist-nrpc.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/miclist-nrpc.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Spnego.Test/TestData/spnego-NTLM_AUTH.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Spnego.Test/TestData/spnego-NTLM_AUTH.bin -------------------------------------------------------------------------------- /src/security/Titanis.Security.Ntlm/INtlmAuthStore.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Security.Ntlm 2 | { 3 | public interface INtlmAuthStore 4 | { 5 | NtlmAuthRecord GetUserAuthRecord(string userName); 6 | } 7 | } -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/aprep2-nrpc-dc1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/aprep2-nrpc-dc1.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/miclist-sig-nrpc.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/miclist-sig-nrpc.bin -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssrvs/SharePermissions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Mswkst 4 | { 5 | [Flags] 6 | public enum SharePermissions 7 | { 8 | None = 0, 9 | } 10 | } -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/dcerpc-encTrailer.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/dcerpc-encTrailer.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Spnego.Test/TestData/spnego-NTLM_CHALLENGE.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Spnego.Test/TestData/spnego-NTLM_CHALLENGE.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Spnego.Test/TestData/spnego-NTLM_NEGOTIATE.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Spnego.Test/TestData/spnego-NTLM_NEGOTIATE.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Spnego.Test/TestData/gssapi-spnego-NTLM_AUTH.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Spnego.Test/TestData/gssapi-spnego-NTLM_AUTH.bin -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Titanis.Asn1.Compiler")] 4 | [assembly: InternalsVisibleTo("Titanis.Asn1.Test")] 5 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Spnego/References.txt: -------------------------------------------------------------------------------- 1 | https://tools.ietf.org/html/rfc4178 2 | RFC 4178 - The Simple and Protected Generic Security Service Application Program Interface (GSS-API) Negotiation Mechanism 3 | -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/asrep-nopreauthtestuser.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/asrep-nopreauthtestuser.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/asreq-nopreauthtestuser.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/asreq-nopreauthtestuser.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/asreq-testuser-preauth.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/asreq-testuser-preauth.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/tgsrep-testuser-cifs-dc1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/tgsrep-testuser-cifs-dc1.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/tgsrep-testuser-ldap-dc1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/tgsrep-testuser-ldap-dc1.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/tgsreq-testuser-cifs-dc1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/tgsreq-testuser-cifs-dc1.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/tgsreq-testuser-ldap-dc1.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/tgsreq-testuser-ldap-dc1.bin -------------------------------------------------------------------------------- /src/build/Titanis.SourceGen/AnalyzerReleases.Shipped.md: -------------------------------------------------------------------------------- 1 | ; Shipped analyzer releases 2 | ; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md 3 | 4 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/CompressionCaps.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | [Flags] 6 | public enum CompressionCaps : uint 7 | { 8 | None = 0, 9 | 10 | Chained = 1 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/RdmaTransformId.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Smb2 2 | { 3 | public enum RdmaTransformId 4 | { 5 | None = 0, 6 | Encryption = 1, 7 | Signing = 2, 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/asrep-testuser-preauth-req.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/asrep-testuser-preauth-req.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Spnego.Test/TestData/gssapi-spnego-NTLM_CHALLENGE.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Spnego.Test/TestData/gssapi-spnego-NTLM_CHALLENGE.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Spnego.Test/TestData/gssapi-spnego-NTLM_NEGOTIATE.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Spnego.Test/TestData/gssapi-spnego-NTLM_NEGOTIATE.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Spnego.Test/TestData/gssapi-spnego-NegTokenInit2.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Spnego.Test/TestData/gssapi-spnego-NegTokenInit2.bin -------------------------------------------------------------------------------- /src/build/Titanis.SourceGen/AnalyzerReleases.Unshipped.md: -------------------------------------------------------------------------------- 1 | ; Unshipped analyzer release 2 | ; https://github.com/dotnet/roslyn-analyzers/blob/main/src/Microsoft.CodeAnalysis.Analyzers/ReleaseTrackingAnalyzers.Help.md 3 | 4 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Serialization/IAsn1EncoderCallback.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Asn1.Serialization 2 | { 3 | public interface IAsn1EncoderCallback 4 | { 5 | void OnCloseTlv(Asn1DerEncoder encoder, Asn1Tag tag); 6 | } 7 | } -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.CompilerServices; 4 | using System.Text; 5 | 6 | [assembly: InternalsVisibleTo("Titanis.Msrpc.Msdcom")] 7 | -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/tgsrep-testuser-host-desktop.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/tgsrep-testuser-host-desktop.bin -------------------------------------------------------------------------------- /test/security/Titanis.Security.Kerberos.Test/TestData/tgsreq-testuser-host-desktop.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trustedsec/Titanis/HEAD/test/security/Titanis.Security.Kerberos.Test/TestData/tgsreq-testuser-host-desktop.bin -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/IModuleVisitor.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Asn1.Metadata 2 | { 3 | public interface IModuleVisitor 4 | { 5 | void Visit(Asn1TypeDef typeDef); 6 | void Visit(Asn1ValueDef valueDef); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/RpcFaultCode.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.DceRpc.WireProtocol 2 | { 3 | public enum RpcFaultCode : uint 4 | { 5 | // [MS-RPCE] § 3.2.3.5.1 - Failure Semantics 6 | AccessDenied = 5, 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2CloseOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | [Flags] 6 | public enum Smb2CloseOptions : ushort 7 | { 8 | None = 0, 9 | 10 | QueryAttributes = 1 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/Client/IEndpointMapper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc.Client 6 | { 7 | interface IEndpointMapper 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/ContextDefResult.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.DceRpc.WireProtocol 2 | { 3 | enum ContextDefResult : short 4 | { 5 | Acceptance = 0, 6 | UserRejection, 7 | ProviderRejection 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msdcom/ICustomDcomMarshal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Titanis.IO; 3 | 4 | namespace Titanis.Msrpc.Msdcom 5 | { 6 | public interface ICustomDcomMarshal 7 | { 8 | Objref CreateObjref(); 9 | } 10 | } -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/IAsn1Tag.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1 6 | { 7 | public interface IAsn1Tag 8 | { 9 | Asn1Tag Tag { get; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/SigningAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | [Flags] 6 | public enum SigningAlgorithm : ushort 7 | { 8 | HmacSha256 = 0, 9 | AesCmac = 1, 10 | AesGmac = 2, 11 | } 12 | } -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr/ServiceReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Msrpc.Msscmr 6 | { 7 | static class ServiceReader 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2ReadOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | [Flags] 6 | public enum Smb2ReadOptions : byte 7 | { 8 | None = 0, 9 | 10 | Unbuffered = 1, 11 | Compressed = 2 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msdfsnm/DfsnmClient.cs: -------------------------------------------------------------------------------- 1 | using MS_DFSNM; 2 | using Titanis.DceRpc.Client; 3 | 4 | namespace Titanis.Msrpc.Msdfsnm 5 | { 6 | public class DfsnmClient : RpcServiceClient 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceErrorControl.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Msscmr 2 | { 3 | public enum ServiceErrorControl : uint 4 | { 5 | Ignore = 0, 6 | Normal = 1, 7 | Severe = 2, 8 | Critical = 3, 9 | } 10 | } -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2WriteOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | [Flags] 6 | public enum Smb2WriteOptions : uint 7 | { 8 | None = 0, 9 | 10 | WriteThrough = 1, 11 | Unbuffered = 2 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/base/Titanis.Dynamic/IStub.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Dynamic 6 | { 7 | public interface IStub 8 | { 9 | public void SetHandler(IStubHandler handler); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr/ScmLockStatus.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Msscmr 2 | { 3 | public class ScmLockStatus 4 | { 5 | public bool IsLocked { get; set; } 6 | public int LockDuration { get; set; } 7 | public string LockOwner { get; set; } 8 | } 9 | } -------------------------------------------------------------------------------- /src/base/Titanis.Winterop.Security/Titanis.Winterop.Security.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 12.0 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/RpcString.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | public class RpcString 8 | { 9 | } 10 | public class RpcString : RpcString 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceStates.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Msscmr 4 | { 5 | [Flags] 6 | public enum ServiceStates 7 | { 8 | None = 0, 9 | 10 | Active = 1, 11 | Inactive = 2, 12 | All = 3, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/CompressionAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | public enum CompressionAlgorithm : ushort 6 | { 7 | None = 0, 8 | Lznt1 = 1, 9 | Lz77 = 2, 10 | Lz77_Huffman = 3, 11 | Pattern_V1 = 4, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/RpcStateMachine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.DceRpc 8 | { 9 | internal class RpcStateMachine 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/net/Titanis.Dbus/Titanis.Dbus.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $(ArtifactsPath)/test 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/ProviderReason.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.DceRpc.WireProtocol 2 | { 3 | enum ProviderReason : short 4 | { 5 | ReasonNotSpecified = 0, 6 | AbstractSyntaxNotSupported, 7 | ProposedTransferSyntaxesNotSupported, 8 | LocalLimitExceeded 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /samples/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $(ArtifactsPath)/samples 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/DisplayAlignment.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis 2 | { 3 | /// 4 | /// Specifies the alignment of a value within a UI element. 5 | /// 6 | public enum DisplayAlignment 7 | { 8 | None = 0, 9 | 10 | Left, 11 | Center, 12 | Right, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2OplockLevel.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Smb2 2 | { 3 | // [MS-SMB2] § 2.2.13 - SMB2 CREATE Request 4 | public enum Smb2OplockLevel : byte 5 | { 6 | None = 0, 7 | Level2 = 1, 8 | Exclusive = 0x08, 9 | Batch = 0x09, 10 | Lease = 0xFF 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceStartType.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Msscmr 2 | { 3 | public enum ServiceStartType : uint 4 | { 5 | Boot = 0x00000000, 6 | System = 0x00000001, 7 | Auto = 0x00000002, 8 | Demand = 0x00000003, 9 | Disabled = 0x00000004, 10 | } 11 | } -------------------------------------------------------------------------------- /src/base/Titanis.Cli/OutputStyle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | public enum OutputStyle 8 | { 9 | Freeform = 0, 10 | Raw, 11 | Table, 12 | List, 13 | Csv, 14 | Tsv, 15 | Json, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2ImpersonationLevel.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Smb2 2 | { 3 | // [MS-SMB2] § 2.2.13 - SMB2 CREATE Request 4 | public enum Smb2ImpersonationLevel : uint 5 | { 6 | Anonymous = 0, 7 | Identification = 1, 8 | Impersonation = 2, 9 | Delegate = 3, 10 | } 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mslsar/LsaNameType.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Mslsar 2 | { 3 | public enum LsaNameType 4 | { 5 | User = 1, 6 | Group, 7 | Domain, 8 | Alias, 9 | WellKnownGroup, 10 | DeletedAccount, 11 | Invalid, 12 | Unknown, 13 | Computer, 14 | Label, 15 | } 16 | } -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Asn1TagMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1 6 | { 7 | public enum Asn1TagMode 8 | { 9 | // § 13.2 - EXPLICIT is the default 10 | Explicit = 0, 11 | Implicit, 12 | Automatic 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/IHaveErrorCode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis 6 | { 7 | /// 8 | /// Exposes an error code. 9 | /// 10 | public interface IHaveErrorCode 11 | { 12 | int ErrorCode { get; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/base/Titanis.Dynamic/AssemblyGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection.Emit; 3 | 4 | namespace Titanis.Dynamic 5 | { 6 | struct GeneratedAssembly 7 | { 8 | 9 | } 10 | 11 | public class AssemblyGenerator 12 | { 13 | public AssemblyGenerator() 14 | { 15 | 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/security/Titanis.NFold/Titanis.NFold.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/IValidateParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | public interface IValidateParameters 8 | { 9 | void ValidateParameters(ParameterValidationContext context, ParameterGroupOptions options); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduParameterAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.PduStruct 6 | { 7 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] 8 | public sealed class PduParameterAttribute : Attribute 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/PreauthHashAlgorithm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | /// 6 | /// Specifies a preauthentication hash algorithm. 7 | /// 8 | [Flags] 9 | public enum PreauthHashAlgorithm : ushort 10 | { 11 | None = 0, 12 | 13 | Sha512 = (1 << 0), 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2SecurityMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | /// 6 | /// Specifies the security mode. 7 | /// 8 | [Flags] 9 | public enum Smb2SecurityMode : ushort 10 | { 11 | None = 0, 12 | 13 | SigningEnabled = 1, 14 | SigningRequired = 2 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mslsar/UserRightInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Msrpc.Mslsar 8 | { 9 | public class UserRightInfo 10 | { 11 | public string? Name { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr/ServiceFailureActions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Msscmr 4 | { 5 | public class ServiceFailureActions 6 | { 7 | public TimeSpan ResetPeriod { get; set; } 8 | public string RebootMessage { get; set; } 9 | public ServiceFailureAction[] Actions { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /src/crypto/Titanis.Crypto/IHashBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Crypto 4 | { 5 | public interface IHashBuffer 6 | { 7 | long InputSize { get; set; } 8 | int WriteIndex { get; set; } 9 | int InputBlockSizeBytes { get; } 10 | Span InputBuffer { get; } 11 | void HashBuffer(); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1ConstructedType.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Asn1.Metadata 2 | { 3 | /// 4 | /// Represents a constructed type. 5 | /// 6 | public abstract class Asn1ConstructedType : Asn1Type 7 | { 8 | /// 9 | public sealed override bool IsConstructed => true; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli.Workflow/Titanis.Cli.Workflow.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/References.txt: -------------------------------------------------------------------------------- 1 | A Layman's Guide to a Subset of ASN.1, BER, and DER 2 | http://luca.ntop.org/Teaching/Appunti/asn1.html 3 | 4 | X.690-0207 - 5 | Information technology – ASN.1 encoding rules: 6 | Specification of Basic Encoding Rules (BER), 7 | Canonical Encoding Rules (CER) 8 | and Distinguished Encoding Rules (DER) 9 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/PortAny.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 6 | struct PortAny 7 | { 8 | internal byte[] spec; 9 | 10 | public PortAny(byte[] spec) 11 | { 12 | this.spec = spec; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/RpcAssocGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | sealed class RpcAssocGroup 8 | { 9 | public uint GroupId { get; } 10 | 11 | internal RpcAssocGroup(uint groupId) 12 | { 13 | this.GroupId = groupId; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/PortAnyHeader.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 6 | struct PortAnyHeader 7 | { 8 | public static unsafe int StructSize => sizeof(PortAnyHeader); 9 | 10 | internal ushort length; 11 | } 12 | } -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2ShareCaps.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | [Flags] 6 | public enum Smb2ShareCaps : uint 7 | { 8 | None = 0, 9 | 10 | Dfs = 8, 11 | ContinuousAvailability = 0x10, 12 | ScaleOut = 0x20, 13 | Cluster = 0x40, 14 | Asymmetric = 0x80, 15 | RedirectToOwner = 0x100, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /doc/DevGuide/UsingSmb.md: -------------------------------------------------------------------------------- 1 | # Using SMB2 2 | 3 | Titanis implements an SMB2 client in `Titanis.Smb2`. To get started, 4 | 5 | 1. Create a new project using the Console App template. 6 | 1. Add a reference to `Titanis.Core`, `Titanis.IO`, `Titanis.Net`, `Titanis.Security`, `Titanis.Security.Spnego`, `Titanis.Security.Ntlm`, `Titanis.Security.Kerberos`. 7 | 8 | -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduIgnoreAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis 6 | { 7 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)] 8 | public sealed class PduIgnoreAttribute : Attribute 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2SessionOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Smb2 8 | { 9 | public class Smb2SessionOptions(bool mustEncryptData) 10 | { 11 | public bool MustEncryptData => mustEncryptData; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2ShareOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Smb2 8 | { 9 | public class Smb2ShareOptions(bool mustEncryptData) 10 | { 11 | public bool MustEncryptData => mustEncryptData; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/KeyIntent.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] 4 | 5 | namespace Titanis.Security.Kerberos 6 | { 7 | public enum KeyIntent : byte 8 | { 9 | Checksum = 0x99, 10 | Encryption = 0xAA, 11 | Integrity = 0x55, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/crypto/Titanis.Crypto/IHashContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Crypto 4 | { 5 | public interface IHashContext 6 | { 7 | int DigestSizeBytes { get; } 8 | int InputBlockSizeBytes { get; } 9 | void Initialize(); 10 | void HashData(ReadOnlySpan block); 11 | void HashFinal(Span digestBuffer); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mslsar/SecretInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Mslsar 4 | { 5 | public class SecretInfo 6 | { 7 | public byte[] CurrentValue { get; set; } 8 | public DateTime CurrentValueSetTime { get; set; } 9 | public byte[] OldValue { get; set; } 10 | public DateTime OldValueSetTime { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/IRpcObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.DceRpc 8 | { 9 | /// 10 | /// Marks an object as an ORPC object. 11 | /// 12 | public interface IRpcObject 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/AuthzDataType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] 4 | 5 | namespace Titanis.Security.Kerberos 6 | { 7 | enum AuthzDataType 8 | { 9 | IfRelevant = 1, 10 | KdcIssued = 4, 11 | AndOr = 5, 12 | MandatoryForKdc = 8, 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/base/Titanis.Mocks/Arg.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Mocks 6 | { 7 | public static class Arg 8 | { 9 | public static T Any() => throw new NotImplementedException(); 10 | public static T Matches(Func matches) => throw new NotImplementedException(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduPositionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.PduStruct 6 | { 7 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] 8 | public sealed class PduPositionAttribute : Attribute 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/IRpcFixedStruct.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.DceRpc 2 | { 3 | /// 4 | /// Marks a struct as fixed (i.e., not conformant). 5 | /// 6 | /// 7 | /// This is used as a type constraint for generated structures. 8 | /// 9 | public interface IRpcFixedStruct : IRpcStruct 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceState.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Msscmr 2 | { 3 | public enum ServiceState 4 | { 5 | Stopped = 0x00000001, 6 | StartPending = 0x00000002, 7 | StopPending = 0x00000003, 8 | Running = 0x00000004, 9 | ContinuePending = 0x00000005, 10 | PausePending = 0x00000006, 11 | Paused = 0x00000007, 12 | 13 | } 14 | } -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduByteOrder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis 6 | { 7 | /// 8 | /// Specifies the byte order. 9 | /// 10 | public enum PduByteOrder 11 | { 12 | Inherit = 0, 13 | Native, 14 | Other, 15 | LittleEndian, 16 | BigEndian 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1TypeKind.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Asn1.Metadata 2 | { 3 | public enum Asn1TypeKind 4 | { 5 | Unknown = 0, 6 | 7 | Any, 8 | Primitive, 9 | Sequence, 10 | Set, 11 | Choice, 12 | CustomBitstring, 13 | Constrained, 14 | CustomEnumeration, 15 | CustomInteger, 16 | SequenceOf, 17 | SetOf, 18 | Tagged, 19 | } 20 | } -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamMemberInfo.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Mssamr 2 | { 3 | public class SamMemberInfo 4 | { 5 | public uint ObjectId { get; } 6 | public uint Attributes { get; } 7 | 8 | public SamMemberInfo(uint relativeId, uint attributes) 9 | { 10 | this.ObjectId = relativeId; 11 | this.Attributes = attributes; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/compat/NumericExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Numerics; 4 | using System.Text; 5 | 6 | namespace Titanis.Asn1.compat 7 | { 8 | static class NumericExtensions 9 | { 10 | internal static int GetByteCount(this BigInteger n) 11 | { 12 | return n.ToByteArray().Length; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ScmAccess.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Msscmr 4 | { 5 | [Flags] 6 | public enum ScmAccess 7 | { 8 | None = 0, 9 | 10 | Connect = 0x0001, 11 | CreateService = 0x0002, 12 | EnumerateService = 0x0004, 13 | Lock = 0x0008, 14 | QueryLockStatus = 0x0010, 15 | ModifyBootConfig = 0x0020, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /tools/rpc/Lsa/LsaCommand.cs: -------------------------------------------------------------------------------- 1 | using ms_lsar; 2 | using Titanis.Cli; 3 | using Titanis.Msrpc.Mslsar; 4 | 5 | namespace Lsa; 6 | 7 | /// 8 | /// Base class for LSA commands 9 | /// 10 | internal abstract class LsaCommand : RpcCommand 11 | { 12 | /// 13 | protected sealed override Type InterfaceType => typeof(lsarpc); 14 | } 15 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/IRpcObjectProxy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.DceRpc 8 | { 9 | /// 10 | /// Marks a type as an ORPC proxy. 11 | /// 12 | public interface IRpcObjectProxy : IRpcClientProxy 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/net/Titanis.Msrpc.Core/GenericAccessRights.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Msrpc 6 | { 7 | [Flags] 8 | public enum GenericAccessRights : uint 9 | { 10 | GenericRead = 0x80000000, 11 | GenericWrite = 0x40000000, 12 | GenericExecute = 0x20000000, 13 | GenericAll = 0x10000000, 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/security/Titanis.Security/AuthServerContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Security 6 | { 7 | public abstract class AuthServerContext : AuthContext 8 | { 9 | public abstract ReadOnlySpan Accept(); 10 | public abstract ReadOnlySpan Accept(ReadOnlySpan token); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tools/rpc/Epm/Program.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Titanis.Cli; 3 | 4 | namespace Titanis.DceRpc.Cli; 5 | 6 | [Description("Commands for interacting with the RPC endpoint mapper")] 7 | [Subcommand("lsep", typeof(LsepCommand))] 8 | internal class Program : MultiCommand 9 | { 10 | static int Main(string[] args) 11 | => RunProgramAsync(args); 12 | } 13 | -------------------------------------------------------------------------------- /BuildToolDocIndex/template.md: -------------------------------------------------------------------------------- 1 | # Tool Index 2 | 3 | This index lists the tools by command name as well as by task. 4 | 5 | * [List of tools by name](#tools-by-name) 6 | * [List of tools by task](#tools-by-task) 7 | 8 | # Tools by Name 9 | 10 | |Command|Description| 11 | |-|-| 12 | {ToolsByName} 13 | 14 | # Tools by Task 15 | 16 | |Task|Command| 17 | |-|-| 18 | {ToolsByTask} 19 | -------------------------------------------------------------------------------- /src/crypto/Titanis.Crypto.Aes128Cmac/Titanis.Crypto.Aes128Cmac.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | Titanis.Crypto 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Asn1SetAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Asn1 8 | { 9 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 10 | public sealed class Asn1SetAttribute : Attribute 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/INamedObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis 6 | { 7 | /// 8 | /// Represents a named object. 9 | /// 10 | public interface INamedObject 11 | { 12 | /// 13 | /// Gets the name of the object 14 | /// 15 | string Name { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Asn1ChoiceAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Asn1 8 | { 9 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 10 | public sealed class Asn1ChoiceAttribute : Attribute 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tools/rpc/Sam/Program.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Titanis.Cli.SamTool; 4 | 5 | [Command] 6 | [Description("Commands for interacting with a remote Security Accounts Manager")] 7 | [Subcommand("enumusers", typeof(EnumUsersCommand))] 8 | internal class Program : MultiCommand 9 | { 10 | static void Main(string[] args) 11 | => RunProgramAsync(args); 12 | } 13 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Asn1SequenceAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Asn1 8 | { 9 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 10 | public sealed class Asn1SequenceAttribute : Attribute 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mslsar/DomainInfo.cs: -------------------------------------------------------------------------------- 1 | using Titanis.Winterop.Security; 2 | 3 | namespace Titanis.Msrpc.Mslsar 4 | { 5 | public class DomainInfo 6 | { 7 | internal DomainInfo(string name, SecurityIdentifier sid) 8 | { 9 | Name = name; 10 | Sid = sid; 11 | } 12 | 13 | public string Name { get; set; } 14 | public SecurityIdentifier Sid { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mswmi/Wmio/Decoration.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Mswmi.Wmio 2 | { 3 | // [MS-WMIO] § 2.2.7 - Decoration 4 | [PduStruct] 5 | partial struct Decoration 6 | { 7 | internal EncodedString serverName; 8 | internal EncodedString ns; 9 | 10 | public WmiDecoration ToDecoration() 11 | => new WmiDecoration(this.serverName.value, this.ns.value); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/MandatoryAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | /// 8 | /// Marks a parameter as mandatory. 9 | /// 10 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] 11 | public class MandatoryAttribute : Attribute 12 | { 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/base/Titanis.Dynamic/StubGenerateParams.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using System.Text; 5 | 6 | namespace Titanis.Dynamic 7 | { 8 | public struct StubGenerateParams 9 | { 10 | public TypeInfo BaseClass { get; set; } 11 | public Type[]? InterfaceTypes { get; set; } 12 | public string StubTypeName { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1Constraint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1.Metadata 6 | { 7 | /// 8 | /// Describes a constraint applied to a type. 9 | /// 10 | public abstract class Asn1Constraint 11 | { 12 | private protected Asn1Constraint() 13 | { 14 | 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2Dialect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Smb2 6 | { 7 | // [MS-SMB2] § 1.7 Versioning and Capability Negotiation 8 | public enum Smb2Dialect : short 9 | { 10 | Smb2_0_2 = 0x0202, 11 | Smb2_1 = 0x0210, 12 | Smb3_0 = 0x0300, 13 | Smb3_0_2 = 0x0302, 14 | Smb3_1_1 = 0x0311, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Msrpc.Msscmr 6 | { 7 | [Flags] 8 | public enum ServiceTypes 9 | { 10 | None = 0, 11 | 12 | KernelDriver = 1, 13 | FileSystemDriver = 2, 14 | OwnProcess = 0x10, 15 | SharedProcess = 0x20, 16 | 17 | All = 0x33, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mswmi/Wmio/CountedEncodingBlock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Titanis.IO; 7 | 8 | namespace Titanis.Msrpc.Mswmi.Wmio 9 | { 10 | [PduStruct] 11 | internal partial struct CountedEncodingBlock 12 | where T : IPduStruct, new() 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssrvs/ShareType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Mswkst 4 | { 5 | [Flags] 6 | public enum ShareType : uint 7 | { 8 | Disk = 0, 9 | PrintQueue = 1, 10 | Device = 2, 11 | Ipc = 3, 12 | 13 | Hidden = 0x80000000, 14 | 15 | //TypeMask = 0x3, 16 | 17 | Cluster = 0x02000000, 18 | ScaleOutCluster = 0x04000000, 19 | DfsCluster = 0x08000000 20 | } 21 | } -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/ICryptHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Security.Kerberos 8 | { 9 | public interface ICryptHandler 10 | { 11 | void TransformBlock(ReadOnlySpan source, Span target); 12 | 13 | int BlockSizeBytes { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tools/net/smb2/Smb2Client/StringHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace Titanis 4 | { 5 | static class StringHelper 6 | { 7 | public static StringBuilder AppendIf(this StringBuilder sb, Winterop.FileAttributes attributes, Winterop.FileAttributes flag, char trueChar, char falseChar) 8 | { 9 | sb.Append((0 != (attributes & flag)) ? trueChar : falseChar); 10 | return sb; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Titanis.Smb2.PowerShell/SmbGetContentParams.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.PowerShell.Commands; 2 | using System.Management.Automation; 3 | 4 | namespace Titanis.Smb2.PowerShell 5 | { 6 | internal class SmbGetContentParams:FileSystemContentReaderDynamicParameters 7 | { 8 | const string TypeSetName = "Type"; 9 | 10 | [Parameter(ParameterSetName = TypeSetName)] 11 | public SwitchParameter Raw { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/FaultPdu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc.WireProtocol 6 | { 7 | class FaultPdu 8 | { 9 | internal FaultPduHeader hdr; 10 | 11 | public FaultPdu(FaultPduHeader hdr) 12 | { 13 | this.hdr = hdr; 14 | } 15 | 16 | public ReadOnlyMemory StubData { get; internal set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/BindNakPdu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc.WireProtocol 6 | { 7 | class BindNakPdu 8 | { 9 | internal BindNakPduHeader header; 10 | 11 | public BindNakPdu(BindNakPduHeader header) 12 | { 13 | this.header = header; 14 | } 15 | 16 | // TODO: Add "supported versions" if desired 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/IOutputFormatter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | /// 8 | /// Provides functionality to format a value for output. 9 | /// 10 | public interface IOutputFormatter 11 | { 12 | public string? FormatValue(object? value, string format, OutputField field, OutputStyle outputStyle); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceFailureAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Msscmr 4 | { 5 | public enum ServiceFailureActionType 6 | { 7 | None = 0, 8 | RestartService = 1, 9 | Reboot = 2, 10 | RunCommand = 3, 11 | } 12 | public class ServiceFailureAction 13 | { 14 | public ServiceFailureActionType ActionType { get; set; } 15 | public TimeSpan Delay { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/Titanis.Msrpc.Msscmr.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | Titanis.Msrpc.Msscmr 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/APOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] 5 | 6 | namespace Titanis.Security.Kerberos 7 | { 8 | [Flags] 9 | public enum APOptions 10 | { 11 | None = 0, 12 | 13 | Reserved = (1 << 31), 14 | UseSessionKey = (1 << (31 - 1)), 15 | MutualRequired = (1 << (31 - 2)), 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/ResponsePdu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc.WireProtocol 6 | { 7 | class ResponsePdu 8 | { 9 | internal ResponsePduHeader hdr; 10 | 11 | public ResponsePdu(ResponsePduHeader hdr) 12 | { 13 | this.hdr = hdr; 14 | } 15 | 16 | public ReadOnlyMemory StubData { get; internal set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/BindAckPduHeader.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 6 | struct BindAckPduHeader 7 | { 8 | public unsafe static int StructSize => sizeof(BindAckPduHeader); 9 | 10 | internal ushort max_xmit_frag; 11 | internal ushort max_recv_frag; 12 | internal uint assoc_group_id; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/AddressType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] 4 | 5 | namespace Titanis.Security.Kerberos 6 | { 7 | enum AddressType 8 | { 9 | Ipv4 = 2, 10 | Directional = 3, 11 | ChaosNet = 5, 12 | Xns = 6, 13 | Iso = 7, 14 | Decnet = 12, 15 | AppleTalkDDP = 16, 16 | Netbios = 20, 17 | Ipv6 = 24, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /tools/security/Kerb/KeytabCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Titanis.Cli; 8 | 9 | namespace Kerb; 10 | 11 | [Command] 12 | [Description("Display and edit keytab files")] 13 | [Subcommand("list", typeof(ListKeytabCommand))] 14 | internal class KeytabCommand : MultiCommand 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduFieldAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis 6 | { 7 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] 8 | public sealed class PduFieldAttribute : Attribute 9 | { 10 | public string? ReadMethod { get; set; } 11 | public string? WriteMethod { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Pdus/Smb2PduFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2.Pdus 4 | { 5 | // [MS-SMB2] § 2.2.1.1 - SMB2 Packet Header - ASYNC 6 | [Flags] 7 | enum Smb2PduFlags : uint 8 | { 9 | None = 0, 10 | 11 | ServerToRedir = 1, 12 | AsyncCommand = 2, 13 | RelatedOperations = 4, 14 | Signed = 8, 15 | PriorityMask = 0x70, 16 | DfsOperations = 0x10000000, 17 | ReplayOperation = 0x20000000, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/Titanis.Socks/ISocks5Callback.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Titanis.Socks 9 | { 10 | public interface ISocks5Callback 11 | { 12 | void OnConnecting(EndPoint socksEP, EndPoint remoteEP); 13 | void OnConnected(EndPoint socksEP, EndPoint remoteEP, EndPoint? remoteBindEP); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/CommandAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Cli 4 | { 5 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] 6 | public sealed class CommandAttribute : Attribute 7 | { 8 | public CommandAttribute() 9 | { 10 | } 11 | 12 | // TODO: Complete deprecation 13 | [Obsolete("Use DescriptionAttribute instead.", false)] 14 | public string? HelpText { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1ValueSetConstraint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Asn1.Metadata 8 | { 9 | public abstract class Asn1ValueSetConstraint : Asn1Constraint 10 | { 11 | public abstract Asn1Int64Range? TryGetInt64Range(); 12 | public abstract Asn1UInt64Range? TryGetUInt64Range(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/PfcFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | [Flags] 6 | public enum PfcFlags : byte 7 | { 8 | None = 0, 9 | FirstFrag = 1, 10 | LastFrag = 2, 11 | PendingCancel = 4, 12 | Reserved = 8, 13 | SupportsConcurrent = 0x10, 14 | DidNotExecute = 0x20, 15 | Maybe = 0x40, 16 | ObjectUuid = 0x80, 17 | 18 | SupportHeaderSigning = PendingCancel, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/IRpcClientProxy.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.DceRpc 8 | { 9 | /// 10 | /// Marks an object as a client proxy. 11 | /// 12 | /// 13 | /// This is primarily used as a type constraint. 14 | /// 15 | public interface IRpcClientProxy 16 | { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamDomainLogoffInfo.cs: -------------------------------------------------------------------------------- 1 | using ms_samr; 2 | using System; 3 | 4 | namespace Titanis.Msrpc.Mssamr 5 | { 6 | public class SamDomainLogoffInfo 7 | { 8 | private readonly DOMAIN_LOGOFF_INFORMATION info; 9 | 10 | internal SamDomainLogoffInfo(in DOMAIN_LOGOFF_INFORMATION info) 11 | { 12 | this.info = info; 13 | } 14 | 15 | public TimeSpan ForceLogOff => TimeSpan.FromTicks(-this.info.ForceLogoff.AsInt64()); 16 | } 17 | } -------------------------------------------------------------------------------- /src/base/Titanis.Dynamic/MethodDeclInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Dynamic 4 | { 5 | class MethodDeclInfo 6 | { 7 | public MethodDeclInfo(Type[] paramTypes, Type[][] reqmods, Type[][] optmods) 8 | { 9 | this.paramTypes = paramTypes; 10 | this.reqmods = reqmods; 11 | this.optmods = optmods; 12 | } 13 | 14 | public Type[] paramTypes { get; } 15 | public Type[][] reqmods { get; } 16 | public Type[][] optmods { get; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduAlignmentAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.PduStruct 6 | { 7 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] 8 | public sealed class PduAlignmentAttribute : Attribute 9 | { 10 | public PduAlignmentAttribute(int alignment) 11 | { 12 | this.Alignment = alignment; 13 | } 14 | 15 | public int Alignment { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Ntlm/AuthenticationException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Security.Ntlm 4 | { 5 | class AuthenticationException : Exception 6 | { 7 | public AuthenticationException() 8 | { 9 | } 10 | 11 | public AuthenticationException(string message) : base(message) 12 | { 13 | } 14 | 15 | public AuthenticationException(string message, Exception innerException) : base(message, innerException) 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/MaybeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | // [C706] § 4.2.22.3 - The maybe Attribute 8 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] 9 | public sealed class MaybeAttribute : Attribute 10 | { 11 | /// 12 | public sealed override bool Match(object? obj) => (obj is MaybeAttribute); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2ShareAccess.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | // [MS-SMB2] § 2.2.13 - SMB2 CREATE Request 6 | [Flags] 7 | public enum Smb2ShareAccess : uint 8 | { 9 | None = 0, 10 | 11 | Read = 1, 12 | Write = 2, 13 | Delete = 4, 14 | 15 | ReadWrite = Read | Write, 16 | ReadWriteDelete = Read | Write | Delete, 17 | 18 | DefaultDirShare = ReadWriteDelete, 19 | DefaultRootDirShare = ReadWrite 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mslsar/AuditLogInfo.cs: -------------------------------------------------------------------------------- 1 | using ms_lsar; 2 | using Titanis.DceRpc; 3 | 4 | namespace Titanis.Msrpc.Mslsar 5 | { 6 | public class AuditLogInfo 7 | { 8 | private POLICY_AUDIT_LOG_INFO _struc; 9 | 10 | internal AuditLogInfo(POLICY_AUDIT_LOG_INFO struc) 11 | { 12 | this._struc = struc; 13 | } 14 | 15 | public int PercentFull => (int)this._struc.AuditLogPercentFull; 16 | public uint MaxLogSize => this._struc.MaximumLogSize; 17 | } 18 | } -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceTriggerType.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Msscmr 2 | { 3 | public enum ServiceTriggerType 4 | { 5 | InterfaceArrival = 1, 6 | IpAddressAvailability = 2, 7 | DomainJoin = 3, 8 | FirewallPortEvent = 4, 9 | GroupPolicyChange = 5, 10 | 11 | Etw = 20, // Documented as 0x20 in [MS-SCMR] but that appears to be wrong 12 | 13 | // Not in [MS-SCMR] 14 | SystemStateChangeEvent = 7, 15 | NetworkEvent = 6, 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/RpcContextHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | public sealed class RpcContextHandle 8 | { 9 | public RpcContextHandle() 10 | { 11 | 12 | } 13 | public RpcContextHandle(NdrContextHandle h) 14 | { 15 | this.contextId = h; 16 | } 17 | 18 | internal NdrContextHandle contextId; 19 | public bool IsEmpty => this.contextId.IsEmpty; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mswmi/WmiReference.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Msrpc.Mswmi 8 | { 9 | public class WmiReference 10 | { 11 | public WmiReference(string path) 12 | { 13 | this.Path = path; 14 | } 15 | 16 | public string Path { get; } 17 | 18 | public sealed override string ToString() 19 | => this.Path; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/GssChannelBinding.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | namespace Titanis.Security.Kerberos 7 | { 8 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 9 | struct GssChannelBinding 10 | { 11 | internal uint initiatorAddrType; 12 | internal uint initiatorAddr; 13 | internal uint acceptorAddrType; 14 | internal uint acceptorAddr; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/base/Titanis.Winterop.FileInfo/VolumeInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | namespace Titanis.Winterop 7 | { 8 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 9 | public struct VolumeInfo 10 | { 11 | public long volumeCreationTime; 12 | public int volumeSerialNumber; 13 | public int volumeLabelLength; 14 | public byte supportsObjects; 15 | public byte reserved; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/crypto/Titanis.Crypto.Des/References.txt: -------------------------------------------------------------------------------- 1 | [HUERTAS] - Data Encryption Standard 2 | https://github.com/dhuertas/DES/blob/master/des.c 3 | 4 | // Inspired and adapted from: https://github.com/dhuertas/DES/blob/master/des.c 5 | // His citation is below 6 | /* 7 | * Data Encryption Standard 8 | * An approach to DES algorithm 9 | * 10 | * By: Daniel Huertas Gonzalez 11 | * Email: huertas.dani@gmail.com 12 | * Version: 0.1 13 | * 14 | * Based on the document FIPS PUB 46-3 15 | */ 16 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/BroadcastAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | // [C706] § 4.2.22.2 - The broadcast attribute 8 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] 9 | public sealed class BroadcastAttribute : Attribute 10 | { 11 | /// 12 | public sealed override bool Match(object? obj) => (obj is BroadcastAttribute); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/net/Titanis.Ssh/SshString.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Titanis.PduStruct; 7 | 8 | namespace Titanis.Ssh 9 | { 10 | [PduStruct] 11 | [PduByteOrder(PduByteOrder.BigEndian)] 12 | partial struct SshString 13 | { 14 | internal uint length; 15 | 16 | [PduString(System.Runtime.InteropServices.CharSet.Ansi, nameof(length))] 17 | internal string str; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/IdempotentAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | // [C706] Š 4.2.22.1 - The idempotent Attribute 8 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] 9 | public sealed class IdempotentAttribute : Attribute 10 | { 11 | /// 12 | public sealed override bool Match(object? obj) => (obj is IdempotentAttribute); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/RpcPointerType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | /// 8 | /// Specifies the type of RPC pointer. 9 | /// 10 | // [C706] § 4.2.20.1 - Pointers / Syntax 11 | public enum RpcPointerType 12 | { 13 | Default = 0, 14 | Unique, 15 | Ptr, 16 | Ref, 17 | 18 | // TODO: Separate this to a separate enum 19 | DisableConsistencyCheck, 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/RequestPdu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc.WireProtocol 6 | { 7 | class RequestPdu 8 | { 9 | internal readonly RequestPduHeader header; 10 | 11 | public RequestPdu(RequestPduHeader header) 12 | { 13 | this.header = header; 14 | } 15 | 16 | public Guid ObjectId { get; internal set; } 17 | public ReadOnlyMemory StubData { get; internal set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/CommandFrame.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading; 5 | 6 | namespace Titanis.Cli 7 | { 8 | internal class CommandFrame 9 | { 10 | public CommandFrame(CommandFrame? parent) 11 | { 12 | this.CancellationSource = new CancellationTokenSource(); 13 | this.Parent = parent; 14 | } 15 | 16 | public CancellationTokenSource CancellationSource { get; } 17 | public CommandFrame? Parent { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/compat/MaybeNullAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | #pragma warning disable IDE0130 // Namespace does not match folder structure 6 | namespace System 7 | #pragma warning restore IDE0130 // Namespace does not match folder structure 8 | { 9 | [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.ReturnValue)] 10 | public sealed class MaybeNullAttribute : Attribute 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/compat/NullableAttributes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | #pragma warning disable IDE0130 // Namespace does not match folder structure 6 | namespace System.Diagnostics.CodeAnalysis 7 | #pragma warning restore IDE0130 // Namespace does not match folder structure 8 | { 9 | [AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = true)] 10 | internal class AllowNullAttribute : Attribute 11 | { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/BindNakPduHeader.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 6 | struct BindNakPduHeader 7 | { 8 | public static unsafe int StructSize => sizeof(BindNakPduHeader); 9 | 10 | internal BindRejectReason provider_reject_reason; 11 | 12 | public BindNakPduHeader(BindRejectReason reason) 13 | { 14 | this.provider_reject_reason = reason; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2OpenFileAttributes.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 6 | public struct Smb2OpenFileAttributes 7 | { 8 | internal long creationTime; 9 | internal long lastAccessTime; 10 | internal long lastWriteTime; 11 | internal long changeTime; 12 | internal long allocationSize; 13 | internal long endOfFile; 14 | 15 | internal Winterop.FileAttributes fileAttributes; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/security/Titanis.Security/AuthTraceContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Security 6 | { 7 | /// 8 | /// Implements an authentication context used for tracing. 9 | /// 10 | public abstract class AuthTraceContext 11 | { 12 | public abstract ReadOnlySpan AcceptToken(ReadOnlySpan token); 13 | public abstract ReadOnlySpan InitializeWithToken(ReadOnlySpan token); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/CommandSample/TimeParameters.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Titanis; 8 | using Titanis.Cli; 9 | 10 | namespace CommandSample 11 | { 12 | internal class TimeParameters : ParameterGroupBase 13 | { 14 | [Parameter] 15 | [Description("Duration to run the loop")] 16 | [DefaultValue("5s")] 17 | public Duration? Duration { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/FileSizeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis 6 | { 7 | /// 8 | /// Marks a property or class as a file size. 9 | /// 10 | /// 11 | /// Consumers may use this as a hint to format the value for display. 12 | /// 13 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] 14 | public sealed class FileSizeAttribute : Attribute 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2ChangeFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | [Flags] 6 | public enum Smb2ChangeFilter : uint 7 | { 8 | None = 0, 9 | 10 | FileName = 1, 11 | DirName = 2, 12 | Attributes = 4, 13 | Size = 8, 14 | LastWrite = 0x10, 15 | LastAccess = 0x20, 16 | Creation = 0x40, 17 | ExtendedAttributes = 0x80, 18 | Security = 0x100, 19 | StreamName = 0x200, 20 | StreamSize = 0x400, 21 | StreamWrite = 0x800, 22 | 23 | All = 0x0FFF, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mslsar/LsaSecret.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Titanis.DceRpc; 4 | 5 | namespace Titanis.Msrpc.Mslsar 6 | { 7 | public class LsaSecret : LsaObject 8 | { 9 | internal LsaSecret(LsaClient lsaClient, RpcContextHandle handle) 10 | : base(lsaClient, handle) 11 | { 12 | } 13 | 14 | public Task QueryInfo(CancellationToken cancellationToken) 15 | => this._lsaClient.GetSecret(this._handle, cancellationToken); 16 | } 17 | } -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamUserHomeInfo.cs: -------------------------------------------------------------------------------- 1 | using ms_samr; 2 | using System; 3 | 4 | namespace Titanis.Msrpc.Mssamr 5 | { 6 | public class SamUserHomeInfo 7 | { 8 | private SAMPR_USER_HOME_INFORMATION info; 9 | 10 | internal SamUserHomeInfo(in SAMPR_USER_HOME_INFORMATION info) 11 | { 12 | this.info = info; 13 | } 14 | 15 | public string HomeDirectory => this.info.HomeDirectory.AsString(); 16 | public string HomeDirectoryDrive => this.info.HomeDirectoryDrive.AsString(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr/ScmLock.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | using System.Threading.Tasks; 3 | using Titanis.DceRpc; 4 | 5 | namespace Titanis.Msrpc.Msscmr 6 | { 7 | public sealed class ScmLock : ServiceRpcObjectBase 8 | { 9 | public ScmLock(RpcContextHandle handle, ScmClient client) : base(handle, client) 10 | { 11 | } 12 | 13 | protected sealed override Task CloseAsync(CancellationToken cancellationToken) 14 | => this.client.UnlockScm(this.handle, cancellationToken); 15 | } 16 | } -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/ReflectDeletionsAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | // [C706] § 4.2.22.4 - The reflect_deletions Attribute 8 | [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] 9 | public sealed class ReflectDeletionsAttribute : Attribute 10 | { 11 | /// 12 | public sealed override bool Match(object? obj) => (obj is ReflectDeletionsAttribute); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/BindPdu.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.DceRpc.WireProtocol 2 | { 3 | // [C706] Š 12.6.4.3 - The bind PDU 4 | [PduStruct] 5 | public partial class BindPdu 6 | { 7 | internal ushort max_xmit_frag; 8 | internal ushort max_recv_frag; 9 | internal uint assoc_group_id; 10 | internal PresContextList contextList; 11 | 12 | public BindPdu() 13 | { 14 | 15 | } 16 | public BindPdu(params PresContext[] contexts) 17 | { 18 | this.contextList.contexts = contexts; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduArgumentsAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis 6 | { 7 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true, AllowMultiple = false)] 8 | public sealed class PduArgumentsAttribute : Attribute 9 | { 10 | public PduArgumentsAttribute(params string[] memberNames) 11 | { 12 | this.MemberNames = memberNames; 13 | } 14 | 15 | public string[] MemberNames { get; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/KrbMessageType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] 4 | 5 | namespace Titanis.Security.Kerberos 6 | { 7 | // [RFC 4120] § 5.10. Application Tag Numbers 8 | enum KrbMessageType 9 | { 10 | Asreq = 10, 11 | Asrep = 11, 12 | Tgsreq = 12, 13 | Tgsrep = 13, 14 | Apreq = 14, 15 | Aprep = 15, 16 | Priv = 21, 17 | Cred = 22, 18 | 19 | // [MS-SFU] § 2.2.1 20 | PaForUser = 17, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BuildToolDocIndex/BuildToolDocIndex.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamDomainModifiedInfo.cs: -------------------------------------------------------------------------------- 1 | using ms_samr; 2 | using System; 3 | 4 | namespace Titanis.Msrpc.Mssamr 5 | { 6 | public class SamDomainModifiedInfo 7 | { 8 | private DOMAIN_MODIFIED_INFORMATION info; 9 | 10 | internal SamDomainModifiedInfo(DOMAIN_MODIFIED_INFORMATION info) 11 | { 12 | this.info = info; 13 | } 14 | 15 | public long Usn => this.info.DomainModifiedCount.AsInt64(); 16 | public DateTime CreationTime => DateTime.FromFileTime(this.info.CreationTime.AsInt64()); 17 | } 18 | } -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/PacOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.CompilerServices; 3 | 4 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] 5 | 6 | namespace Titanis.Security.Kerberos 7 | { 8 | [Flags] 9 | enum PacOptions : uint 10 | { 11 | // [MS-KILE] § 2.2.10 12 | None = 0, 13 | Claims = (1U << 31), 14 | BranchAware = (1U << 30), 15 | ForwardToFullDc = (1U << 29), 16 | 17 | // [MS-SFU] § 2.2.5 18 | ResourceBasedConstrainedDelegation = (1U << 28), 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Asn1BuiltinValues.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1 6 | { 7 | public static class Asn1BuiltinValues 8 | { 9 | public static object True = true; 10 | public static object False = false; 11 | 12 | public static object RealZero = 0.0; 13 | public static object NaN = double.NaN; 14 | public static object PlusInfinity = double.PositiveInfinity; 15 | public static object MinusInfinity = double.NegativeInfinity; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mslsar/LsaAccountMapping.cs: -------------------------------------------------------------------------------- 1 | 2 | using Titanis.Winterop.Security; 3 | 4 | namespace Titanis.Msrpc.Mslsar 5 | { 6 | public class LsaAccountMapping 7 | { 8 | public string AccountName { get; set; } 9 | public LsaNameType NameType { get; internal set; } 10 | public string? DomainName { get; internal set; } 11 | public SecurityIdentifier? DomainSid { get; internal set; } 12 | public uint? AccountRid { get; internal set; } 13 | public SecurityIdentifier? AccountSid { get; internal set; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/base/Titanis.Cli/SubcommandAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] 8 | public class SubcommandAttribute : Attribute 9 | { 10 | public SubcommandAttribute(string name, Type handlerType) 11 | { 12 | this.Name = name; 13 | this.CommandType = handlerType; 14 | } 15 | 16 | public string Name { get; } 17 | public Type CommandType { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/Client/IRpcRequestBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.DceRpc.Client 8 | { 9 | /// 10 | /// Builds a request for an RPC call. 11 | /// 12 | /// 13 | /// This interface in primarily used by code generated for proxy methods. 14 | /// 15 | public interface IRpcRequestBuilder 16 | { 17 | IRpcEncoder StubData { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /samples/TerminalLogSample/TerminalLogSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/compat/ArraySegmentExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | #pragma warning disable IDE0130 // Namespace does not match folder structure 6 | namespace Titanis 7 | #pragma warning restore IDE0130 // Namespace does not match folder structure 8 | { 9 | public static class ArraySegmentExtensions 10 | { 11 | public static ref T Item(this ArraySegment segment, int index) 12 | { 13 | return ref segment.Array[segment.Offset + index]; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/net/Titanis.Socks/SocksResultCode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Socks 8 | { 9 | public enum Socks5ResultCode : byte 10 | { 11 | Success = 0, 12 | GeneralServerFailure = 1, 13 | ConnectionNotAllowedByRuleset = 2, 14 | NetworkUnreachable = 3, 15 | HostUnreachable = 4, 16 | ConnectionRefused = 5, 17 | TtlExpired = 6, 18 | CommandNotSupported = 7, 19 | AddressTypeNotSupported = 8, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/PacBufferType.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Security.Kerberos 2 | { 3 | enum PacBufferType 4 | { 5 | LogonInfo = 1, 6 | CredentialInfo = 2, 7 | ServerChecksum = 6, 8 | KdcChecksum = 7, 9 | ClientNameInfo = 0x0A, 10 | ConstrainedDelegationInfo = 11, 11 | UserPrincipalName = 12, 12 | ClientClaims = 13, 13 | DeviceInfo = 14, 14 | DeviceClaims = 15, 15 | TicketChecksum = 16, 16 | PacAttributes = 17, 17 | PacRequestorSid = 18, 18 | ExtendedKdcChecksum = 19, 19 | PacRequestorGuid = 20, 20 | } 21 | } -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Serialization/IAsn1DerEncodable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1.Serialization 6 | { 7 | /// 8 | /// Exposes functionality to encode or decode a value using ASN.1 DER. 9 | /// 10 | public interface IAsn1DerEncodableValue 11 | { 12 | void EncodeValue(Asn1DerEncoder encoder); 13 | } 14 | 15 | public interface IAsn1DerDecodableValue 16 | { 17 | static abstract TSelf DecodeValueFrom(Asn1DerDecoder decoder); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/ContextResultListHeader.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 6 | struct ContextResultListHeader 7 | { 8 | public unsafe static int StructSize => sizeof(ContextResultListHeader); 9 | 10 | internal byte n_results; /* count */ 11 | internal byte reserved; /* alignment pad, m.b.z. */ 12 | internal ushort reserved2; /* alignment pad, m.b.z. */ 13 | //p_result_t[size_is(n_results)] p_results[]; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Cipher.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Smb2 2 | { 3 | /// 4 | /// Specifies a cipher within SMB2. 5 | /// 6 | public enum Cipher : ushort 7 | { 8 | None = 0, 9 | 10 | /// 11 | /// AES-128-CCM 12 | /// 13 | Aes128Ccm = 1, 14 | /// 15 | /// AES-128-GCM 16 | /// 17 | Aes128Gcm = 2, 18 | /// 19 | /// AES-256-CCM 20 | /// 21 | Aes256Ccm = 3, 22 | /// 23 | /// AES-256-GCM 24 | /// 25 | Aes256Gcm = 4, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamUserPreferencesInfo.cs: -------------------------------------------------------------------------------- 1 | using ms_samr; 2 | using System; 3 | 4 | namespace Titanis.Msrpc.Mssamr 5 | { 6 | public class SamUserPreferencesInfo 7 | { 8 | private SAMPR_USER_PREFERENCES_INFORMATION info; 9 | 10 | internal SamUserPreferencesInfo(in SAMPR_USER_PREFERENCES_INFORMATION info) 11 | { 12 | this.info = info; 13 | } 14 | 15 | public string UserComment => this.info.UserComment.AsString(); 16 | public int CountryCode => this.info.CountryCode; 17 | public int CodePage => this.info.CodePage; 18 | } 19 | } -------------------------------------------------------------------------------- /src/security/Titanis.Security/PrincipalNameType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] 4 | 5 | namespace Titanis.Security 6 | { 7 | // [RFC 4120] 6.2 § Principal Names 8 | public enum PrincipalNameType : int // Underlying type used by CCache serializer 9 | { 10 | Unknown = 0, 11 | Principal = 1, 12 | ServiceInstance = 2, 13 | ServiceHost = 3, 14 | ServiceXHost = 4, 15 | UniqueId = 5, 16 | X500Principal = 6, 17 | SmtpName = 7, 18 | Enterprise = 10, 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Asn1TagClass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1 6 | { 7 | public enum Asn1TagClass : byte 8 | { 9 | Universal = 0, 10 | Application = 0x40, 11 | Context = 0x80, 12 | Private = 0xC0, 13 | 14 | Mask = 0xC0, 15 | } 16 | [Flags] 17 | public enum Asn1TagFlags : byte 18 | { 19 | Universal = 0, 20 | Constructed = 0x20, 21 | Application = 0x40, 22 | Context = 0x80, 23 | Private = 0xC0, 24 | 25 | Mask = 0xE0, 26 | ClassMask = 0xC0, 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Serialization/Asn1Encoding.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Numerics; 4 | using System.Text; 5 | using Titanis.IO; 6 | 7 | namespace Titanis.Asn1.Serialization 8 | { 9 | public abstract class Asn1Encoding 10 | { 11 | public abstract Asn1Encoder CreateEncoder(); 12 | public abstract Asn1Decoder CreateDecoder(IByteSource reader); 13 | public Asn1Decoder CreateDecoder(ReadOnlyMemory buffer) 14 | { 15 | return this.CreateDecoder(new ByteMemoryReader(buffer)); 16 | } 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/RpcAuthLevel.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.DceRpc 2 | { 3 | /// 4 | /// Specifies the authentication level of an RPC channel. 5 | /// 6 | // [MS-RPCE] § 2.2.1.1.8 - Authentication Levels 7 | public enum RpcAuthLevel : sbyte 8 | { 9 | Default = 0, 10 | None = 1, 11 | Connect = 2, 12 | Call = 3, 13 | Packet = 4, 14 | PacketIntegrity = 5, 15 | PacketPrivacy = 6, 16 | 17 | // Titanis-specific 18 | // Uses the configured default value (if set), otherwise Default 19 | ConfiguredDefault = -1, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/BindRejectReason.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.DceRpc.WireProtocol 2 | { 3 | public enum BindRejectReason : ushort 4 | { 5 | // [C706] 6 | Unspecified = 0, 7 | TemporaryCongestion = 1, 8 | LocalLimitExceeded = 2, 9 | CalledPaddrUnknown = 3, 10 | ProtocolVersionNotSupported = 4, 11 | DefaultContextNotSupported = 5, 12 | UserdataNotReadable = 6, 13 | NoPsapAvailable = 7, 14 | 15 | // [MS-RPCE] § 2.2.2.5 - New Reasons for Bind Rejection 16 | AuthenticationTypeNotRecognized = 8, 17 | InvalidChecksum = 9, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamAliasGeneralInfo.cs: -------------------------------------------------------------------------------- 1 | using ms_samr; 2 | using System; 3 | 4 | namespace Titanis.Msrpc.Mssamr 5 | { 6 | public class SamAliasGeneralInfo 7 | { 8 | private readonly SAMPR_ALIAS_GENERAL_INFORMATION info; 9 | 10 | internal SamAliasGeneralInfo(SAMPR_ALIAS_GENERAL_INFORMATION info) 11 | { 12 | this.info = info; 13 | } 14 | 15 | public string AliasName => this.info.Name.AsString(); 16 | public int MemberCount => (int)this.info.MemberCount; 17 | public string AdminComment => this.info.AdminComment.AsString(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/FileStreamInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Smb2 8 | { 9 | public struct FileStreamInfo 10 | { 11 | public FileStreamInfo(string name, long size, long allocationSize) 12 | { 13 | this.Name = name; 14 | this.Size = size; 15 | this.AllocationSize = allocationSize; 16 | } 17 | 18 | public string Name { get; } 19 | public long Size { get; set; } 20 | public long AllocationSize { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/LogFormat.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis 2 | { 3 | /// 4 | /// Specifies the output format of a log. 5 | /// 6 | public enum LogFormat 7 | { 8 | /// 9 | /// Messages are written as human-readable text. 10 | /// 11 | Text, 12 | /// 13 | /// Messages are written as human-readable text and prefixed with an ISO-formatted UTC timestamp. 14 | /// 15 | TextWithTimestamp, 16 | /// 17 | /// Messages are written as JSON objects. 18 | /// 19 | Json, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/Tracing/RpcTraceTransport.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | using Titanis.DceRpc.Communication; 5 | 6 | namespace Titanis.DceRpc.Tracing 7 | { 8 | internal class RpcTraceTransport : RpcTransport 9 | { 10 | public RpcTraceTransport() : base(8192) 11 | { 12 | } 13 | 14 | public override int MajorVersionNumber => 5; 15 | 16 | public override Task SendPduAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/NdrContextHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | namespace Titanis.DceRpc 7 | { 8 | // [C706] ndr_context_handle 9 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 10 | public struct NdrContextHandle 11 | { 12 | public unsafe static int StructSize => sizeof(NdrContextHandle); 13 | 14 | internal int context_handle_attributes; 15 | internal Guid context_handle_uuid; 16 | 17 | public bool IsEmpty => this.context_handle_uuid == Guid.Empty; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/BindAckPdu.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc.WireProtocol 6 | { 7 | class BindAckPdu 8 | { 9 | internal BindAckPduHeader header; 10 | internal PortAny secondaryAddress; 11 | internal PresContextResult[] contextResults; 12 | 13 | public BindAckPdu() 14 | { 15 | 16 | } 17 | 18 | public BindAckPdu(BindAckPduHeader header, PortAny secondaryAddress) 19 | { 20 | this.header = header; 21 | this.secondaryAddress = secondaryAddress; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/ISmbOptionsService.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Smb2 2 | { 3 | /// 4 | /// Provides functionality to get the options for a specific server. 5 | /// 6 | public interface ISmbOptionsService 7 | { 8 | /// 9 | /// Gets the options for a server. 10 | /// 11 | /// Name of the server 12 | /// matching the server, if found; otherwise, 13 | Smb2ConnectionOptions? GetConnectionOptionsFor(string serverName); 14 | } 15 | } -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mslsar/SystemAccessRights.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Mslsar 4 | { 5 | [Flags] 6 | public enum SystemAccessRights 7 | { 8 | None = 0, 9 | 10 | SeInteractiveLogonRight = 1, 11 | SeNetworkLogonRight = 2, 12 | SeBatchLogonRight = 4, 13 | SeServiceLogonRight = 0x10, 14 | SeDenyInteractiveLogonRight = 0x40, 15 | SeDenyNetworkLogonRight = 0x80, 16 | SeDenyBatchLogonRight = 0x100, 17 | SeDenyServiceLogonRight = 0x200, 18 | SeRemoteInteractiveLogonRight = 0x400, 19 | SeDenyRemoteInteractiveLogonRight = 0x800 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/security/Titanis.Certificates/Titanis.Certificates.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Pdus/Smb2Command.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Smb2.Pdus 2 | { 3 | // [MS-SMB2] § 2.2.1.1 - SMB2 Packet Header - ASYNC 4 | enum Smb2Command : ushort 5 | { 6 | Negotiate = 0, 7 | SessionSetup = 1, 8 | Logoff = 2, 9 | TreeConnect = 3, 10 | TreeDisconnect = 4, 11 | Create = 5, 12 | Close = 6, 13 | Flush = 7, 14 | Read = 8, 15 | Write = 9, 16 | Lock = 0xA, 17 | Ioctl = 0x0B, 18 | Cancel = 0x0C, 19 | Echo = 0x0D, 20 | QueryDirectory = 0x0E, 21 | ChangeNotify = 0x0F, 22 | QueryInfo = 0x10, 23 | SetInfo = 0x11, 24 | OplockBreak = 0x12, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceAccess.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Msrpc.Msscmr 6 | { 7 | [Flags] 8 | public enum ServiceAccess 9 | { 10 | None = 0, 11 | 12 | QueryConfig = 0x0001, 13 | ChangeConfig = 0x0002, 14 | QueryStatus = 0x0004, 15 | EnumerateDependents = 0x0008, 16 | Start = 0x0010, 17 | Stop = 0x0020, 18 | PauseContinue = 0x0040, 19 | Interrogate = 0x0080, 20 | UserDefinedControl = 0x0100, 21 | AllRights = 0x000F01FF, 22 | 23 | MaxAllowed = 0x02000000, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/AttributeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Reflection; 4 | 5 | 6 | namespace Titanis 7 | { 8 | public static class AttributeExtensions 9 | { 10 | public static TValue? GetAttributeValue( 11 | this Type type, 12 | Func valueSelector) 13 | where TAttribute : Attribute 14 | { 15 | if (type.GetTypeInfo().GetCustomAttributes(typeof(TAttribute), true).FirstOrDefault() is TAttribute attr) 16 | { 17 | return valueSelector(attr); 18 | } 19 | return default(TValue); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduStructAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis 6 | { 7 | /// 8 | /// Marks a type as being used in a PDU. 9 | /// 10 | /// 11 | /// When a type is marked with this attribute, the source generator generates 12 | /// an implementation for IPduStruct. 13 | /// 14 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] 15 | public sealed class PduStructAttribute : Attribute 16 | { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/RequestPduHeader.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | // [C706] § 12.6.4.9 6 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 7 | public struct RequestPduHeader 8 | { 9 | public static unsafe int StructSize => sizeof(RequestPduHeader); 10 | public static unsafe int StructSizeWithObjectId => sizeof(RequestPduHeader) + 16; 11 | 12 | internal uint alloc_hint; /* 16:04 allocation hint */ 13 | internal ushort p_cont_id; /* 20:02 pres context, i.e. data rep */ 14 | internal ushort opnum; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mslsar/PolicySystemAccessMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Mslsar 4 | { 5 | // [MS-LSAD] § 2.2.1.1.5 ACCESS_MASK for Trusted Domain Objects 6 | [Flags] 7 | public enum PolicySystemAccessMode : uint 8 | { 9 | NoAccess = 0, 10 | 11 | Interactive = 1, 12 | Network = 2, 13 | Batch = 4, 14 | Service = 0x10, 15 | DenyInteractive = 0x40, 16 | DenyNetwork = 0x80, 17 | DenyBatch = 0x100, 18 | DenyService = 0x200, 19 | RemoteInteractive = 0x400, 20 | DenyRemoteInteractive = 0x800, 21 | All = 0xFF7, 22 | AllNT4 = 0x37, 23 | } 24 | 25 | 26 | } -------------------------------------------------------------------------------- /src/security/Titanis.Security.Ntlm/NtlmTraceContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Security.Ntlm 8 | { 9 | public class NtlmTraceContext : AuthTraceContext 10 | { 11 | public override ReadOnlySpan AcceptToken(ReadOnlySpan token) 12 | { 13 | throw new NotImplementedException(); 14 | } 15 | 16 | public override ReadOnlySpan InitializeWithToken(ReadOnlySpan token) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/IDocWriter.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics; 3 | using static System.Net.Mime.MediaTypeNames; 4 | 5 | namespace Titanis.Cli 6 | { 7 | public interface IDocWriter 8 | { 9 | IDocWriter WriteHeading(string text); 10 | IDocWriter WriteSubheading(string text); 11 | IDocWriter WriteBodyText(string text); 12 | IDocWriter WriteBodyTextLine(string? text); 13 | IDocWriter AppendLine(); 14 | 15 | IDocWriter WriteTable(TextTable table, params string[] columnNames); 16 | abstract void BeginCodeBlock(); 17 | abstract void EndCodeBlock(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/IRpcCallback.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Titanis.DceRpc.Client; 8 | using Titanis.Net; 9 | using Titanis.Security; 10 | 11 | namespace Titanis.DceRpc 12 | { 13 | [Callback] 14 | public interface IRpcCallback 15 | { 16 | void OnBindingProxy(RpcClientProxy proxy, RpcClientChannel channel, AuthClientContext? authContext, RpcAuthLevel authLevel); 17 | void OnConnectingProxy(ISocket socket, EndPoint serviceEP, RpcClientProxy proxy); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/Documentation/SpecTypes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Documentation 6 | { 7 | /// 8 | /// Names of common types of specifications 9 | /// 10 | public class SpecTypes 11 | { 12 | /// 13 | /// Internet Engineering Task Force Request for Comments 14 | /// 15 | public const string IetfRfc = "IETF RFC"; 16 | /// 17 | /// Microsoft Open Specification 18 | /// 19 | public const string MsOpenSpec = "Microsoft Open Specification"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/net/Titanis.X11/Titanis.X11.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr/ServiceRpcObjectBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Titanis.DceRpc; 7 | 8 | namespace Titanis.Msrpc.Msscmr 9 | { 10 | /// 11 | /// Represents an object managed by . 12 | /// 13 | public abstract class ServiceRpcObjectBase : RpcContextObjecBase 14 | { 15 | private protected ServiceRpcObjectBase(RpcContextHandle handle, ScmClient client) 16 | : base(handle, client) 17 | { 18 | } 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamDomainModifiedInfo2.cs: -------------------------------------------------------------------------------- 1 | using ms_samr; 2 | using System; 3 | 4 | namespace Titanis.Msrpc.Mssamr 5 | { 6 | public class SamDomainModifiedInfo2 7 | { 8 | private DOMAIN_MODIFIED_INFORMATION2 info; 9 | 10 | internal SamDomainModifiedInfo2(DOMAIN_MODIFIED_INFORMATION2 info) 11 | { 12 | this.info = info; 13 | } 14 | 15 | public long Usn => this.info.DomainModifiedCount.AsInt64(); 16 | public DateTime CreationTime => DateTime.FromFileTime(this.info.CreationTime.AsInt64()); 17 | public long LastPromotionUsn => this.info.ModifiedCountAtLastPromotion.AsInt64(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/EncChecksumType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] 4 | 5 | namespace Titanis.Security.Kerberos 6 | { 7 | enum EncChecksumType 8 | { 9 | // [RFC 3961] § 8 10 | Crc32 = 1, 11 | RsaMd4 = 2, 12 | rsaMd4Des = 3, 13 | DesMac = 4, 14 | DesMacK = 5, 15 | RsaMd4DesK = 6, 16 | RsaMd5 = 7, 17 | RsaMd5Des = 8, 18 | Sha1 = -131, 19 | 20 | // [RFC 3962] § 7 21 | HmacSha1_96_Aes128 = 15, 22 | HmacSha1_96_Aes256 = 16, 23 | 24 | // [RFC 4757] 4. 25 | HmacMd5String = -138, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Ntlm/NtlmNegotiateMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Titanis.IO; 5 | 6 | namespace Titanis.Security.Ntlm 7 | { 8 | public class NtlmNegotiateMessage 9 | { 10 | public NegotiateHeader hdr; 11 | public string? workstationName; 12 | public string? workstationDomain; 13 | 14 | public static NtlmNegotiateMessage Parse(ReadOnlySpan token) 15 | { 16 | ByteMemoryReader reader = new ByteMemoryReader(token.ToArray()); 17 | NtlmNegotiateMessage msg = reader.ReadNegotiate(); 18 | return msg; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/ITerminal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace Titanis.Cli 7 | { 8 | public interface ITerminal 9 | { 10 | int Width { get; } 11 | 12 | TextWriter OutputWriter { get; } 13 | void WriteOutput(string? text); 14 | void WriteOutputLine(string? text); 15 | void WriteError(string? text); 16 | void WriteErrorLine(string? text); 17 | void PushTextColor(ConsoleColor color); 18 | void PopTextColor(); 19 | void WriteFormattedOutput(FormattedText text); 20 | void WriteFormattedError(FormattedText text); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/ITypeVisitor.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Asn1.Metadata 2 | { 3 | public interface ITypeVisitor 4 | { 5 | T Visit(Asn1AnyType type); 6 | T Visit(Asn1BitStringType type); 7 | T Visit(Asn1ChoiceType type); 8 | T Visit(Asn1ConstrainedType type); 9 | T Visit(Asn1SetType type); 10 | T Visit(Asn1SequenceType type); 11 | T Visit(Asn1SetOfType type); 12 | T Visit(Asn1EnumeratedType type); 13 | T Visit(Asn1SequenceOfType type); 14 | T Visit(Asn1UnresolvedType type); 15 | T Visit(Asn1IntegerType type); 16 | T Visit(Asn1TaggedType type); 17 | T Visit(Asn1PrimitiveType type); 18 | } 19 | } -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/RpcAuthType.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.DceRpc 2 | { 3 | // [MS-RPCE] § 2.2.1.1.7 - Security Providers 4 | public enum RpcAuthType : byte 5 | { 6 | None = 0, 7 | //Kerberos5=1, 8 | Ntlm = 10, 9 | 10 | Spnego = 9, 11 | Tls = 0x0E, 12 | Kerberos = 0x10, 13 | Netlogon = 0x44, 14 | Default = 0xFF, 15 | 16 | // [MSDN] Authentication-Service Constants 17 | DcePrivateKey = 1, 18 | DcePublic = 2, 19 | DecPublicKey = 4, 20 | DistributedPasswordAuthentication = 17, 21 | MicrosoftNetwork = 18, 22 | Digest = 21, 23 | NegoExtender = 30, 24 | MicrosoftMessageQueue = 100, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2ShareFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Smb2 4 | { 5 | [Flags] 6 | public enum Smb2ShareFlags : uint 7 | { 8 | None = 0, 9 | 10 | ManualCaching = 0, 11 | AutoCaching = 0x10, 12 | VdoCaching = 0x20, 13 | NoCaching = 0x30, 14 | Dfs = 1, 15 | DfsRoot = 2, 16 | RestrictExclusiveOpens = 0x100, 17 | ForceSharedDelete = 0x200, 18 | AllowNamespaceCaching = 0x400, 19 | AccessBasedDirectoryEnum = 0x800, 20 | ForceLevel2Oplock = 0x1000, 21 | EnableHashV1 = 0x2000, 22 | EnableHashV2 = 0x4000, 23 | EncryptData = 0x8000, 24 | IdentityRemoting = 0x00040000 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr/Security/ServiceAuditRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Security.AccessControl; 4 | using System.Security.Principal; 5 | using System.Text; 6 | 7 | namespace Titanis.Msrpc.Msscmr.Security 8 | { 9 | public class ServiceAuditRule : AuditRule 10 | { 11 | public ServiceAuditRule(IdentityReference identity, int accessMask, bool isInherited, InheritanceFlags inheritanceFlags, PropagationFlags propagationFlags, AuditFlags auditFlags) : base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags, auditFlags) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/WorkflowSample/WorkflowSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/CopyChunk.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Smb2 2 | { 3 | public partial class Smb2OpenFileObjectBase 4 | { 5 | public struct CopyChunk 6 | { 7 | public const int StructSize = 24; 8 | 9 | public CopyChunk( 10 | long sourceOffset, 11 | long targetOffset, 12 | int length 13 | ) 14 | { 15 | this.sourceOffset = sourceOffset; 16 | this.targetOffset = targetOffset; 17 | this.length = length; 18 | this.reserved = 0; 19 | } 20 | 21 | public long sourceOffset; 22 | public long targetOffset; 23 | public int length; 24 | private readonly int reserved; 25 | } 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2Priority.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Smb2 8 | { 9 | public enum Smb2Priority : byte 10 | { 11 | Negotiate = 1, 12 | CreateDir = 3, 13 | OpenDir = 3, 14 | SessionSetup = 1, 15 | TreeConnect = 1, 16 | TreeDisconnect = 1, 17 | Close = 1, 18 | Logoff = 1, 19 | ChangeNotify = 3, 20 | Read = 3, 21 | 22 | /// 23 | /// Used for PDUs where the standard behavior is unknown 24 | /// 25 | Unknown = 0, 26 | 27 | Mask = 7, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr/ServiceConfig.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Msscmr 2 | { 3 | public class ServiceConfig 4 | { 5 | public ServiceTypes ServiceType { get; set; } 6 | public ServiceStartType StartType { get; set; } 7 | public ServiceErrorControl ErrorControl { get; set; } 8 | public string BinaryPathName { get; set; } 9 | public string LoadOrderGroup { get; set; } 10 | public int TagId { get; set; } 11 | public string[] Dependencies { get; set; } 12 | public string ServiceStartName { get; set; } 13 | public string DisplayName { get; set; } 14 | 15 | public string StartPassword { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduConditionalAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.PduStruct 6 | { 7 | /// 8 | /// Marks a field as being optional. 9 | /// 10 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)] 11 | public sealed class PduConditionalAttribute : Attribute 12 | { 13 | public PduConditionalAttribute(string conditionFieldName) 14 | { 15 | this.ConditionFieldName = conditionFieldName; 16 | } 17 | 18 | public string ConditionFieldName { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1ContainedSubtypeConstraint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1.Metadata 6 | { 7 | public sealed class Asn1ContainedSubtypeConstraint : Asn1Constraint 8 | { 9 | public Asn1ContainedSubtypeConstraint(Asn1Type baseType) 10 | { 11 | if (baseType is null) 12 | throw new ArgumentNullException(nameof(baseType)); 13 | 14 | this.Subtype = baseType; 15 | } 16 | 17 | public Asn1Type Subtype { get; } 18 | 19 | /// 20 | public sealed override string ToString() => this.Subtype.ToString(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1NamedBit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1.Metadata 6 | { 7 | public sealed class Asn1NamedNumber 8 | { 9 | public Asn1NamedNumber(string name, long value) 10 | { 11 | if (string.IsNullOrEmpty(name)) 12 | throw new ArgumentNullException(nameof(name)); 13 | 14 | this.Name = name; 15 | this.Value = value; 16 | } 17 | 18 | /// 19 | public sealed override string ToString() => $"{this.Name}({this.Value})"; 20 | 21 | public string Name { get; } 22 | public long Value { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/IRpcStruct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | /// 8 | /// Provides functionality to encode and decode a structure. 9 | /// 10 | public interface IRpcStruct 11 | { 12 | /// 13 | /// Encodes the struct. 14 | /// 15 | /// Encoder to receive struct 16 | void Encode(IRpcEncoder encoder); 17 | void EncodeDeferrals(IRpcEncoder encoder); 18 | 19 | void Decode(IRpcDecoder decoder); 20 | void DecodeDeferrals(IRpcDecoder decoder); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/Tracing/RpcTraceChannel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using Titanis.DceRpc.Communication; 8 | using Titanis.DceRpc.WireProtocol; 9 | 10 | namespace Titanis.DceRpc.Tracing 11 | { 12 | public class RpcTraceChannel : RpcChannel 13 | { 14 | public RpcTraceChannel() : base(new RpcTraceTransport(), Timeout.InfiniteTimeSpan, null) 15 | { 16 | } 17 | 18 | internal sealed override void OnTransportAborted(Exception? exception) 19 | { 20 | // Do nothing 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/PduType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc.WireProtocol 6 | { 7 | public enum PduType : byte 8 | { 9 | Request = 0, 10 | Ping = 1, 11 | Response = 2, 12 | Fault = 3, 13 | Working = 4, 14 | NoCall = 5, 15 | Reject = 6, 16 | Ack = 7, 17 | CLCancel = 8, 18 | Fack = 9, 19 | CancelAck = 10, 20 | Bind = 11, 21 | BindAck = 12, 22 | BindNak = 13, 23 | AlterContext = 14, 24 | AlterContextResp = 15, 25 | Shutdown = 17, 26 | CoCancel = 18, 27 | Orphaned = 19, 28 | 29 | Auth3 = 16, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/base/Titanis.Winterop.FileInfo/FileAttributes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Winterop 4 | { 5 | // [MS-FSCC] § 2.6 - File Attributes 6 | [Flags] 7 | public enum FileAttributes : uint 8 | { 9 | None = 0, 10 | 11 | Archive = 0x20, 12 | Compressed = 0x800, 13 | Directory = 0x10, 14 | Encrypted = 0x4000, 15 | Hidden = 2, 16 | Normal = 0x80, 17 | NotContentIndexed = 0x2000, 18 | Offline = 0x1000, 19 | ReadOnly = 0x01, 20 | ReparsePoint = 0x400, 21 | SparseFile = 0x200, 22 | System = 4, 23 | Temporary = 0x100, 24 | IntegrityStream = 0x8000, 25 | NoScrubData = 0x00020000 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1Enumeration.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1.Metadata 6 | { 7 | /// 8 | /// Describes an enumeration. 9 | /// 10 | public sealed class Asn1Enumeration 11 | { 12 | public Asn1Enumeration(Asn1NamedNumber[] items) 13 | { 14 | if (items.IsNullOrEmpty()) 15 | throw new ArgumentNullException(nameof(items)); 16 | 17 | this.Items = items; 18 | } 19 | 20 | /// 21 | /// Gets the values within the enumeration. 22 | /// 23 | public Asn1NamedNumber[] Items { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1NamedNumber.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1.Metadata 6 | { 7 | public sealed class Asn1NamedBit 8 | { 9 | public Asn1NamedBit(string name, int position) 10 | { 11 | if (string.IsNullOrEmpty(name)) 12 | throw new ArgumentNullException(nameof(name)); 13 | 14 | this.Name = name; 15 | this.Position = position; 16 | } 17 | 18 | /// 19 | public sealed override string ToString() => $"{this.Name}({this.Position})"; 20 | 21 | public string Name { get; } 22 | public int Position { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tools/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | $(ArtifactsPath)/tools 8 | win-x86;win-x64;linux-x64 9 | 10 | True 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/base/Titanis.IO/BufferUnderflowException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.IO 6 | { 7 | public class BufferUnderflowException : Exception 8 | { 9 | public BufferUnderflowException() { } 10 | public BufferUnderflowException(string message) : base(message) { } 11 | public BufferUnderflowException(string message, Exception inner) : base(message, inner) { } 12 | protected BufferUnderflowException( 13 | System.Runtime.Serialization.SerializationInfo info, 14 | System.Runtime.Serialization.StreamingContext context) : base(info, context) { } 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamGroupGeneralInfo.cs: -------------------------------------------------------------------------------- 1 | using ms_samr; 2 | using System; 3 | 4 | namespace Titanis.Msrpc.Mssamr 5 | { 6 | public class SamGroupGeneralInfo 7 | { 8 | private readonly SAMPR_GROUP_GENERAL_INFORMATION info; 9 | 10 | internal SamGroupGeneralInfo(SAMPR_GROUP_GENERAL_INFORMATION info) 11 | { 12 | this.info = info; 13 | } 14 | 15 | public string GroupName => this.info.Name.AsString(); 16 | public SamGroupAttributes Attributes => (SamGroupAttributes)this.info.Attributes; 17 | public int MemberCount => (int)this.info.MemberCount; 18 | public string AdminComment => this.info.AdminComment.AsString(); 19 | } 20 | } -------------------------------------------------------------------------------- /src/base/Titanis.PduStruct/PduStringAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | namespace Titanis.PduStruct 7 | { 8 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, Inherited = true, AllowMultiple = false)] 9 | public sealed class PduStringAttribute : Attribute 10 | { 11 | public PduStringAttribute(CharSet charSet, string lengthMemberName) 12 | { 13 | this.CharSet = charSet; 14 | this.LengthMemberName = lengthMemberName; 15 | } 16 | 17 | public CharSet CharSet { get; } 18 | public string LengthMemberName { get; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/ResumeKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Runtime.InteropServices; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Titanis.Smb2 9 | { 10 | public class ResumeKey 11 | { 12 | public const int KeySize = 24; 13 | 14 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 15 | internal struct ResumeKeyData 16 | { 17 | Guid guid; 18 | int n1; 19 | int n2; 20 | } 21 | 22 | internal readonly ResumeKeyData keyData; 23 | 24 | internal ResumeKey(ref readonly ResumeKeyData data) 25 | { 26 | this.keyData = data; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tools/rpc/Wmi/LsclassCommand.cs: -------------------------------------------------------------------------------- 1 | using ms_wmi; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Titanis.Cli; 9 | using Titanis.Msrpc.Mswmi; 10 | 11 | namespace Wmi; 12 | 13 | /// List the classes within a WMI namespace 14 | [Command] 15 | [Description("Lists the classes within a namespace.")] 16 | [OutputRecordType(typeof(WmiClassObject))] 17 | internal class LsclassCommand : QueryCommandBase 18 | { 19 | protected sealed override string GetQueryText() => "SELECT * FROM meta_class"; 20 | } 21 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mswmi/Wmio/EncodingUnitSignature.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Titanis.IO; 3 | 4 | 5 | namespace Titanis.Msrpc.Mswmi.Wmio 6 | { 7 | // [MS-WMIO] § 2.2.77 - Signature 8 | [PduStruct] 9 | partial struct EncodingUnitSignature 10 | { 11 | internal const uint ValidValue = 0x12345678; 12 | 13 | internal uint value; 14 | 15 | partial void OnBeforeWritePdu(ByteWriter writer) 16 | { 17 | this.value = ValidValue; 18 | } 19 | partial void OnAfterReadPdu(IByteSource source) 20 | { 21 | if (this.value != ValidValue) 22 | throw new InvalidDataException("The data is not a valid WMI EncodingUnit."); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Ntlm/NtlmChallenge.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Titanis.IO; 3 | 4 | namespace Titanis.Security.Ntlm 5 | { 6 | /// 7 | /// Represents the challenge sent by the remote party. 8 | /// 9 | public class NtlmChallenge 10 | { 11 | public NtlmChallengeHeader hdr; 12 | public string? serverName; 13 | public NtlmAvInfo? targetInfo; 14 | 15 | public static NtlmChallenge Parse(ReadOnlySpan token) 16 | { 17 | // TODO: Avoid calling ToArray 18 | var reader = new ByteMemoryReader(token.ToArray()); 19 | NtlmChallenge challenge = reader.ReadChallenge(); 20 | 21 | return challenge; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/base/Titanis.Core/Singleton.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis 2 | { 3 | /// 4 | /// Facilitates the singleton pattern. 5 | /// 6 | public static class Singleton 7 | { 8 | static class InstanceHolder 9 | where T : class 10 | { 11 | internal static T? instance; 12 | } 13 | 14 | /// 15 | /// Gets a singleton instance of an object. 16 | /// 17 | /// Type of object 18 | /// A singleton instance of . 19 | public static T SingleInstance() 20 | where T : class, new() 21 | => (InstanceHolder.instance ??= new T()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1IntersectionConstraint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Asn1.Metadata 8 | { 9 | public class Asn1IntersectionConstraint : Asn1Constraint 10 | { 11 | public Asn1IntersectionConstraint(Asn1Constraint left, Asn1Constraint right) 12 | { 13 | ArgumentNullException.ThrowIfNull(left); 14 | ArgumentNullException.ThrowIfNull(right); 15 | this.Left = left; 16 | this.Right = right; 17 | } 18 | 19 | public Asn1Constraint Left { get; } 20 | public Asn1Constraint Right { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/interop/Titanis.Windows.Interop/Titanis.Windows.Interop.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | enable 6 | enable 7 | Titanis.Windows.Interop.ProjectedFileSystem 8 | 9 | 10 | 11 | 12 | all 13 | runtime; build; native; contentfiles; analyzers; buildtransitive 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/ResponsePduHeader.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 6 | struct ResponsePduHeader 7 | { 8 | internal unsafe static int StructSize => sizeof(ResponsePduHeader); 9 | 10 | /* needed for request, response, fault */ 11 | internal uint alloc_hint; /* 16:04 allocation hint */ 12 | internal ushort p_cont_id; /* 20:02 pres context, i.e. data rep */ 13 | /* needed for response or fault */ 14 | internal byte cancel_count; /* 22:01 cancel count*/ 15 | internal byte reserved; /* 23:01 reserved, m.b.z. */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/ISmb2ConnectionOwner.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Smb2 8 | { 9 | /// 10 | /// Receives notifications from a connection. 11 | /// 12 | public interface ISmb2ConnectionOwner 13 | { 14 | /// 15 | /// Called when the connection is aborted. 16 | /// 17 | /// Connection aborted 18 | /// Exception indicating why 19 | void OnConnectionAborted(Smb2Connection connection, Exception exception); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamDomainGeneralInfo2.cs: -------------------------------------------------------------------------------- 1 | using ms_samr; 2 | using System; 3 | 4 | namespace Titanis.Msrpc.Mssamr 5 | { 6 | public class SamDomainGeneralInfo2 7 | { 8 | private readonly SAMPR_DOMAIN_GENERAL_INFORMATION2 info; 9 | 10 | internal SamDomainGeneralInfo2(in SAMPR_DOMAIN_GENERAL_INFORMATION2 info) 11 | { 12 | this.info = info; 13 | } 14 | 15 | public TimeSpan LockoutDuration => TimeSpan.FromTicks(-this.info.LockoutDuration.QuadPart); 16 | public TimeSpan LockoutObservationWindow => TimeSpan.FromTicks(-this.info.LockoutObservationWindow.QuadPart); 17 | public ushort LockoutThreshold => this.info.LockoutThreshold; 18 | } 19 | } -------------------------------------------------------------------------------- /tools/rpc/Wmi/LsnsCommand.cs: -------------------------------------------------------------------------------- 1 | using ms_wmi; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.ComponentModel; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using Titanis.Cli; 9 | using Titanis.Msrpc.Mswmi; 10 | 11 | namespace Wmi; 12 | 13 | /// List the namespaces within a WMI namespace 14 | [Command] 15 | [Description("Lists the available namespaces within a namespace.")] 16 | [OutputRecordType(typeof(WmiInstanceObject))] 17 | internal class LsnsCommand : QueryCommandBase 18 | { 19 | protected sealed override string GetQueryText() => "SELECT * FROM __NAMESPACE"; 20 | } 21 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/compat/CallerArgumentExpressionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | #pragma warning disable IDE0130 // Namespace does not match folder structure 6 | namespace System.Runtime.CompilerServices 7 | #pragma warning restore IDE0130 // Namespace does not match folder structure 8 | { 9 | [AttributeUsage(AttributeTargets.Parameter)] 10 | public sealed class CallerArgumentExpressionAttribute : Attribute 11 | { 12 | public CallerArgumentExpressionAttribute(string parameterName) 13 | { 14 | this.ParameterName = parameterName; 15 | } 16 | 17 | public string ParameterName { get; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /doc/DevGuide/Versioning.md: -------------------------------------------------------------------------------- 1 | # Versioning 2 | 3 | The version number for Titanis assemblies only uses the major.minor components of the version number, and only changes when there is a change to the public API service that affects assembly binding. 4 | 5 | Each assembly file has a file version separate from the assembly version. This file version number utilizes all 4 components: majon.minor.build.revision. The `build` component is incremented by the pipeline with every build and does not reset when either of the major or minor components change. The `revision` component signifies a hotfix and defaults to `0` when using the pipeline but may be changed by a developer when preparing a hotfix. 6 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr/Security/ServiceAccessRule.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Security.AccessControl; 4 | using System.Security.Principal; 5 | using System.Text; 6 | 7 | namespace Titanis.Msrpc.Msscmr.Security 8 | { 9 | public class ServiceAccessRule : AccessRule 10 | { 11 | public ServiceAccessRule( 12 | IdentityReference identity, 13 | int accessMask, 14 | bool isInherited, 15 | InheritanceFlags inheritanceFlags, 16 | PropagationFlags propagationFlags, 17 | AccessControlType type) 18 | : base(identity, accessMask, isInherited, inheritanceFlags, propagationFlags, type) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /samples/PduStructSample/PduStructSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/base/Titanis.IO/IHaveStreamPosition.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace Titanis.IO 7 | { 8 | /// 9 | /// Exposes the position within an underlying . 10 | /// 11 | public interface IHaveStreamPosition 12 | { 13 | /// 14 | /// Gets the position of the underlying . 15 | /// 16 | /// 17 | /// In cases where the object using the stream supports buffering, 18 | /// the value may not match the value of . 19 | /// 20 | long StreamPosition { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/base/Titanis.Winterop.Security/StandardAccessRights.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Winterop.Security 6 | { 7 | /// 8 | /// Specifies standard access rights. 9 | /// 10 | [Flags] 11 | public enum StandardAccessRights : uint 12 | { 13 | Delete = 0x00010000, 14 | ReadControl = 0x00020000, 15 | WriteDac = 0x00040000, 16 | WriteOwner = 0x00080000, 17 | Synchronize = 0x00100000, 18 | RequiredRightsMask = 0x000F0000, 19 | AllStandardRights = 0x001F0000, 20 | SpecificRightsMask = 0x0000FFFF, 21 | AccessSystemSecurity = 0x01000000, 22 | MaxAllowed = 0x02000000, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1WithComponentsConstraint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Asn1.Metadata 8 | { 9 | public class Asn1WithComponentsConstraint : Asn1Constraint 10 | { 11 | public Asn1WithComponentsConstraint(Dictionary constraints, bool isPartial) 12 | { 13 | ArgumentNullException.ThrowIfNull(constraints); 14 | this.IsPartial = isPartial; 15 | this.Constraints = constraints; 16 | } 17 | 18 | public bool IsPartial { get; } 19 | public Dictionary Constraints { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Serialization/IAsn1DerEncodableTlv.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Text; 5 | 6 | namespace Titanis.Asn1.Serialization 7 | { 8 | /// 9 | /// Exposes functionality to decode a TLV using ASN.1 DER. 10 | /// 11 | public interface IAsn1DerEncodableTlv : IAsn1Tag 12 | { 13 | void EncodeTlv(Asn1DerEncoder encoder); 14 | } 15 | public interface IAsn1DerDecodableTlv 16 | { 17 | static abstract TSelf DecodeTlvFrom(Asn1DerDecoder decoder); 18 | static abstract bool TryDecodeTlvFrom(Asn1DerDecoder decoder, [NotNullWhen(true)] out TSelf? value); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssamr/SamUserGeneralInfo.cs: -------------------------------------------------------------------------------- 1 | using ms_samr; 2 | using System; 3 | 4 | namespace Titanis.Msrpc.Mssamr 5 | { 6 | public class SamUserGeneralInfo 7 | { 8 | private SAMPR_USER_GENERAL_INFORMATION info; 9 | 10 | internal SamUserGeneralInfo(in SAMPR_USER_GENERAL_INFORMATION info) 11 | { 12 | this.info = info; 13 | } 14 | 15 | public string UserName => this.info.UserName.AsString(); 16 | public string FullName => this.info.FullName.AsString(); 17 | public uint PrimaryGroupId => this.info.PrimaryGroupId; 18 | public string AdminComment => this.info.AdminComment.AsString(); 19 | public string UserComment => this.info.UserComment.AsString(); 20 | } 21 | } -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mswmi/Wmio/PropertyLookupTable.cs: -------------------------------------------------------------------------------- 1 | using Titanis.IO; 2 | 3 | 4 | namespace Titanis.Msrpc.Mswmi.Wmio 5 | { 6 | // [MS-WMIO] § 2.2.21 - PropertyLookupTable 7 | [PduStruct] 8 | partial struct PropertyLookupTable 9 | { 10 | public PropertyLookupTable(PropertyLookup[] properties) 11 | { 12 | this.properties = properties; 13 | } 14 | 15 | private int count; 16 | partial void OnBeforeWritePdu(ByteWriter writer) 17 | { 18 | if (this.properties.IsNullOrEmpty()) 19 | this.count = 0; 20 | else 21 | this.count = this.properties.Length; 22 | } 23 | 24 | [PduArraySize(nameof(count))] 25 | internal PropertyLookup[] properties; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/EType.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("Titanis.Security.Kerberos.Test")] 4 | 5 | namespace Titanis.Security.Kerberos 6 | { 7 | 8 | public enum EType : ushort // Underlying used by CCache 9 | { 10 | // [RFC 3961] § 8 11 | DesCbcMd5 = 3, 12 | DesCbcCrc = 1, 13 | Rc4Hmac = 23, 14 | Rc4HmacExp = 24, 15 | 16 | // [RFC 3962] § 7 17 | Aes128CtsHmacSha1_96 = 17, 18 | Aes256CtsHmacSha1_96 = 18, 19 | 20 | // [RFC 4556] § 3.1 21 | DsaWithSha1 = 9, 22 | Md5WithRsa = 10, 23 | Sha1WithRsa = 11, 24 | Rc2Cbc = 12, 25 | Rsa = 13, 26 | RsaesOaep = 14, 27 | DesEde3Cbc = 15, 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/base/Titanis.Winterop.Security/SecurityInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Winterop.Security 6 | { 7 | [Flags] 8 | public enum SecurityInfo : uint 9 | { 10 | None = 0, 11 | 12 | Owner = 0x00000001, 13 | Group = 0x00000002, 14 | Dacl = 0x00000004, 15 | Sacl = 0x00000008, 16 | Label = 0x00000010, 17 | Attribute = 0x00000020, 18 | Scope = 0x00000040, 19 | ProcessTrustLabel = 0x00000080, 20 | AccessFilter = 0x00000100, 21 | Backup = 0x00010000, 22 | ProtectedDacl = 0x80000000, 23 | ProtectedSacl = 0x40000000, 24 | UnprotectedDacl = 0x20000000, 25 | UnprotectedSacl = 0x10000000, 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tools/rpc/Scm/Program.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Titanis.Cli; 3 | 4 | namespace Titanis.Cli.ScmTool; 5 | 6 | [Command] 7 | [Description("Provides functionality for interacting with the service control manager on a remote Windows system")] 8 | [Subcommand("query", typeof(QueryCommand))] 9 | [Subcommand("qtriggers", typeof(QueryTriggersCommand))] 10 | [Subcommand("create", typeof(CreateServiceCommand))] 11 | [Subcommand("delete", typeof(DeleteCommand))] 12 | [Subcommand("start", typeof(StartCommand))] 13 | [Subcommand("stop", typeof(StopCommand))] 14 | internal class Program : MultiCommand 15 | { 16 | static void Main(string[] args) 17 | => RunProgramAsync(args); 18 | } 19 | -------------------------------------------------------------------------------- /src/base/Titanis.Reflection.Emit/Titanis.Reflection.Emit.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 6 | 7 | 8 | 9 | True 10 | True 11 | Messages.resx 12 | 13 | 14 | 15 | 16 | 17 | ResXFileCodeGenerator 18 | Messages.Designer.cs 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/net/Titanis.Ssh/Titanis.Ssh.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/IParameterGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Design; 4 | using System.Text; 5 | 6 | namespace Titanis.Cli 7 | { 8 | /// 9 | /// Allows a parameter group to receive notifications during command execution. 10 | /// 11 | public interface IParameterGroup 12 | { 13 | /// 14 | /// Called by the command line parser when creating the parameter group. 15 | /// 16 | /// Owning 17 | /// Service container to add services to. 18 | void Initialize(Command owner, IServiceContainer services); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Ntlm/NtlmExchange.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Security.Ntlm 8 | { 9 | public class NtlmExchange 10 | { 11 | public byte[]? NegotiateBytes { get; } 12 | public byte[]? ChallengeBytes { get; } 13 | public byte[]? AuthenticateBytes { get; } 14 | 15 | public NtlmExchange( 16 | byte[]? negotiateBytes, 17 | byte[]? challengeBytes, 18 | byte[]? authenticateBytes 19 | ) 20 | { 21 | this.NegotiateBytes = negotiateBytes; 22 | this.ChallengeBytes = challengeBytes; 23 | this.AuthenticateBytes = authenticateBytes; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1SizeConstraint.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Asn1.Metadata 2 | { 3 | public sealed class Asn1SizeConstraint : Asn1Constraint 4 | { 5 | public Asn1SizeConstraint(long size) 6 | { 7 | this.MinSize = size; 8 | this.MaxSize = size; 9 | } 10 | public Asn1SizeConstraint(long? min, long? max) 11 | { 12 | this.MinSize = min; 13 | this.MaxSize = max; 14 | } 15 | 16 | public long? MinSize { get; } 17 | public long? MaxSize { get; } 18 | 19 | public sealed override string ToString() 20 | => (this.MinSize.HasValue && this.MinSize == this.MaxSize) ? $"SIZE({this.MinSize.ToString()})" 21 | : $"SIZE({new Asn1Int64Range(this.MinSize, true, this.MaxSize, true)})"; 22 | } 23 | } -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/FaultPduHeader.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 6 | struct FaultPduHeader 7 | { 8 | internal unsafe static int StructSize => sizeof(FaultPduHeader); 9 | 10 | /* needed for request, response, fault */ 11 | internal uint alloc_hint; /* 16:04 allocation hint */ 12 | internal ushort p_cont_id; /* 20:02 pres context, i.e. data rep */ 13 | /* needed for response or fault */ 14 | internal byte cancel_count; /* 22:01 cancel count*/ 15 | internal byte reserved; /* 23:01 reserved, m.b.z. */ 16 | internal RpcFaultCode status; 17 | internal uint pad; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/PresContext.cs: -------------------------------------------------------------------------------- 1 | using Titanis.IO; 2 | 3 | namespace Titanis.DceRpc.WireProtocol 4 | { 5 | // [C706] § 12.6.3.1 - Declarations > p_cont_elem_t 6 | [PduStruct] 7 | public partial struct PresContext 8 | { 9 | public ushort /* p_context_id_t */ p_cont_id; 10 | private byte n_transfer_syn; /* number of items */ 11 | public byte reserved; /* alignment pad, m.b.z. */ 12 | public SyntaxId abstract_syntax; /* transfer syntax list */ 13 | 14 | [PduArraySize(nameof(n_transfer_syn))] 15 | public SyntaxId[] transferSyntaxes; 16 | 17 | partial void OnBeforeWritePdu(ByteWriter writer) 18 | { 19 | this.n_transfer_syn = (byte)this.transferSyntaxes.Length; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /test/base/Titanis.IO.Test/Titanis.IO.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1ValueRange.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1.Metadata 6 | { 7 | public class Asn1ValueRange 8 | { 9 | public Asn1ValueRange(object minValue, bool includesMinValue, object maxValue, bool includesMaxValue) 10 | { 11 | this.MinValue = minValue; 12 | this.IncludesMinValue = includesMinValue; 13 | this.MaxValue = maxValue; 14 | this.IncludesMaxValue = includesMaxValue; 15 | } 16 | 17 | public object MinValue { get; private set; } 18 | public bool IncludesMinValue { get; private set; } 19 | public object MaxValue { get; private set; } 20 | public bool IncludesMaxValue { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tools/rpc/Lsa/WhoamiCommand.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Titanis.Cli; 3 | using Titanis.Msrpc.Mslsar; 4 | using Titanis.Security; 5 | 6 | namespace Lsa; 7 | 8 | [Command] 9 | [OutputRecordType(typeof(UserPrincipalName), DefaultOutputStyle = OutputStyle.Freeform)] 10 | [Description("Gets the name and domain of the connected user")] 11 | [Example("Get connected user name", "{0} LUMON-FS1 -UserName milchick -Password Br3@kr00m!")] 12 | internal class WhoamiCommand : LsaCommand 13 | { 14 | protected sealed override async Task RunAsync(LsaClient client, CancellationToken cancellationToken) 15 | { 16 | var name = await client.WhoAmI(cancellationToken); 17 | this.WriteRecord(name); 18 | 19 | return 0; 20 | } 21 | } -------------------------------------------------------------------------------- /src/base/Titanis.Core/Enumerable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics.CodeAnalysis; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Titanis 8 | { 9 | /// 10 | /// Provides extension methods for . 11 | /// 12 | public static class Enumerable 13 | { 14 | // TODO: Review why this method is needed. 15 | // It is used in Titanis.Net.Analysis 16 | [return: MaybeNull] 17 | public static IEnumerable? SelectManyOrNull( 18 | this IEnumerable? enumerable, 19 | Func> selector) 20 | { 21 | return enumerable?.SelectMany(selector); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/COMVERSION.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.DceRpc 2 | { 3 | [System.CodeDom.Compiler.GeneratedCode("Animus IDL Compiler", "0.9")] 4 | public struct COMVERSION : IRpcFixedStruct 5 | { 6 | public void Encode(IRpcEncoder encoder) 7 | { 8 | encoder.WriteValue(this.MajorVersion); 9 | encoder.WriteValue(this.MinorVersion); 10 | } 11 | public void Decode(IRpcDecoder decoder) 12 | { 13 | this.MajorVersion = decoder.ReadUInt16(); 14 | this.MinorVersion = decoder.ReadUInt16(); 15 | } 16 | public ushort MajorVersion; 17 | public ushort MinorVersion; 18 | public void EncodeDeferrals(IRpcEncoder encoder) 19 | { 20 | } 21 | public void DecodeDeferrals(IRpcDecoder decoder) 22 | { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mswmi/Wmio/PropertyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Msrpc.Mswmi.Wmio 8 | { 9 | [PduStruct] 10 | internal partial struct PropertyInfo 11 | { 12 | // [MS-WMIO] § 2.2.31 - PropertyType 13 | internal CimType propertyType; 14 | // [MS-WMIO] § 2.2.33 - DeclarationOrder 15 | internal ushort declarationOrder; 16 | // [MS-WMIO] § 2.2.34 - ValueTableOffset 17 | internal uint valueTableOffset; 18 | // [MS-WMIO] § 2.2.35 - ClassOfOrigin 19 | internal int classOfOrigin; 20 | // [MS-WMIO] § 2.2.36 - PropertyQualifierSet 21 | internal QualifierSet qualifierSet; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/security/Titanis.NFold.Test/Titanis.NFold.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/ExampleAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | /// 8 | /// Provides an example of using a command class. 9 | /// 10 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] 11 | public class ExampleAttribute : Attribute 12 | { 13 | public ExampleAttribute(string caption, string commandLine, string? explanation = null) 14 | { 15 | this.Caption = caption; 16 | this.CommandLine = commandLine; 17 | this.Explanation = explanation; 18 | } 19 | 20 | public string Caption { get; } 21 | public string CommandLine { get; } 22 | public string? Explanation { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/ParameterCategories.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | public static class ParameterCategories 8 | { 9 | public const string Output = "Output"; 10 | public const string Connection = "Connection"; 11 | public const string Authentication = "Authentication"; 12 | public const string Callback = "Callback"; 13 | public const string AuthenticationNtlm = "Authentication (NTLM)"; 14 | public const string AuthenticationKerberos = "Authentication (Kerberos)"; 15 | public const string ClientBehavior = "Client Behavior"; 16 | public const string Installation = "Installation"; 17 | public const string Removal = "Removal"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/build/Titanis.ToolDocBuilder/Titanis.ToolDocBuilder.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(ArtifactsBasePath)\build 5 | 6 | net472 7 | enable 8 | enable 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/Server/OperationImplFunc.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.DceRpc.Server 8 | { 9 | /// 10 | /// Defines the signature for methods implementing an operation stub. 11 | /// 12 | /// Stub data 13 | /// Encoder to encode response data 14 | /// Cancellation token that may be used to cancel the operation 15 | /// 16 | public delegate Task OperationImplFunc(IRpcDecoder stubData, IRpcEncoder responseData, CancellationToken cancellationToken); 17 | } 18 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Ntlm/NtlmFeaturesUnsupportedException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Security.Ntlm 4 | { 5 | internal class NtlmFeaturesUnsupportedException : Exception 6 | { 7 | private NegotiateFlags badAnonFlags; 8 | 9 | public NtlmFeaturesUnsupportedException() 10 | { 11 | } 12 | 13 | public NtlmFeaturesUnsupportedException(string message) : base(message) 14 | { 15 | } 16 | 17 | public NtlmFeaturesUnsupportedException(NegotiateFlags badAnonFlags, string message) 18 | :base(message) 19 | { 20 | this.badAnonFlags = badAnonFlags; 21 | } 22 | 23 | public NtlmFeaturesUnsupportedException(string message, Exception innerException) : base(message, innerException) 24 | { 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /samples/dcom/MmcExec/MmcExec.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2SymlinkLoopException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Titanis.Winterop; 3 | 4 | namespace Titanis.Smb2 5 | { 6 | internal class Smb2SymlinkLoopException : Exception 7 | { 8 | public Smb2SymlinkLoopException() 9 | : base(Messages.Smb2_RecursiveSymlink) 10 | { 11 | this.HResult = unchecked((int)Ntstatus.STATUS_STOPPED_ON_SYMLINK); 12 | } 13 | 14 | public Smb2SymlinkLoopException(string message) : base(message) 15 | { 16 | this.HResult = unchecked((int)Ntstatus.STATUS_STOPPED_ON_SYMLINK); 17 | } 18 | 19 | public Smb2SymlinkLoopException(string message, Exception innerException) : base(message, innerException) 20 | { 21 | this.HResult = unchecked((int)Ntstatus.STATUS_STOPPED_ON_SYMLINK); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /tools/security/Kerb/Program.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using Titanis.Cli; 3 | 4 | namespace Kerb 5 | { 6 | [Description("Commands for working with Kerberos authentication")] 7 | [Subcommand("getasinfo", typeof(GetASInfoCommand))] 8 | [Subcommand("asreq", typeof(AsreqCommand))] 9 | [Subcommand("tgsreq", typeof(RequestTicketCommand))] 10 | [Subcommand("renew", typeof(RenewTicketCommand))] 11 | [Subcommand("select", typeof(SelectCommand))] 12 | [Subcommand("changepw", typeof(ChangePasswordCommand))] 13 | [Subcommand("setpw", typeof(SetPasswordCommand))] 14 | [Subcommand("s2k", typeof(S2kCommand))] 15 | internal class Program : MultiCommand 16 | { 17 | static void Main(string[] args) 18 | => RunProgramAsync(args); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceControl.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Msrpc.Msscmr 2 | { 3 | public enum ServiceControl 4 | { 5 | Stop = 0x00000001, 6 | Pause = 0x00000002, 7 | Continue = 0x00000003, 8 | Interrogate = 0x00000004, 9 | Shutdown = 0x00000005, 10 | ParamChange = 0x00000006, 11 | NetBindAdd = 0x00000007, 12 | NetBindRemove = 0x00000008, 13 | NetBindEnable = 0x00000009, 14 | NetBindDisable = 0x0000000A, 15 | DeviceEvent = 0x0000000B, 16 | HardwareProfileChange = 0x0000000C, 17 | PowerEvent = 0x0000000D, 18 | SessionChange = 0x0000000E, 19 | PreShutdown = 0x0000000F, 20 | TimeChange = 0x00000010, 21 | TriggerEvent = 0x00000020, 22 | LowResources = 0x00000060, 23 | SystemLowResources = 0x00000061, 24 | } 25 | } -------------------------------------------------------------------------------- /test/base/Titanis.Winterop.Test/Titanis.Winterop.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tools/rpc/Lsa/Lsa.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/PlaceholderAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | /// 8 | /// Specifies the name of the placeholder for this parameter. 9 | /// 10 | /// 11 | public class PlaceholderAttribute : Attribute 12 | { 13 | /// 14 | /// Initializes a new . 15 | /// 16 | /// Placeholder name 17 | public PlaceholderAttribute(string name) 18 | { 19 | this.Name = name; 20 | } 21 | 22 | /// 23 | /// Gets the name of the placeholder. 24 | /// 25 | public string Name { get; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/RpcVersionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | /// 8 | /// Specifies the version of an RPC interface. 9 | /// 10 | [AttributeUsage(AttributeTargets.Interface, AllowMultiple = false, Inherited = false)] 11 | public sealed class RpcVersionAttribute : Attribute 12 | { 13 | public RpcVersionAttribute(ushort major, ushort minor) 14 | { 15 | this.Version = new RpcVersion(major, minor); 16 | } 17 | 18 | public RpcVersion Version { get; } 19 | 20 | /// 21 | public sealed override bool Match(object? obj) 22 | => (obj is RpcVersionAttribute other) && (other.Version == this.Version); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/crypto/Titanis.Crypto.AesCcm.Test/Titanis.Crypto.AesCcm.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2NicInfo.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Net; 3 | using System.Net.Sockets; 4 | 5 | namespace Titanis.Smb2 6 | { 7 | public class Smb2NicInfo 8 | { 9 | internal Smb2NicInfoStruct info; 10 | 11 | internal Smb2NicInfo() { } 12 | 13 | [DisplayName("Interface Index")] 14 | public int InterfaceIndex => this.info.ifIndex; 15 | public Smb2NicCapabilities Capabilities => this.info.caps; 16 | [DisplayName("Link Speed")] 17 | public long LinkSpeed => this.info.linkSpeed; 18 | 19 | [DisplayName("Address Family")] 20 | public AddressFamily AddressFamily => this.info.sockaddr.Family; 21 | 22 | private IPEndPoint _ep; 23 | public IPEndPoint EndPoint => (this._ep ??= this.info.sockaddr.ToIPEndPoint()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr.Core/ServiceControls.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Titanis.Msrpc.Msscmr 4 | { 5 | [Flags] 6 | public enum ServiceControlsAccepted 7 | { 8 | None = 0, 9 | 10 | AcceptsStop = 0x00000001, 11 | AcceptsPauseContinue = 0x00000002, 12 | AcceptsShutdown = 0x00000004, 13 | AcceptsParamChange = 0x00000008, 14 | AcceptsNetBindChange = 0x00000010, 15 | AcceptsHardwareProfileChange = 0x00000020, 16 | AcceptsPowerEvent = 0x00000040, 17 | AcceptsSessionChange = 0x00000080, 18 | AcceptsPreShutdown = 0x00000100, 19 | AcceptsTimeChange = 0x00000200, 20 | AcceptsTriggerEvent = 0x00000400, 21 | AcceptsUserLogoff = 0x00000800, 22 | AcceptsLowResources = 0x00002000, 23 | AcceptsSystemLowResources = 0x00004000, 24 | } 25 | } -------------------------------------------------------------------------------- /src/Titanis.Smb2.PowerShell/ConnectSmbServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Management.Automation; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace Titanis.Smb2.PowerShell 9 | { 10 | [Cmdlet(VerbsCommunications.Connect, "SmbServer")] 11 | public class ConnectSmbServer : PSCmdlet 12 | { 13 | [Parameter(Mandatory = true)] 14 | public string ServerName { get; set; } 15 | 16 | [Parameter] 17 | public string? RemoteAddress { get; set; } 18 | 19 | [Parameter] 20 | public int RemotePort { get; set; } 21 | 22 | protected override void ProcessRecord() 23 | { 24 | var prov = (SmbProviderInfo)this.SessionState.Provider.GetOne(SmbProvider.ProviderName); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Core/RpcPointer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc 6 | { 7 | /// 8 | /// Represents a pointer value as an argument to an RPC operation. 9 | /// 10 | public class RpcPointer 11 | { 12 | public long referentId; 13 | public static RpcPointer Create(T value) 14 | => new RpcPointer(value); 15 | } 16 | /// 17 | /// Represents a pointer value as an argument to an RPC operation. 18 | /// 19 | public sealed class RpcPointer : RpcPointer 20 | { 21 | public T? value; 22 | 23 | public RpcPointer() 24 | { 25 | 26 | } 27 | public RpcPointer(T value) 28 | { 29 | this.value = value; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/Communication/PduFragGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Threading.Tasks; 4 | using Titanis.DceRpc.WireProtocol; 5 | using Titanis.IO; 6 | 7 | namespace Titanis.DceRpc.Communication 8 | { 9 | class PduFragGroup 10 | { 11 | internal readonly PduHeader header; 12 | private ByteWriter stream; 13 | 14 | public PduFragGroup(PduHeader header) 15 | { 16 | this.header = header; 17 | this.stream = new ByteWriter(0x1000); 18 | } 19 | 20 | internal int CallId => this.header.callId; 21 | 22 | internal void AppendChunk(ReadOnlySpan chunk) 23 | { 24 | this.stream.WriteBytes(chunk); 25 | } 26 | 27 | internal Memory Reassemble() 28 | { 29 | return this.stream.GetData(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2FileHandle.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Titanis.Smb2 5 | { 6 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 7 | public record struct Smb2FileHandle 8 | { 9 | internal static unsafe int StructSize => sizeof(Smb2FileHandle); 10 | internal static Smb2FileHandle Invalid => new Smb2FileHandle(0xFFFFFFFF_FFFFFFFF, 0xFFFFFFFF_FFFFFFFF); 11 | 12 | public Smb2FileHandle(ulong low, ulong high) 13 | { 14 | this.low = low; 15 | this.high = high; 16 | } 17 | 18 | public ulong low; 19 | public ulong high; 20 | 21 | public unsafe Span AsSpan() 22 | { 23 | fixed (ulong* pStruc = &this.low) 24 | { 25 | return new Span((byte*)pStruc, StructSize); 26 | } 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Asn1Implicit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Titanis.Asn1.Serialization; 5 | 6 | namespace Titanis.Asn1 7 | { 8 | public class Asn1Implicit : IAsn1DerEncodableTlv, IAsn1DerEncodableValue 9 | where T : IAsn1DerEncodableValue, IAsn1DerDecodableValue 10 | { 11 | public Asn1Implicit(Asn1Tag tag, T value) 12 | { 13 | this.Tag = tag; 14 | this.Value = value; 15 | } 16 | 17 | public Asn1Tag Tag { get; } 18 | public T Value { get; } 19 | 20 | public void EncodeValue(Asn1DerEncoder encoder) 21 | { 22 | this.Value.EncodeValue(encoder); 23 | } 24 | 25 | public void EncodeTlv(Asn1DerEncoder encoder) 26 | { 27 | encoder.EncodeValueTlv(this, this.Tag); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/KdcInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Titanis.Security.Kerberos 8 | { 9 | /// 10 | /// Information retrieved from a KDC. 11 | /// 12 | /// 13 | public class KdcInfo 14 | { 15 | public KdcInfo(DateTime kdcTime, IList supportedEncryptionTypes) 16 | { 17 | KdcTime = kdcTime; 18 | SupportedEncryptionTypes = supportedEncryptionTypes; 19 | } 20 | 21 | public DateTime KdcTime { get; } 22 | public IList SupportedEncryptionTypes { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/crypto/Titanis.Crypto.Aes128Cmac.Test/Titanis.Crypto.Aes128Cmac.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tools/net/smb2/Smb2Client/Smb2NewShareCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using Titanis.Cli; 8 | using Titanis.Msrpc.Mswkst; 9 | 10 | namespace Titanis.Smb2.Cli 11 | { 12 | [Command] 13 | [OutputRecordType(typeof(ShareInfo))] 14 | [Description("Creates a new share")] 15 | internal sealed class Smb2NewShareCommand : ServerServiceRpcCommand 16 | { 17 | protected sealed override Task RunAsync(ServerServiceClient client, CancellationToken cancellationToken) 18 | { 19 | //await srvs.AddShare(new ShareInfo(), cancellationToken); 20 | // TODO: Implement NewShare 21 | throw new NotImplementedException(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tools/net/smb2/Smb2Client/ServerServiceRpcCommand.cs: -------------------------------------------------------------------------------- 1 | using ms_srvs; 2 | using System.ComponentModel; 3 | using Titanis.Cli; 4 | using Titanis.DceRpc.Client; 5 | using Titanis.Msrpc.Mswkst; 6 | 7 | namespace Titanis.Smb2.Cli 8 | { 9 | internal abstract class ServerServiceRpcCommand : RpcCommand 10 | { 11 | protected sealed override Type InterfaceType => typeof(srvsvc); 12 | 13 | [Parameter] 14 | [Description("Max size for response buffer")] 15 | public int BufferSize { get; set; } 16 | 17 | protected override void ValidateParameters(ParameterValidationContext context) 18 | { 19 | base.ValidateParameters(context); 20 | 21 | if (this.BufferSize == 0) 22 | this.BufferSize = (int)ServerServiceClient.DefaultReturnBufferSize; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/StringHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Text; 5 | 6 | namespace Titanis 7 | { 8 | public static class StringHelper 9 | { 10 | public static int GetHashCode(this string str, StringComparison comparison) 11 | { 12 | bool ignoreCase = 0 != ((uint)comparison & 1); 13 | comparison = (comparison & (StringComparison)~1); 14 | var culture = comparison switch 15 | { 16 | StringComparison.CurrentCulture => CultureInfo.CurrentCulture, 17 | StringComparison.InvariantCulture or StringComparison.Ordinal => CultureInfo.InvariantCulture, 18 | _ => CultureInfo.CurrentCulture 19 | }; 20 | return culture.CompareInfo.GetHashCode(str, CompareOptions.IgnoreCase); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/base/Titanis.Mocks/IExpect.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | 4 | namespace Titanis.Mocks 5 | { 6 | public interface IExpect 7 | { 8 | void Throw(Exception? ex); 9 | void CallBase(); 10 | } 11 | 12 | public interface IExpect : IExpect 13 | { 14 | } 15 | 16 | public interface IExpect : IExpect 17 | { 18 | void Return(TReturn value); 19 | } 20 | 21 | public interface IExpectAsync 22 | { 23 | void ThrowAsync(Exception ex); 24 | } 25 | 26 | public interface IExpectAsync : IExpect, IExpectAsync 27 | { 28 | } 29 | 30 | public interface IExpectAsync : IExpect> 31 | { 32 | void ThrowAsync(Exception ex); 33 | void ReturnAsync(TReturn value); 34 | } 35 | } -------------------------------------------------------------------------------- /src/crypto/Titanis.Crypto.Des/Titanis.Crypto.Des.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | Titanis.Crypto 6 | 7 | 8 | 9 | true 10 | 11 | 12 | 13 | true 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/formats/Titanis.Asn1.Test/Titanis.Asn1.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/base/Titanis.Mocks/Titanis.Mocks.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | True 14 | True 15 | Messages.resx 16 | 17 | 18 | 19 | 20 | 21 | ResXFileCodeGenerator 22 | Messages.Designer.cs 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/BindPduHeader.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Runtime.InteropServices; 3 | using System.Text; 4 | 5 | namespace Titanis.DceRpc.WireProtocol 6 | { 7 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 8 | [PduStruct] 9 | public partial struct BindPduHeader 10 | { 11 | public unsafe static int StructSize => sizeof(BindPduHeader); 12 | 13 | //internal ushort max_xmit_frag; 14 | //internal ushort max_recv_frag; 15 | //internal uint assoc_group_id; 16 | //internal ContextListHeader contextList; 17 | /* presentation context list */ 18 | //p_cont_list_t p_context_elem; /* variable size */ 19 | /* optional authentication verifier */ 20 | /* following fields present iff auth_length != 0 */ 21 | //auth_verifier_co_t auth_verifier; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/EnumNameListAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | /// 8 | /// When used on a parameter, provides a list of values containing the names of the members of one or more types. 9 | /// 10 | /// 11 | /// Multiple types are supported. 12 | /// 13 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = false)] 14 | public sealed class EnumNameListAttribute : Attribute 15 | { 16 | public EnumNameListAttribute(params Type[] enumTypes) 17 | { 18 | EnumTypes = enumTypes; 19 | } 20 | 21 | /// 22 | /// Gets the types. 23 | /// 24 | public Type[] EnumTypes { get; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/base/Titanis.Winterop.FileInfo/Titanis.Winterop.FileInfo.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.1 5 | 12.0 6 | Titanis.Winterop 7 | 8 | 9 | 10 | true 11 | 12 | 13 | 14 | true 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/base/Titanis.Dynamic.Test/Titanis.Dynamic.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Asn1Oids.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1 6 | { 7 | public static class Asn1Oids 8 | { 9 | public static Asn1Oid Asn1Modules = new Asn1Oid( 10 | // joint-iso-itu-t asn1(1) specification(0) modules(0) 11 | new Asn1OidPart(2, "joint-iso-itu-t"), 12 | new Asn1OidPart(1, "asn1"), 13 | new Asn1OidPart(0, "specification"), 14 | new Asn1OidPart(0, "modules") 15 | ); 16 | public static Asn1Oid DefinedTypes = new Asn1Oid( 17 | // joint-iso-itu-t asn1(1) specification(0) modules(0) 18 | new Asn1OidPart(2, "joint-iso-itu-t"), 19 | new Asn1OidPart(1, "asn1"), 20 | new Asn1OidPart(0, "specification"), 21 | new Asn1OidPart(0, "modules"), 22 | new Asn1OidPart(3, "defined-types-module") 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msscmr/EnumServiceStatusInfo.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | 3 | namespace Titanis.Msrpc.Msscmr 4 | { 5 | public class EnumServiceStatusInfo 6 | { 7 | public EnumServiceStatusInfo(string serviceName, string displayName, ServiceStatus status) 8 | { 9 | this.ServiceName = serviceName; 10 | this.DisplayName = displayName; 11 | this.Status = status; 12 | } 13 | 14 | public string ServiceName { get; } 15 | public string DisplayName { get; } 16 | [Browsable(false)] 17 | public ServiceStatus Status { get; } 18 | 19 | public ServiceTypes ServiceType => this.Status.ServiceType; 20 | public ServiceState State => this.Status.CurrentState; 21 | public int Win32ExitCode => this.Status.Win32ExitCode; 22 | public int SpecificExitCode => this.Status.ServiceSpecificExitCode; 23 | } 24 | } -------------------------------------------------------------------------------- /src/base/Titanis.IO/AsyncStream.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Titanis.IO 9 | { 10 | /// 11 | /// Provides additional methods to read a byte from the stream asynchronously. 12 | /// 13 | public abstract class AsyncStream : Stream 14 | { 15 | /// 16 | /// Reads a byte from the stream asynchronously. 17 | /// 18 | public virtual ValueTask ReadByteAsync() 19 | { 20 | return this.ReadByteAsync(CancellationToken.None); 21 | } 22 | 23 | /// 24 | /// Reads a byte from the stream asynchronously. 25 | /// 26 | public abstract ValueTask ReadByteAsync(CancellationToken cancellationToken); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1PrimitiveTypeBase.cs: -------------------------------------------------------------------------------- 1 | namespace Titanis.Asn1.Metadata 2 | { 3 | /// 4 | /// Represents a primitive (non-constructed) type. 5 | /// 6 | public abstract class Asn1PrimitiveTypeBase : Asn1Type 7 | { 8 | /// 9 | public sealed override bool IsConstructed => false; 10 | /// 11 | public sealed override bool HasStaticTag => true; 12 | /// 13 | public sealed override Asn1Tag StaticTag => this.PrimitiveTag; 14 | /// 15 | /// Gets the tag for this primitive type. 16 | /// 17 | /// 18 | /// This member is declared abstract apart from to 19 | /// force derived types to implement it. 20 | /// 21 | protected abstract Asn1Tag PrimitiveTag { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Metadata/Asn1UnresolvedType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Asn1.Metadata 6 | { 7 | public sealed class Asn1UnresolvedType : Asn1Type 8 | { 9 | public Asn1UnresolvedType(string name) 10 | { 11 | this.Name = name; 12 | } 13 | 14 | /// 15 | public sealed override string DefinitionString => ""; 16 | 17 | /// 18 | public sealed override bool IsConstructed => false; 19 | 20 | /// 21 | public sealed override bool HasStaticTag => false; 22 | 23 | /// 24 | public sealed override Asn1TypeKind Kind => Asn1TypeKind.Unknown; 25 | 26 | /// 27 | public sealed override T Accept(ITypeVisitor visitor) => visitor.Visit(this); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/base/Titanis.Reflection/Titanis.Reflection.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Library 5 | netstandard2.0 6 | true 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | True 16 | True 17 | Messages.resx 18 | 19 | 20 | 21 | 22 | 23 | ResXFileCodeGenerator 24 | Messages.Designer.cs 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc.Ndr/RpcReaderExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Titanis.IO; 7 | 8 | namespace Titanis.DceRpc 9 | { 10 | internal static class RpcReaderExtensions 11 | { 12 | 13 | internal static unsafe SyntaxId ReadSyntaxId(this ByteMemoryReader reader) 14 | { 15 | fixed (byte* pBuf = reader.Consume(SyntaxId.StructSize)) 16 | { 17 | SyntaxId* pStruc = (SyntaxId*)(pBuf); 18 | return *pStruc; 19 | } 20 | } 21 | 22 | internal static unsafe void WriteSyntaxId(this ByteWriter writer, in SyntaxId syntax) 23 | { 24 | fixed (byte* pByte = writer.Consume(SyntaxId.StructSize)) 25 | { 26 | SyntaxId* pStruc = (SyntaxId*)(pByte); 27 | *pStruc = syntax; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Pdus/Smb2PduAsyncHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | 4 | namespace Titanis.Smb2.Pdus 5 | { 6 | // [MS-SMB2] § 2.2.1.1 - SMB2 Packet Header - ASYNC 7 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 8 | struct Smb2PduAsyncHeader 9 | { 10 | public unsafe static short StructSize => (short)sizeof(Smb2PduAsyncHeader); 11 | public const uint ValidSignature = 0x424d53fe; 12 | 13 | internal uint protocolId; 14 | internal short structSize; 15 | internal ushort creditCharge; 16 | internal uint status; 17 | internal Smb2Command command; 18 | internal ushort creditResp; 19 | internal Smb2PduFlags flags; 20 | internal uint nextCommand; 21 | internal ulong messageId; 22 | internal ulong asyncId; 23 | internal ulong sessionId; 24 | internal Guid signature; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Smb2DirectoryAccessRights.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Smb2 6 | { 7 | [Flags] 8 | public enum Smb2DirectoryAccessRights : uint 9 | { 10 | None = 0, 11 | ListDirectory = 1, 12 | AddFile = 2, 13 | AddSubdirectory = 4, 14 | ReadEa = 8, 15 | WriteEa = 0x10, 16 | Traverse = 0x20, 17 | DeleteChild = 0x40, 18 | ReadAttributes = 0x80, 19 | WriteAttributes = 0x100, 20 | Delete = 0x00010000, 21 | ReadControl = 0x00020000, 22 | WriteDac = 0x00040000, 23 | WriteOwner = 0x00080000, 24 | Synchronize = 0x00100000, 25 | AccessSystemSecurity = 0x01000000, 26 | MaxAllowed = 0x02000000, 27 | GenericAll = 0x10000000, 28 | GenericExecute = 0x20000000, 29 | GenericWrite = 0x40000000, 30 | GenericRead = 0x80000000 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Mssrvs/OpenFileInfo.cs: -------------------------------------------------------------------------------- 1 | using ms_srvs; 2 | using Titanis.Winterop.Security; 3 | 4 | namespace Titanis.Msrpc.Mswkst 5 | { 6 | public class OpenFileInfo 7 | { 8 | internal OpenFileInfo(ref readonly FILE_INFO_2 entry) 9 | { 10 | this.Id = (int)entry.fi2_id; 11 | } 12 | 13 | internal OpenFileInfo(ref readonly FILE_INFO_3 entry) 14 | { 15 | this.Id = (int)entry.fi3_id; 16 | this.Permissions = (Smb2FileAccessRights)entry.fi3_permissions; 17 | this.LockCount = (int)entry.fi3_num_locks; 18 | this.Path = entry.fi3_pathname?.value; 19 | this.UserName = entry.fi3_username?.value; 20 | } 21 | 22 | public int Id { get; } 23 | public Smb2FileAccessRights Permissions { get; } 24 | public int LockCount { get; } 25 | public string? Path { get; } 26 | public string? UserName { get; } 27 | } 28 | } -------------------------------------------------------------------------------- /src/formats/Titanis.Asn1/Asn1Enumerated.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Titanis.Asn1.Serialization; 7 | 8 | namespace Titanis.Asn1 9 | { 10 | public struct Asn1Enumerated : IAsn1DerEncodableValue, IAsn1DerEncodableTlv 11 | where TEnum : struct, Enum, IConvertible 12 | { 13 | public Asn1Enumerated(TEnum value) 14 | { 15 | this.Value = value; 16 | } 17 | 18 | public TEnum Value { get; } 19 | 20 | public Asn1Tag Tag => Asn1PredefTag.Enumerated; 21 | 22 | public void EncodeValue(Asn1DerEncoder encoder) => encoder.EncodeEnumeratedValue(this.Value.ToInt64(null)); 23 | 24 | public void EncodeTlv(Asn1DerEncoder encoder) => encoder.EncodeEnumeratedTlv(this.Value.ToInt64(null), Asn1PredefTag.Enumerated); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/net/Titanis.Ssh/SshPacket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Titanis.PduStruct; 7 | 8 | namespace Titanis.Ssh 9 | { 10 | // [RFC4253] § 6. Binary Packet Protocol 11 | [PduStruct] 12 | internal partial struct SshPacket 13 | { 14 | internal const int HeaderSize = 4; 15 | 16 | [PduParameter] 17 | internal int macLength; 18 | 19 | internal uint packetLength; 20 | internal byte paddingLength; 21 | 22 | private int PayloadSize => (int)(this.packetLength - this.paddingLength - 1); 23 | [PduArraySize(nameof(PayloadSize))] 24 | internal byte[] payload; 25 | 26 | [PduArraySize(nameof(paddingLength))] 27 | internal byte[] padding; 28 | 29 | [PduArraySize(nameof(macLength))] 30 | internal byte[] mac; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/security/Titanis.Security.Kerberos/IKdcLocator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Net; 4 | using System.Text; 5 | 6 | namespace Titanis.Security.Kerberos 7 | { 8 | [Flags] 9 | public enum LocateKdcOptions 10 | { 11 | None = 0, 12 | Home = 1, 13 | } 14 | 15 | /// 16 | /// Provides functionality for locating a KDC. 17 | /// 18 | /// 19 | public interface IKdcLocator 20 | { 21 | /// 22 | /// Determines the endpoint for a KDC for a specified realm. 23 | /// 24 | /// Realm 25 | /// Options 26 | /// An for communicating with the KDC. 27 | EndPoint LocateKdc(string realm, LocateKdcOptions options); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/net/Titanis.Socks/Titanis.Socks.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/crypto/Titanis.Crypto.Sp800_108.Test/KdfTest.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Security.Cryptography; 3 | using System.Text; 4 | 5 | namespace Titanis.Crypto.Test 6 | { 7 | [TestClass] 8 | public class KdfTest 9 | { 10 | [TestMethod] 11 | public void TestMethod1() 12 | { 13 | byte[] kdk = BinaryHelper.ParseHexString("419FDDF34C1E001909D362AE7FB6AF79"); 14 | byte[] context = BinaryHelper.ParseHexString("B23F3CBFD69487D9832B79B1594A367CDD950909B774C3A4C412B4FCEA9EDDDBA7DB256BA2EA30E977F11F9B113247578E0E915C6D2A513B8F2FCA5707DC8770"); 15 | byte[] label = Encoding.UTF8.GetBytes("SMBSigningKey\0"); 16 | 17 | byte[] expected = BinaryHelper.ParseHexString("8765949DFEAEE105CE9118B45BE988F0"); 18 | 19 | byte[] dk = Sp800_108.KdfCtr(label, context, 128, new HMACSHA256(kdk)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/FieldListProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace Titanis.Cli 5 | { 6 | internal class FieldListProvider : ValueListProvider 7 | { 8 | public override Array? GetValueListFor(ParameterMetadata parameter, object? command, CommandMetadataContext context) 9 | { 10 | var recordType = parameter.DeclaringCommand.OutputRecordType; 11 | if (recordType is not null) 12 | { 13 | if (context.Resolver.ReflectType(typeof(ICustomTypeDescriptor)).IsAssignableFrom(recordType)) 14 | { 15 | // This type has dynamic fields 16 | } 17 | else 18 | { 19 | var outputFields = OutputField.GetFieldsFor(recordType, context); 20 | var fieldNames = Array.ConvertAll(outputFields, r => r.Name); 21 | return fieldNames; 22 | } 23 | } 24 | 25 | return null; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Pdus/Smb2TreeDisconnectRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using Titanis.IO; 6 | 7 | namespace Titanis.Smb2.Pdus 8 | { 9 | sealed class Smb2TreeDisconnectRequest : Smb2Pdu 10 | { 11 | internal override Smb2Command Command => Smb2Command.TreeDisconnect; 12 | internal override Smb2Priority Priority => Smb2Priority.TreeDisconnect; 13 | 14 | internal override void ReadFrom(ByteMemoryReader reader, ref readonly Smb2PduSyncHeader pduHdr) 15 | { 16 | this.body = reader.ReadLogoffReqHdr(); 17 | } 18 | 19 | protected override ushort ValidBodySize => 4; 20 | internal override void WriteTo(ByteWriter writer, ref Smb2LogoffRequestBody body) 21 | { 22 | writer.WriteLogoffReqHdr(body); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/net/Titanis.Smb2/Pdus/Smb2TreeDisconnectResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | using Titanis.IO; 6 | 7 | namespace Titanis.Smb2.Pdus 8 | { 9 | sealed class Smb2TreeDisconnectResponse : Smb2Pdu 10 | { 11 | internal override Smb2Command Command => Smb2Command.TreeDisconnect; 12 | internal override Smb2Priority Priority => Smb2Priority.TreeDisconnect; 13 | 14 | internal override void ReadFrom(ByteMemoryReader reader, ref readonly Smb2PduSyncHeader pduHdr) 15 | { 16 | this.body = reader.ReadLogoffReqHdr(); 17 | } 18 | 19 | protected override ushort ValidBodySize => 4; 20 | internal override void WriteTo(ByteWriter writer, ref Smb2LogoffRequestBody body) 21 | { 22 | writer.WriteLogoffReqHdr(body); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/base/Titanis.Cli/AliasAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Titanis.Cli 6 | { 7 | /// 8 | /// Specifies one or more aliases for a command or parameter property. 9 | /// 10 | /// 11 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Class, AllowMultiple = false)] 12 | public sealed class AliasAttribute : Attribute 13 | { 14 | /// 15 | /// Initializes a new . 16 | /// 17 | /// List of aliases for t 18 | public AliasAttribute(params string[] aliases) 19 | { 20 | this.Aliases = aliases; 21 | } 22 | 23 | /// 24 | /// Gets a list of aliases. 25 | /// 26 | public string[] Aliases { get; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tools/security/Kerb/Kerb.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net8.0 6 | enable 7 | enable 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/base/Titanis.Core/compat/ArrayHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | #pragma warning disable IDE0130 // Namespace does not match folder structure 6 | namespace Titanis 7 | #pragma warning restore IDE0130 // Namespace does not match folder structure 8 | { 9 | public static class ArrayHelper 10 | { 11 | public static TOutput[] ConvertAll(this TSource[] source, Func converter) 12 | { 13 | if (source is null) 14 | throw new ArgumentNullException(nameof(source)); 15 | if (converter is null) 16 | throw new ArgumentNullException(nameof(converter)); 17 | 18 | TOutput[] output = new TOutput[source.Length]; 19 | for (int i = 0; i < source.Length; i++) 20 | { 21 | output[i] = converter(source[i]); 22 | } 23 | return output; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/net/Titanis.DceRpc/WireProtocol/PduHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Runtime.InteropServices; 4 | using System.Text; 5 | 6 | namespace Titanis.DceRpc.WireProtocol 7 | { 8 | // [C706] § 12.6.3.1 9 | [StructLayout(LayoutKind.Sequential, Pack = 1)] 10 | [PduStruct] 11 | public partial struct PduHeader 12 | { 13 | public static unsafe int StructSize = sizeof(PduHeader); 14 | 15 | public byte rpcVersMajor; 16 | public byte rpcVersMinor; 17 | public PduType ptype; 18 | public PfcFlags pfc_flags; 19 | public uint drep; 20 | public ushort fragLength; 21 | public ushort authLength; 22 | public int callId; 23 | 24 | internal unsafe Span AsSpan() 25 | { 26 | fixed (byte* pStruc = &this.rpcVersMajor) 27 | { 28 | return new Span(pStruc, PduStructSize); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/net/msrpc/Titanis.Msrpc.Msdcom/IUnmarshaler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Titanis.IO; 7 | 8 | namespace Titanis.Msrpc.Msdcom 9 | { 10 | /// 11 | /// Provides functionality to unmarshal an object returned from a DCOM call. 12 | /// 13 | /// 14 | /// Register an implementation of this interface with . 15 | /// 16 | public interface IUnmarshaler 17 | { 18 | /// 19 | /// Reads OBJREF data and constructs an object. 20 | /// 21 | /// Reader containing object data 22 | /// The unmarshaled 23 | Objref Unmarshal(ByteMemoryReader reader); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/crypto/Titanis.Crypto.Sp800_108.Test/Titanis.Crypto.Sp800_108.Test.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | --------------------------------------------------------------------------------