Class: RubySMB::Dcerpc::Ndr::NdrStruct

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/ruby_smb/dcerpc/ndr.rb

Direct Known Subclasses

Drsr::Attr, Drsr::Attrblock, Drsr::Attrval, Drsr::Attrvalblock, Drsr::DrsCompressedBlob, Drsr::DrsExtensions, Drsr::DrsExtensionsInt, Drsr::DrsMsgCrackreply, Drsr::DrsMsgCrackreplyV1, Drsr::DrsMsgCrackreq, Drsr::DrsMsgCrackreqV1, Drsr::DrsMsgDcinforeply, Drsr::DrsMsgDcinforeplyV1, Drsr::DrsMsgDcinforeplyV2, Drsr::DrsMsgDcinforeplyV3, Drsr::DrsMsgDcinforeplyVffffffff, Drsr::DrsMsgDcinforeq, Drsr::DrsMsgDcinforeqV1, Drsr::DrsMsgGetchgreply, Drsr::DrsMsgGetchgreplyV1, Drsr::DrsMsgGetchgreplyV2, Drsr::DrsMsgGetchgreplyV6, Drsr::DrsMsgGetchgreplyV7, Drsr::DrsMsgGetchgreplyV9, Drsr::DrsMsgGetchgreq, Drsr::DrsMsgGetchgreqV3, Drsr::DrsMsgGetchgreqV4, Drsr::DrsMsgGetchgreqV5, Drsr::DsDomainControllerInfo1w, Drsr::DsDomainControllerInfo2w, Drsr::DsDomainControllerInfo3w, Drsr::DsDomainControllerInfoFfffffffw, Drsr::DsName, Drsr::DsNameResultItemw, Drsr::DsNameResultw, Drsr::Entinf, Drsr::MtxAddr, Drsr::OidT, Drsr::PartialAttrVectorV1Ext, Drsr::PrefixTableEntry, Drsr::PropertyMetaDataExt, Drsr::PropertyMetaDataExtVector, Drsr::ReplentinflistPtr, Drsr::ReplvalinfV1, Drsr::ReplvalinfV3, Drsr::SchemaPrefixTable, Drsr::UptodateCursorV1, Drsr::UptodateCursorV2, Drsr::UptodateVectorV1Ext, Drsr::UptodateVectorV2Ext, Drsr::UsnVector, Drsr::ValueMetaDataExtV1, Drsr::ValueMetaDataExtV3, Drsr::VarSizeBufferWithVersion, Efsrpc::EfsHashBlob, Efsrpc::EncryptionCertificateHash, Epm::EpmDecodedTowerOctetString, Epm::EpmFloorHostOrAddr, Epm::EpmFloorInterfaceOrDataIdentifier, Epm::EpmFloorPipeOrHost, Epm::EpmFloorPipeOrPort, Epm::EpmFloorProtocolIdentifier, Epm::EpmIpxSpxAddress, Epm::EpmTwrt, Icpr::CertTransBlob, Lsarpc::LsaprAcl, Lsarpc::LsaprObjectAttributes, Lsarpc::LsaprPolicyAccountDomInfo, Lsarpc::LsaprPolicyAuditEventsInfo, Lsarpc::LsaprPolicyAuditLogInfo, Lsarpc::LsaprPolicyDnsDomainInfo, Lsarpc::LsaprPolicyInformation, Lsarpc::LsaprPolicyInformationClass, Lsarpc::LsaprPolicyLsaServerRole, Lsarpc::LsaprPolicyLsaServerRoleInfo, Lsarpc::LsaprPolicyMachineAcctInfo, Lsarpc::LsaprPolicyPdAccountInfo, Lsarpc::LsaprPolicyPrimaryDomInfo, Lsarpc::LsaprPolicyReplicaSrceInfo, Lsarpc::LsaprReferencedDomainList, Lsarpc::LsaprSecurityContextTrackingMode, Lsarpc::LsaprSecurityDescriptor, Lsarpc::LsaprSecurityDescriptorControl, Lsarpc::LsaprSidEnumBuffer, Lsarpc::LsaprSidInformation, Lsarpc::LsaprTranslatedName, Lsarpc::LsaprTranslatedNames, Lsarpc::LsaprTrustInformation, Lsarpc::PolicyAuditFullQueryInfo, Lsarpc::PolicyAuditFullSetInfo, Lsarpc::PolicyModificationInfo, Lsarpc::SecurityImpersonationLevel, Lsarpc::SecurityQualityOfService, RubySMB::Dcerpc::Netlogon::DomainControllerInfoW, RubySMB::Dcerpc::Netlogon::NetlogonAuthenticator, PContElemT, PContListT, PResultListT, PResultT, PSyntaxIdT, PortAnyT, PrintSystem::DriverContainer, PrintSystem::DriverInfo2, RpcSecurityAttributes, RpcSecurityDescriptor, RpcUnicodeString, RrpUnicodeString, Samr::EncryptedNtOwfPassword, Samr::GroupMembership, Samr::RpcSid, Samr::SamprDomainGeneralInformation, Samr::SamprDomainGeneralInformation2, Samr::SamprDomainLockoutInformation, Samr::SamprDomainLogoffInformation, Samr::SamprDomainModifiedInformation, Samr::SamprDomainModifiedInformation2, Samr::SamprDomainNameInformation, Samr::SamprDomainOemInformation, Samr::SamprDomainPasswordInformation, Samr::SamprDomainReplicationInformation, Samr::SamprDomainServerRoleInformation, Samr::SamprDomainStateInformation, Samr::SamprEncryptedUserPassword, Samr::SamprEnumerationBuffer, Samr::SamprGetGroupsBuffer, Samr::SamprGetMembersBuffer, Samr::SamprPsidArray, Samr::SamprRidEnumeration, Samr::SamprSidInformation, Samr::SamprUlongArray, SecTrailer, Srvsvc::LpshareEnumStruct, Srvsvc::ShareInfo1Container, Srvsvc::ShareInfo1Element, Svcctl::QueryServiceConfigW, Svcctl::ServiceStatus, Winreg::Regsam, Wkssvc::LpwkstaInfo, Wkssvc::WkstaInfo100, Wkssvc::WkstaInfo101, Wkssvc::WkstaInfo102, Wkssvc::WkstaUserEnumStructure, Wkssvc::WkstaUserInfo0, Wkssvc::WkstaUserInfo0Container, Wkssvc::WkstaUserInfo1, Wkssvc::WkstaUserInfo1Container

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.has_conformant_arrayObject (readonly)

