import hashlib

from gym_malware.envs.controls import manipulate2 as manipulate
from gym_malware.envs.utils import interface

# np.random.seed(322333)
# random_action = lambda bytez: np.random.choice( list(manipulate.ACTION_TABLE.keys()) )
from other import lief_test

random_action = lambda bytez: 'section_append'
# original 32bit putty.exe in sha256 file name
fileName = 'VirusShare_0a7e4d6c6006ed4a33b5fe0c181062c0'
bytez = interface.fetch_file(fileName)
lief_test.showPE(fileName)

action = random_action(bytez)
print(action)
bytez_mod = manipulate.modify_without_breaking(bytez, [action])

with open("putty-mod32.exe", "wb") as new_file:
    new_file.write(bytez_mod)
    lief_test.showPE("putty-mod32.exe")
