How to use the smbprotocol.structure.EnumField function in smbprotocol

To help you get started, we’ve selected a few smbprotocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jborean93 / pypsexec / pypsexec / paexec.py View on Github external
size=4,
                default=lambda s: int(len(s['username']) / 2)
            )),
            ('username', BytesField(
                size=lambda s: s['username_len'].get_value() * 2
            )),
            ('use_system_account', BoolField(size=1)),
            ('working_dir_len', IntField(
                size=4,
                default=lambda s: int(len(s['working_dir']) / 2)
            )),
            ('working_dir', BytesField(
                size=lambda s: s['working_dir_len'].get_value() * 2
            )),
            ('show_ui_on_win_logon', BoolField(size=1)),
            ('priority', EnumField(
                size=4,
                default=ProcessPriority.NORMAL_PRIORITY_CLASS,
                enum_type=ProcessPriority
            )),
            ('executable_len', IntField(
                size=4,
                default=lambda s: int(len(s['executable']) / 2)
            )),
            ('executable', BytesField(
                size=lambda s: s['executable_len'].get_value() * 2
            )),
            ('arguments_len', IntField(
                size=4,
                default=lambda s: int(len(s['arguments']) / 2)
            )),
            ('arguments', BytesField(
github jborean93 / pypsexec / pypsexec / paexec.py View on Github external
def __init__(self):
        self.fields = OrderedDict([
            ('msg_id', EnumField(
                size=2,
                enum_type=PAExecMsgId
            )),
            ('unique_id', IntField(size=4)),
            ('buffer_length', IntField(
                size=4,
                default=lambda s: len(s['buffer'])
            )),
            ('buffer', BytesField(
                size=lambda s: s['buffer_length'].get_value()
            ))
        ])
        super(PAExecMsg, self).__init__()
github jborean93 / pypsexec / pypsexec / scmr.py View on Github external
def __init__(self):
        self.fields = OrderedDict([
            ('service_type', FlagField(
                size=4,
                flag_type=ServiceType,
                flag_strict=False
            )),
            ('current_state', EnumField(
                size=4,
                enum_type=CurrentState
            )),
            ('controls_accepted', FlagField(
                size=4,
                flag_type=ControlsAccepted,
                flag_strict=False
            )),
            ('win32_exit_code', IntField(size=4)),
            ('service_specified_exit_code', IntField(size=4)),
            ('check_point', IntField(size=4)),
            ('wait_hint', IntField(size=4))
        ])
        super(ServiceStatus, self).__init__()
github jborean93 / pypsexec / pypsexec / rpc.py View on Github external
)),
            ('packed_drep', StructureField(
                size=4,
                structure_type=DataRepresentationFormat
            )),
            ('frag_length', IntField(
                size=2,
                default=lambda s: len(s)
            )),
            ('auth_length', IntField(size=2)),
            ('call_id', IntField(size=4)),
            ('alloc_hint', IntField(size=4)),
            ('p_cont_id', IntField(size=2)),
            ('cancel_count', IntField(size=1)),
            ('reserved', IntField(size=1)),
            ('status', EnumField(
                size=4,
                enum_type=FaultStatus,
                enum_strict=False
            ))
        ])
        super(FaultPDU, self).__init__()
github jborean93 / pypsexec / pypsexec / rpc.py View on Github external
def __init__(self):
        self.fields = OrderedDict([
            ('integer_character', EnumField(
                size=1,
                enum_type=IntegerCharacterRepresentation,
                default=IntegerCharacterRepresentation.ASCII_LITTLE_ENDIAN
            )),
            ('floating_point', EnumField(
                size=1,
                enum_type=FloatingPointRepresentation,
                default=FloatingPointRepresentation.IEEE
            )),
            ('reserved1', IntField(size=1)),
            ('reserved2', IntField(size=1))
        ])
        super(DataRepresentationFormat, self).__init__()
github jborean93 / pypsexec / pypsexec / rpc.py View on Github external
def __init__(self):
        self.fields = OrderedDict([
            ('result', EnumField(
                size=2,
                enum_type=ContextResult
            )),
            ('reason', EnumField(
                size=2,
                enum_type=ResultReason
            )),
            ('transfer_syntax', StructureField(
                size=20,
                structure_type=SyntaxIdElement
            )),
        ])
        super(Result, self).__init__()