pan-unit42 / dotnetfile

MIT License
99 stars 15 forks source link

add support for loading of .NET executables that have already been loaded outside of dotnetfile #1

Closed R3MRUM closed 2 years ago

R3MRUM commented 2 years ago

Currently dotnetfile only loads .NET executables via their file path. This pull adds the ability for dotnetfile to load a .NET executables via bytes-type object. For example:

$ python3
>>> from dotnetfile import DotNetPE
>>> dotnet_file = DotNetPE('0a5dc3b6669cf31e8536c59fe1315918eb4ecfd87998445e2eeb8fed64bd2f2c')
>>> print(f'Number of streams: {dotnet_file.get_number_of_streams()}')
Number of streams: 5
>>> 
>>> file_data = None
>>> with open('0a5dc3b6669cf31e8536c59fe1315918eb4ecfd87998445e2eeb8fed64bd2f2c', 'rb') as hFile:
...     file_data = hFile.read()
... 
>>> dotnet_file2 = DotNetPE(file_data)
>>> print(f'Number of streams: {dotnet_file2.get_number_of_streams()}')
Number of streams: 5
>>> 
yaronsamuel1 commented 2 years ago

Thanks for the improvement @R3MRUM