How to use the smbprotocol.structure.IntField 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 / rpc.py View on Github external
size=2,
                default=lambda s: len(s)
            )),
            ('auth_length', IntField(size=2)),
            ('call_id', IntField(size=4)),
            ('provider_reject_reason', EnumField(
                size=2,
                enum_type=BindNakReason
            )),
            # versions
            ('n_protocols', IntField(
                size=1,
                default=lambda s: len(s['p_protocols'].get_value())
            )),
            ('p_protocols', ListField(
                list_type=IntField(size=2),
                list_count=lambda s: s['n_protocols'].get_value()
            ))
        ])
        super(BindNakPDU, self).__init__()
github jborean93 / pypsexec / pypsexec / pipe.py View on Github external
def __init__(self):
        self.fields = OrderedDict([
            ('timeout', IntField(size=8)),
            ('name_length', IntField(
                size=4,
                default=lambda s: len(s['name'])
            )),
            ('timeout_specified', BoolField(
                size=1,
                default=lambda s: s['timeout'].get_value() > 0
            )),
            ('padding', IntField(size=1)),
            ('name', BytesField(
                size=lambda s: s['name_length'].get_value()
            ))
        ])
        super(FSCTLPipeWait, self).__init__()
github jborean93 / pypsexec / pypsexec / pipe.py View on Github external
def __init__(self):
        self.fields = OrderedDict([
            ('timeout', IntField(size=8)),
            ('name_length', IntField(
                size=4,
                default=lambda s: len(s['name'])
            )),
            ('timeout_specified', BoolField(
                size=1,
                default=lambda s: s['timeout'].get_value() > 0
            )),
            ('padding', IntField(size=1)),
            ('name', BytesField(
                size=lambda s: s['name_length'].get_value()
            ))
        ])
        super(FSCTLPipeWait, self).__init__()
github jborean93 / pypsexec / pypsexec / scmr.py View on Github external
('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 / paexec.py View on Github external
def __init__(self):
        self.fields = OrderedDict([
            ('msg_id', EnumField(
                size=2,
                default=PAExecMsgId.MSGID_SETTINGS,
                enum_type=PAExecMsgId
            )),
            ('xor_val', IntField(
                size=4,
                default=os.urandom(4)
            )),
            ('unique_id', IntField(size=4)),
            ('buffer_len', IntField(size=4)),
            ('buffer', StructureField(
                structure_type=PAExecSettingsBuffer
            ))
        ])
        super(PAExecSettingsMsg, self).__init__()
github jborean93 / pypsexec / pypsexec / paexec.py View on Github external
('remote_log_path_len', IntField(
                size=4,
                default=lambda s: int(len(s['remote_log_path']) / 2)
            )),
            ('remote_log_path', BytesField(
                size=lambda s: s['remote_log_path_len'].get_value() * 2
            )),
            ('no_delete', BoolField(size=1)),
            ('src_dir_len', IntField(
                size=4,
                default=lambda s: int(len(s['src_dir']) / 2)
            )),
            ('src_dir', BytesField(
                size=lambda s: s['src_dir_len'].get_value() * 2
            )),
            ('dest_dir_len', IntField(
                size=4,
                default=lambda s: int(len(s['dest_dir']) / 2)
            )),
            ('dest_dir', BytesField(
                size=lambda s: s['dest_dir_len'].get_value() * 2
            )),
            ('num_src_files', IntField(
                size=4,
                default=lambda s: len(s['src_files'].get_value())
            )),
            ('src_files', ListField(
                list_count=lambda s: s['num_src_files'].get_value(),
                list_type=StructureField(structure_type=PAExecFileInfo),
                unpack_func=lambda s, d:
                self._unpack_file_list(s, d, 'num_src_files')
            )),
github jborean93 / pypsexec / pypsexec / paexec.py View on Github external
def __init__(self):
        self.fields = OrderedDict([
            ('version', IntField(
                size=4,
                default=1
            )),
            ('num_processors', IntField(
                size=4,
                default=lambda s: len(s['processors'].get_value())
            )),
            ('processors', ListField(
                size=lambda s: s['num_processors'].get_value() * 4,
                list_count=lambda s: s['num_processors'].get_value(),
                list_type=IntField(size=4)
            )),
            ('copy_files', BoolField(size=1)),
            ('force_copy', BoolField(size=1)),
            ('copy_if_newer_or_higher_ver', BoolField(size=1)),
            ('asynchronous', BoolField(size=1)),
            ('dont_load_profile', BoolField(size=1)),
            ('interactive_session', IntField(size=4)),
            ('interactive', BoolField(size=1)),
            ('run_elevated', BoolField(size=1)),
            ('run_limited', BoolField(size=1)),
            ('password_len', IntField(
                size=4,
                default=lambda s: int(len(s['password']) / 2)
            )),
            ('password', BytesField(
                size=lambda s: s['password_len'].get_value() * 2
github jborean93 / pypsexec / pypsexec / rpc.py View on Github external
)),
            ('rpc_vers_minor', IntField(size=1)),
            ('ptype', EnumField(
                size=1,
                enum_type=PType,
                default=PType.BIND_ACK
            )),
            ('pfx_flags', FlagField(
                size=1,
                flag_type=PFlags
            )),
            ('packed_drep', StructureField(
                size=4,
                structure_type=DataRepresentationFormat
            )),
            ('frag_length', IntField(
                size=2,
                default=lambda s: len(s)
            )),
            ('auth_length', IntField(
                size=2,
                default=lambda s: len(s['auth_verifier'])
            )),
            ('call_id', IntField(size=4)),
            ('max_xmit_frag', IntField(size=2)),
            ('max_recv_frag', IntField(size=2)),
            ('assoc_group_id', IntField(size=4)),
            # port_any_t
            ('sec_addr_len', IntField(
                size=2,
                default=lambda s: len(s['sec_addr'])
            )),
github jborean93 / pypsexec / pypsexec / rpc.py View on Github external
size=1,
                flag_type=PFlags
            )),
            ('packed_drep', StructureField(
                size=4,
                structure_type=DataRepresentationFormat
            )),
            ('frag_length', IntField(
                size=2,
                default=lambda s: len(s)
            )),
            ('auth_length', IntField(
                size=2,
                default=lambda s: len(s['auth_verifier'])
            )),
            ('call_id', IntField(size=4)),
            ('alloc_hint', IntField(size=4)),
            ('cont_id', IntField(size=2)),
            ('opnum', IntField(size=2)),
            ('object', BytesField(
                size=lambda s:
                16 if s['pfx_flags'].has_flag(PFlags.PFC_OBJECT_UUID) else 0
            )),
            ('stub_data', BytesField(
                size=lambda s: self._get_stub_data_size(s)
            )),
            ('auth_verifier', BytesField(
                size=lambda s: s['auth_length'].get_value()
            ))
        ])
        super(RequestPDU, self).__init__()