Skip to content

Commit

Permalink
Create exe and do todo patch (#97)
Browse files Browse the repository at this point in the history
## Pull Request Template

### Prerequisites

<!-- Take a couple of minutes to help our maintainers work faster by
checking of the pre-requisites. -->

- [x] I have
[searched](https:/DefinetlyNotAI/Logicytics/pulls) for
duplicate or closed issues.
- [x] I have read the [contributing
guidelines](https:/DefinetlyNotAI/Logicytics/blob/main/CONTRIBUTING.md).
- [x] I have followed the instructions in the
[wiki](https:/DefinetlyNotAI/Logicytics/wiki) about
contributions.
- [x] I have updated the documentation accordingly, if required.
- [x] I have added tests to cover my changes, and they have passed, if
required.
- [ ] I have tested my code with the `--dev` flag, if required.

### PR Type

<!-- Take a couple of minutes to help our maintainers work faster by
telling us what is the PR guided on. -->

- [x] Bug fix <!-- Non-Breaking Bug Fix - Usually relates to fixing an
issue -->
- [ ] New feature <!-- Non-Breaking Change that adds a new feature -->
- [x] Refactoring <!-- Non-Breaking Change that modifies existing code
to refactor it to become more organised -->
- [x] Documentation
update <!-- Non-Breaking Change that modifies existing documentation to
refactor it or add extra comments - either wiki, md files or code is
included here -->
- [ ] ⚠️ Breaking change ⚠️ <!-- ⚠️ Breaking Bug Fix / New Addition that
changes how Logicytics works ⚠️-->

### Description

Updated everything, did some huge bug fixes etc

### Motivation and Context

Too lazy to write this

### Issues Fixed

Nothing
  • Loading branch information
DefinetlyNotAI authored Sep 9, 2024
2 parents 2b44306 + c02b17d commit 60b4f74
Show file tree
Hide file tree
Showing 20 changed files with 528 additions and 3,274 deletions.
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@

<!--Why is this PR required? What problem does it solve? -->

### Binaries

<!--If you have any binaries built from the AIP, Upload them here -->

### Issues Fixed

<!--What issues will be fixed? (Format: "#50, #23" etc) -->
3 changes: 2 additions & 1 deletion .idea/Logicytics.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added CODE/Logicytics.exe
Binary file not shown.
299 changes: 154 additions & 145 deletions CODE/Logicytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,169 +172,178 @@ def __run_other_script(script: str) -> None:
"""

# Initialization
os.makedirs("../ACCESS/LOGS/", exist_ok=True)
os.makedirs("../ACCESS/LOGS/DEBUG", exist_ok=True)
os.makedirs("../ACCESS/BACKUP/", exist_ok=True)
os.makedirs("../ACCESS/DATA/Hashes", exist_ok=True)
os.makedirs("../ACCESS/DATA/Zip", exist_ok=True)
Actions().mkdir()
check_status = Check()

if __name__ == "__main__":
try:
action, sub_action = Actions().flags()
except Exception:
action = Actions().flags()
action = action[0]
sub_action = None

# Special actions -> Quit
if action == "debug":
debug()
input("Press Enter to exit...")
exit(0)
log = Log(debug=DEBUG)
if action == "dev":
dev_checks()
input("Press Enter to exit...")
exit(0)
if action == "extra":
log.info("Opening extra tools menu...")
menu()
input("Press Enter to exit...")
exit(0)
if action == "update":
log.info("Updating...")
update()
log.info("Update complete!")
input("Press Enter to exit...")
exit(0)
if action == "restore":
log.warning(
"Sorry, this feature is yet to be implemented. You can manually Restore your backups, We will open "
"the location for you"
)
open_file("../ACCESS/BACKUP/")
input("Press Enter to exit...")
exit(1)
if action == "backup":
log.info("Backing up...")
backup(".", "Default_Backup")
log.debug("Backup complete -> CODE dir")
backup(".", "Mods_Backup")
log.debug("Backup complete -> MODS dir")
log.info("Backup complete!")
input("Press Enter to exit...")
exit(0)
if action == "unzip_extra":
log.warning(
"The contents of this directory can be flagged as malicious and enter quarantine, please use with "
"caution"
)
log.info("Unzipping...")
unzip("..\\EXTRA\\EXTRA.zip")
log.info("Unzip complete!")
input("Press Enter to exit...")
exit(0)
try:
# Get flags
action, sub_action = Actions().flags()
except Exception:
action = Actions().flags()
action = action[0]
sub_action = None

# Special actions -> Quit
if action == "debug":
debug()
input("Press Enter to exit...")
exit(0)

log.info("Starting Logicytics...")
log = Log(debug=DEBUG)

# Check for privileges and errors
if not check_status.admin():
log.critical("Please run this script with admin privileges", "_W", "P", "BA")
input("Press Enter to exit...")
exit(1)
if check_status.uac():
log.warning("UAC is enabled, this may cause issues")
log.warning("Please disable UAC if possible")
if action == "dev":
dev_checks()
input("Press Enter to exit...")
exit(0)

# Create execution list
if action == "extra":
log.info("Opening extra tools menu...")
menu()
input("Press Enter to exit...")
exit(0)

if action == "update":
log.info("Updating...")
update()
log.info("Update complete!")
input("Press Enter to exit...")
exit(0)

if action == "restore":
log.warning(
"Sorry, this feature is yet to be implemented. You can manually Restore your backups, We will open "
"the location for you"
)
open_file("../ACCESS/BACKUP/")
input("Press Enter to exit...")
exit(1)

if action == "backup":
log.info("Backing up...")
backup(".", "Default_Backup")
log.debug("Backup complete -> CODE dir")
backup(".", "Mods_Backup")
log.debug("Backup complete -> MODS dir")
log.info("Backup complete!")
input("Press Enter to exit...")
exit(0)

if action == "unzip_extra":
log.warning(
"The contents of this directory can be flagged as malicious and enter quarantine, please use with "
"caution"
)
log.info("Unzipping...")
unzip("..\\EXTRA\\EXTRA.zip")
log.info("Unzip complete!")
input("Press Enter to exit...")
exit(0)


log.info("Starting Logicytics...")


# Check for privileges and errors
if not check_status.admin():
log.critical("Please run this script with admin privileges", "_W", "P", "BA")
input("Press Enter to exit...")
exit(1)

if check_status.uac():
log.warning("UAC is enabled, this may cause issues")
log.warning("Please disable UAC if possible")

# Create execution list
execution_list = [
"driverquery+sysinfo.py",
"log_miner.py",
"media_backup.py",
"online_ip_scraper.py",
"registry.py",
"sensitive_data_miner.py",
"ssh_miner.py",
"sys_internal.py",
"tasklist.py",
"tree.bat",
"wmic.py",
"browser_miner.ps1",
"netadapter.ps1",
"property_scraper.ps1",
"window_feature_miner.ps1",
]

if action == "minimal":
execution_list = [
"driverquery+sysinfo.py",
"log_miner.py",
"media_backup.py",
"online_ip_scraper.py",
"registry.py",
"sensitive_data_miner.py",
"ssh_miner.py",
"sys_internal.py",
"tasklist.py",
"tree.bat",
"wmic.py",
"browser_miner.ps1",
"netadapter.ps1",
"property_scraper.ps1",
"window_feature_miner.ps1",
]

if action == "minimal":
execution_list = [
"driverquery+sysinfo.py",
"registry.py",
"tasklist.py",
"tree.bat",
"wmic.py",
"netadapter.ps1",
"property_scraper.ps1",
"window_feature_miner.ps1",
]

if action == "exe":
log.warning(
"EXE is not fully implemented yet - For now its only SysInternal and WMIC wrappers"
)
execution_list = ["sys_internal.py", "wmic.py"]

if action == "modded":
# Add all files in MODS to execution list
execution_list = Execute.get_files("../MODS", execution_list)

log.debug(execution_list)

# Check weather to use threading or not
if action == "threaded":
execution_list.remove("sensitive_data_miner.py")
threads = []
for index, file in enumerate(execution_list):
thread = threading.Thread(target=Execute().file, args=(index,))
threads.append(thread)
thread.start()

for thread in threads:
thread.join()
else:
for file in range(len(execution_list)): # Loop through List
Execute().execute_script(execution_list[file])
log.info(f"{execution_list[file]} executed")
if action == "exe":
log.warning(
"EXE is not fully implemented yet - For now its only SysInternal and WMIC wrappers"
)
execution_list = ["sys_internal.py", "wmic.py"]

if action == "modded":
# Add all files in MODS to execution list
execution_list = Execute.get_files("../MODS", execution_list)


log.debug(execution_list)

# Check weather to use threading or not
if action == "threaded":
execution_list.remove("sensitive_data_miner.py")
threads = []
for index, file in enumerate(execution_list):
thread = threading.Thread(target=Execute().file, args=(index,))
threads.append(thread)
thread.start()

for thread in threads:
thread.join()
else:
for file in range(len(execution_list)): # Loop through List
Execute().execute_script(execution_list[file])
log.info(f"{execution_list[file]} executed")

# Zip generated files
if action == "modded":
zip_loc_mod, hash_loc = zip_and_hash("..\\MODS", "MODS", action)
log.info(zip_loc_mod)
log.debug(hash_loc)
zip_loc, hash_loc = zip_and_hash("..\\CODE", "CODE", action)
log.info(zip_loc)

if action == "modded":
zip_loc_mod, hash_loc = zip_and_hash("..\\MODS", "MODS", action)
log.info(zip_loc_mod)
log.debug(hash_loc)

# Attempt event log deletion
attempt_hide()

# Finish with sub actions
log.info("Completed successfully")
if sub_action == "shutdown":
log.info("Shutting down...")
os.system("shutdown /s /t 0")
if sub_action == "reboot":
log.info("Rebooting...")
os.system("shutdown /r /t 0")
if sub_action == "webhook":
log.warning("This feature is not fully implemented yet")
"""
log.info("Sending webhook...")
if WEBHOOK is None or WEBHOOK == "":
log.critical("WEBHOOK URL not set and the request action was webhook", "_W", "P", "BA")
input("Press Enter to exit...")
exit(1)
"""
zip_loc, hash_loc = zip_and_hash("..\\CODE", "CODE", action)
log.info(zip_loc)
log.debug(hash_loc)

# Attempt event log deletion
attempt_hide()

# Finish with sub actions
log.info("Completed successfully")
if sub_action == "shutdown":
log.info("Shutting down...")
os.system("shutdown /s /t 0")
if sub_action == "reboot":
log.info("Rebooting...")
os.system("shutdown /r /t 0")
if sub_action == "webhook":
log.warning("This feature is not fully implemented yet")
"""
log.info("Sending webhook...")
if WEBHOOK is None or WEBHOOK == "":
log.critical("WEBHOOK URL not set and the request action was webhook", "_W", "P", "BA")
input("Press Enter to exit...")
exit(1)
"""

log.info("Exiting...")
input("Press Enter to exit...")
log.info("Exiting...")
input("Press Enter to exit...")
42 changes: 0 additions & 42 deletions CODE/__Test__Logicytics.py

This file was deleted.

Loading

0 comments on commit 60b4f74

Please sign in to comment.