I made a python script that runs a GDI PATCOPY effect. I wanted to add audio while it works so I used python's winsound
module for making beeps and python's Threading
module to run the GDI effect and the beeping at the same time, however when I run the script 90% of the beeps made with the audio is cut out or silenced, how do I fix that silencing?
This is my code right now:
from threading import Thread
import os
from win32gui import *
from win32api import *
from win32ui import *
from win32con import *
from random import *
def func1():
#sound generator
import winsound
freq = 500
dur = 1000
freq1 = 600
dur1 = 200
freq2 = 100
dur2 = 100
freq3 = 900
dur3 = 120
freq4 = 700
dur4 = 3000
freq5 = 9000
dur5 = 100
freq6 = 5000
dur6 = 500
freq7 = 700
dur7 = 700
freq8 = 900
dur8 = 400
freq9 = 300
dur9 = 900
winsound.Beep(freq, dur)
winsound.Beep(freq1, dur1)
winsound.Beep(freq2, dur2)
winsound.Beep(freq3, dur3)
winsound.Beep(freq4, dur4)
winsound.Beep(freq5, dur5)
winsound.Beep(freq6, dur6)
winsound.Beep(freq7, dur7)
winsound.Beep(freq8, dur8)
winsound.Beep(freq9, dur9)
def func2():
for i in range(1):
desk = GetDC(0)
x = GetSystemMetrics(0)
y = GetSystemMetrics(1)
print(x)
print(y)
#os.startfile('guiCorrupt.py')
for i in range(50000):
brush = CreateSolidBrush(RGB(
randrange(255),
randrange(255),
randrange(255)
)) #Creates a brush
SelectObject(desk, brush) #Choose that we're drawing with our brush.
PatBlt(desk, randrange(x), randrange(y), randrange(100), randrange(200), PATCOPY)
DeleteObject(brush)
#Sleep(1) #wait
ReleaseDC(desk, GetDesktopWindow())
DeleteDC(desk) #Deletes our DC.
if __name__ == '__main__':
Thread(target = func1).start()
Thread(target = func2).start()
I think it has something to do with the GDI effect itself because without running the effect, I can hear the beeps just fine without any silencing issue.
try playing a wav file instead of the individual notes
EDIT: .wav files are large real GDI Malware uses bytebeat for the sounds here's a repo for python https://github.com/Itzsten/Python-ByteBeat
and some samples: https://dollchan.net/bytebeat/#