MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / parse_strings

Function parse_strings

pythonmemorymodule/pefile.py:664–684  ·  view source on GitHub ↗
(data, counter, l)

Source from the content-addressed store, hash-verified

662# Ange Albertini's code to process resources' strings
663#
664def parse_strings(data, counter, l):
665 i = 0
666 error_count = 0
667 while i < len(data):
668
669 data_slice = data[i : i + 2]
670 if len(data_slice) < 2:
671 break
672
673 len_ = struct.unpack("<h", data_slice)[0]
674 i += 2
675 if len_ != 0 and 0 <= len_ * 2 <= len(data):
676 try:
677 l[counter] = b(data[i : i + len_ * 2]).decode("utf-16le")
678 except UnicodeDecodeError:
679 error_count += 1
680 pass
681 if error_count >= 3:
682 break
683 i += len_ * 2
684 counter += 1
685
686
687def retrieve_flags(flag_dict, flag_filter):

Callers 1

Calls 3

bFunction · 0.85
decodeMethod · 0.80
unpackMethod · 0.45

Tested by

no test coverage detected