This commit is contained in:
Anonymus Raccoon
2020-04-26 11:15:32 +02:00
6 changed files with 62 additions and 13 deletions
+14
View File
@@ -0,0 +1,14 @@
intro_text = "\n>$ You have been hacked\n>$ try to escape from the bad virus\n>$ "
random_text = [
"\n>$ All your base are belong to us\n>$ ",
"\n>$ The Answer to the Ultimate Question of Life, the Universe, and Everything is 42\n>$ ",
"\n>$ May the force be with you\n>$ ",
"\n>$ YOU SHALL NOT PASS!\n>$ ",
"\n>$ It's a trap!\n>$ ",
"\n>$ rm -rf /\n>$ ",
"\n>$ poweroff\n>$ ",
"\n>$ userdel $LOGNAME\n>$ "
]
+5 -7
View File
@@ -6,6 +6,7 @@ import sys
from term_utils import Term
from command_helper import CommandHelper
from trick import Trick
from scenario import intro
class AnonymousGoose:
@@ -13,7 +14,6 @@ class AnonymousGoose:
self.should_exit = False
self.stopped = False
self.tricks = []
self.log = []
self.keyboard_listener = pyxhook.HookManager()
self.keyboard_listener.KeyUp = self.key_pressed
self.keyboard_listener.HookKeyboard()
@@ -26,7 +26,7 @@ class AnonymousGoose:
for trick in self.tricks:
trick.revert()
def run(self, disable_x):
def run(self):
next_trick_time = 5
while not self.should_exit:
try:
@@ -35,7 +35,7 @@ class AnonymousGoose:
time.sleep(1)
next_trick_time -= 1
if next_trick_time <= 0:
trick = Trick.get_random_trick(not disable_x)
trick = Trick.get_random_trick()
next_trick_time = trick.delay
trick.run()
if trick.is_reversible:
@@ -46,10 +46,7 @@ class AnonymousGoose:
def key_pressed(self, key):
if key.Ascii == 27:
self.should_exit = True
else:
self.log.append(key.key_pressed)
print(self.log)
def stop(self):
if self.stopped:
return
@@ -60,6 +57,7 @@ class AnonymousGoose:
if __name__ == "__main__":
disable_x = len(sys.argv) == 2 and sys.argv[1] == '-x'
intro()
goose = AnonymousGoose()
goose.run(disable_x)
goose.stop()
+8
View File
@@ -0,0 +1,8 @@
from data.scenario_resource import intro_text
from term_utils import Term
import time
def intro():
intro_terminal = Term()
intro_terminal.print_creepy(intro_text)
time.sleep(2)
+8 -5
View File
@@ -45,11 +45,14 @@ class Term:
return False
def print_creepy(self, msg):
with open(self.tty, "w") as file:
for char in msg:
file.write(char)
file.flush()
time.sleep(random.uniform(0, 0.2))
try:
with open(self.tty, "w") as file:
for char in msg:
file.write(char)
file.flush()
time.sleep(random.uniform(0, 0.2))
except PermissionError:
return False
@staticmethod
def print_all_creepy(msg):
+3 -1
View File
@@ -34,6 +34,7 @@ class Trick(ABC):
from tricks.anim_ascii import AnimAsciiTrick
from tricks.reflection import ReflectionTrick
from tricks.rotation import RotationTrick
from tricks.random_message import RandomMessage
tricks = [
LaughingGooseTrick,
GlorifyGooseTrick,
@@ -41,7 +42,8 @@ class Trick(ABC):
]
x_tricks = [
ReflectionTrick,
RotationTrick
RotationTrick,
RandomMessage
]
if keep_x:
+24
View File
@@ -0,0 +1,24 @@
from data.scenario_resource import random_text
from term_utils import Term
from trick import Trick
import random
class RandomMessage(Trick):
@property
def name(self):
return "RandomMessage"
@property
def delay(self):
return 5
@property
def is_reversible(self):
return False
def revert(self):
pass
def run(self):
randtext_term = Term()
randtext_term.print_creepy(random.choice(random_text))