Returns the value of attribute has_conformant_array.



837
838
839
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 837

def has_conformant_array
  @has_conformant_array
end

Class Method Details

.method_missing(symbol, *args, &block) ⇒ Object



854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 854

def self.method_missing(symbol, *args, &block)
  field = super
  if field.is_a?(::Array) && field.last.is_a?(BinData::SanitizedField)
    unless field.last.has_parameter?(:byte_align) || field.last.instantiate.bit_aligned?
      raise ArgumentError.new(
        "NDR Structures must only include elements with the `:byte_align` "\
        "parameter set. This makes sure the whole structure is correctly "\
        "aligned. Use a predefined NDR element instead, or provide the "\
        "`:byte_align` parameter when defining the structure "\
        "(Faulty element: #{field.last.name})"
      )
    end
    validate_conformant_array(field)
  end
  field
end

.validate_conformant_array(field) ⇒ Object



839
840
841
842
843
844
845
846
847
848
849
850
851
852
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 839

def self.validate_conformant_array(field)
  if @has_conformant_array
    raise ArgumentError.new(
      "Invalid structure #{self}: Conformant array or embedded structure "\
      "with Conformant array must be the last member of the structure"
    )
  end
  obj_proto = field.last.prototype
  obj_class = obj_proto.instance_variable_get(:@obj_class)
  @has_conformant_array = true if obj_class < NdrStruct && obj_class.has_conformant_array
  if obj_class.is_a?(ConfClassPlugin) && !obj_class.is_a?(PointerClassPlugin)
    @has_conformant_array = true
  end
end

Instance Method Details

#initialize_shared_instanceObject



871
872
873
874
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 871

def initialize_shared_instance
  super
  extend StructPlugin
end