forked from rubeon/hkrtpr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hackertyper.py
executable file
·43 lines (32 loc) · 976 Bytes
/
hackertyper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/python
import os
import sys
import curses
import time
import logging
import random
src = ""
logging.basicConfig(filename="hackertyper.log", level=logging.DEBUG,
format='%(asctime)s [%(levelname)s] %(message)s')
def add_text(text_window, src_len):
logging.debug("add_text entered")
# text_window.addstr(0,0,src[0:src_len])
contents = src[0:src_len]
# formatted_contents = highlight(contents, PythonLexer(), Terminal256Formatter())
text_window.addstr(0,0,contents)
def main(stdscr):
"""
"""
logging.debug("starting hackertyper")
stdscr.clear()
src_len=0
while True and src_len < len(src):
add = random.choice(range(3))
src_len += add
input = stdscr.getkey()
logging.debug(input)
add_text(stdscr, src_len)
if __name__=='__main__':
# load the file that should be used for the hackertyper
src = open(sys.argv[-1]).read()
curses.wrapper(main)