That One
That One

Reputation: 597

Keeping the script running when closing the window and opening a text editor in Python

As we all know April fools is coming so i tought i would write a nice script to prank someone, a harmless version of the well known and feared MEMZ Virus.

The Script i have currently:

import webbrowser
import time

def program():
    time.sleep(13)
    url = "https://www.google.nl/#q=TROLOL+GO+TO+LAUGH+IDIOT&*"
    webbrowser.open(url,new=new)
    time.sleep(16)
    url = "https://www.google.nl/webhp?sourceid=chrome-instant&rlz=1CAACAG_enNL654NL655&ion=1&espv=2&ie=UTF-8#q=CS:GO+Hacks+No+Download&*"
    webbrowser.open(url, new=new)
    time.sleep(18)
    url = "https://www.youtube.com/watch?v=7S94ohyErSw"
    webbrowser.open(url, new=new)
    time.sleep(23)

def main():
    pass

if __name__ == "__main__":
    main()

What i want is to be able to open a text editor with text just like in the real virus. A windows error box would be fine to. Also i dont want the prompt. so a way to close the prompt without ending the script would be nice.

Anyone got some ideas?

Thank you in advance.

Natan.

EDIT: My victim's Computer has Windows.

EDIT2: I have updated the script:

import webbrowser
import ctypes
import time

MB_OK = 0x0
MB_OKCXL = 0x01
MB_YESNOCXL = 0x03
MB_YESNO = 0x04
MB_HELP = 0x4000
ICON_EXLAIM = 0x30
ICON_INFO = 0x40
ICON_STOP = 0x10
ICON_QUES = 0x20

def program():
    ctypes.windll.user32.MessageBoxW(0, "Your computer is fucked by the MEMZ Trojan, good luck trying to keep using it.", "GET REKT, DABBBB", MB_OK | ICON_INFO)
    time.sleep(2)
    ctypes.windll.user32.MessageBoxW(0, "BTW if you shut down your computer you wont be able to start it back up.", "Almost forgot....", MB_OK | ICON_INFO)
    time.sleep(13)
    url = "https://www.google.nl/#q=TROLOL+GO+TO+LAUGH+IDIOT&*"
    webbrowser.open(url,new=new)
    time.sleep(16)
    url = "https://www.google.nl/webhp?sourceid=chrome-instant&rlz=1CAACAG_enNL654NL655&ion=1&espv=2&ie=UTF-8#q=CS:GO+Hacks+No+Download&*"
    webbrowser.open(url, new=new)
    time.sleep(18)
    url = "https://www.youtube.com/watch?v=7S94ohyErSw"
    webbrowser.open(url, new=new)
    time.sleep(23)
    ctypes.windll.user32.MessageBoxW(0, "Still using this computer?", "Hell is that way", MB_OK | ICON_QUES)
    time.sleep(17)
    url = "https://www.gottabemobile.com/black-ops-3-cheats-hacks-things-to-know/"
    webbrowser.open(url, new=new)
    time.sleep(12)
    url = "https://thepiratebay.org/"
    webbrowser.open(url, new=new)
    time.sleep(32)
    url = "http://stackoverflow.com/questions/43114927/keeping-the-script-running-when-closing-the-window-and-opening-a-text-editor-in"
    webbrowser.open(url, new=new)
    ctypes.windll.user32.MessageBoxW(0, "Trololol. Fijne 1 april nog Justus! Groetjes Natan!", "April fools", MB_OK | ICON_INFO)

def main():
    program()

if __name__ == "__main__":
    main()

Upvotes: 2

Views: 289

Answers (2)

Ashish Srivastava
Ashish Srivastava

Reputation: 124

The solution provided by @Abhishake gupta is good, you can also os module to open a notepad with some text.

import os
f = open('foo.txt','w')
f.write('Hello world!')
f.close()
os.system("notepad.exe foo.txt")

Upvotes: 1

Abhishake Gupta
Abhishake Gupta

Reputation: 3170

you can try in-built library ctypes to bring a pop-up on the screen.

import ctypes 
ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 1)

Hope this helps.

you can actually use pythonw.exe file instead of python.exe Try this link - I haven't tried this thing but hopes it will help you for sure in hiding window console.

you have to simply change your python file extension from file.py to file.pyw and its done No windows console will show up.

Upvotes: 1

Related Questions