MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / encode

Method encode

pager_lib/smb/smb_structs.py:160–179  ·  view source on GitHub ↗

Encode this SMB message into a series of bytes suitable to be embedded with a NetBIOS session message. AssertionError will be raised if this SMB message has not been initialized with a Payload instance @return: a string containing the encoded SMB message

(self)

Source from the content-addressed store, hash-verified

158 return bool(self.flags2 & SMB_FLAGS2_EXTENDED_SECURITY)
159
160 def encode(self):
161 """
162 Encode this SMB message into a series of bytes suitable to be embedded with a NetBIOS session message.
163 AssertionError will be raised if this SMB message has not been initialized with a Payload instance
164
165 @return: a string containing the encoded SMB message
166 """
167 assert self.payload
168
169 self.pid = os.getpid()
170 self.payload.prepare(self)
171
172 parameters_len = len(self.parameters_data)
173 assert parameters_len % 2 == 0
174
175 headers_data = struct.pack(self.HEADER_STRUCT_FORMAT,
176 b'\xFFSMB', self.command, self.status.internal_value, self.flags,
177 self.flags2, (self.pid >> 16) & 0xFFFF, self.security, self.tid,
178 self.pid & 0xFFFF, self.uid, self.mid, int(parameters_len / 2))
179 return headers_data + self.parameters_data + struct.pack('<H', len(self.data)) + self.data
180
181 def decode(self, buf):
182 """

Callers 15

_slugifyMethod · 0.45
save_zap_credentialsMethod · 0.45
get_zap_credentialsMethod · 0.45
_run_nuclei_scanMethod · 0.45
_apply_scan_authMethod · 0.45
_fuzz_json_bodyMethod · 0.45
generate_zap_reportMethod · 0.45
_hash_passwordMethod · 0.45
_verify_passwordMethod · 0.45

Calls 1

prepareMethod · 0.45

Tested by 1

_feedFunction · 0.36