add: PE random resources
This commit is contained in:
29
metadata.py
29
metadata.py
@@ -1,6 +1,31 @@
|
||||
from randomness import *
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
def generate_bmp(filename):
|
||||
# Define the dimensions of the BMP image
|
||||
width = 256 # Width of the image
|
||||
height = 256 # Height of the image
|
||||
|
||||
# Create a new blank image with a white background
|
||||
img = Image.new('RGB', (width, height), 'white')
|
||||
|
||||
# Create a drawing object to draw on the image
|
||||
draw = ImageDraw.Draw(img)
|
||||
|
||||
# Generate random pixel colors and fill the image
|
||||
for x in range(width):
|
||||
for y in range(height):
|
||||
red = GetRandomRange(0, 255)
|
||||
green = GetRandomRange(0, 255)
|
||||
blue = GetRandomRange(0, 255)
|
||||
pixel_color = (red, green, blue)
|
||||
draw.point((x, y), fill=pixel_color)
|
||||
|
||||
# Save the generated BMP image
|
||||
img.save(filename, 'BMP')
|
||||
|
||||
def change_metadata(icon_file) :
|
||||
number_of_bmp = GetRandomRange(2, 6)
|
||||
f = open("DllExecutor.rc", "r")
|
||||
f_c = f.readlines()
|
||||
f.close()
|
||||
@@ -24,6 +49,10 @@ def change_metadata(icon_file) :
|
||||
|
||||
elif "MAINICON" in line and icon_file != "":
|
||||
line = f'MAINICON ICON "{icon_file}"\n'
|
||||
for i in range(number_of_bmp) :
|
||||
bmp_name = f"img_{i}.bmp"
|
||||
generate_bmp(bmp_name)
|
||||
line += f'{GetRandomString(10)} BITMAP "{bmp_name}"\n'
|
||||
|
||||
o.write(line)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user