mirror of
https://github.com/norandom/log2ml.git
synced 2025-04-19 15:21:27 +00:00
Compare commits
No commits in common. "main" and "lab" have entirely different histories.
Before Width: | Height: | Size: 891 B After Width: | Height: | Size: 891 B |
49
2-1-initial-access-malware/Simulator/simulator.py
Executable file
49
2-1-initial-access-malware/Simulator/simulator.py
Executable file
@ -0,0 +1,49 @@
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import pyautogui
|
||||
|
||||
def open_excel_with_macros(file_path):
|
||||
# Get the directory of the current script/executable
|
||||
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
|
||||
enable_button_image = os.path.join(base_path, 'enable_content.png')
|
||||
|
||||
# Open Excel through the OS start menu or command line
|
||||
os.startfile(file_path)
|
||||
time.sleep(5) # Wait for Excel to open
|
||||
|
||||
# Custom timeout mechanism to locate the 'Enable Content' button
|
||||
timeout = 10 # 10 seconds timeout
|
||||
start_time = time.time()
|
||||
enable_button = None
|
||||
|
||||
while (time.time() - start_time) < timeout:
|
||||
enable_button = pyautogui.locateCenterOnScreen(enable_button_image, confidence=0.8)
|
||||
if enable_button:
|
||||
pyautogui.click(enable_button)
|
||||
break
|
||||
time.sleep(1) # Check every 1 second
|
||||
|
||||
if not enable_button:
|
||||
print("Enable Content button not found, continuing...")
|
||||
|
||||
# Wait for any macros to finish running or other processing
|
||||
time.sleep(10) # Adjust time based on expected macro execution time
|
||||
|
||||
# Close Excel without saving
|
||||
pyautogui.hotkey('alt', 'f4')
|
||||
time.sleep(1)
|
||||
pyautogui.press('n') # Press 'n' in response to Excel's save prompt
|
||||
|
||||
def main():
|
||||
directory = r'C:\Users\mariu\Desktop\Corpus' # Adjust the path to your files
|
||||
files = os.listdir(directory)
|
||||
excel_files = [file for file in files if file.endswith(('.xlsx', '.xlsm'))]
|
||||
|
||||
for file in excel_files:
|
||||
full_path = os.path.join(directory, file)
|
||||
open_excel_with_macros(full_path)
|
||||
time.sleep(5) # Adjust as needed between openings
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Before Width: | Height: | Size: 253 KiB After Width: | Height: | Size: 253 KiB |
File diff suppressed because one or more lines are too long
@ -1,80 +0,0 @@
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import pyautogui
|
||||
import win32gui
|
||||
import win32con
|
||||
|
||||
def close_cmd_window():
|
||||
def enum_windows_callback(hwnd, result):
|
||||
window_title = win32gui.GetWindowText(hwnd).lower()
|
||||
if (win32gui.IsWindowVisible(hwnd) and
|
||||
'cmd.exe' in window_title and
|
||||
'Anaconda' not in window_title):
|
||||
win32gui.PostMessage(hwnd, win32con.WM_CLOSE, 0, 0)
|
||||
|
||||
win32gui.EnumWindows(enum_windows_callback, None)
|
||||
|
||||
def close_excel_without_saving():
|
||||
pyautogui.hotkey('alt', 'f4')
|
||||
time.sleep(1)
|
||||
|
||||
# Try to locate and click the "Don't Save" button
|
||||
try:
|
||||
dont_save_button = pyautogui.locateOnScreen('dont_save_button.png', confidence=0.8)
|
||||
if dont_save_button:
|
||||
pyautogui.click(dont_save_button)
|
||||
print("Clicked 'Don't Save' button")
|
||||
else:
|
||||
print("Save dialogue not found, Excel may have closed without prompting")
|
||||
except pyautogui.ImageNotFoundException:
|
||||
print("Save dialogue not found, Excel may have closed without prompting")
|
||||
|
||||
def open_excel_with_macros(file_path):
|
||||
# Get the directory of the current script/executable
|
||||
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
|
||||
enable_button_image = os.path.join(base_path, 'enable_content.png')
|
||||
|
||||
# Open Excel through the OS start menu or command line
|
||||
os.startfile(file_path)
|
||||
time.sleep(5) # Wait for Excel to open
|
||||
|
||||
# Custom timeout mechanism to locate the 'Enable Content' button
|
||||
timeout = 10 # 10 seconds timeout
|
||||
start_time = time.time()
|
||||
enable_button = None
|
||||
|
||||
while (time.time() - start_time) < timeout:
|
||||
try:
|
||||
enable_button = pyautogui.locateCenterOnScreen(enable_button_image, confidence=0.8)
|
||||
if enable_button:
|
||||
pyautogui.click(enable_button)
|
||||
break
|
||||
except pyautogui.ImageNotFoundException:
|
||||
pass
|
||||
time.sleep(1) # Check every 1 second
|
||||
|
||||
if not enable_button:
|
||||
print("Enable Content button not found, continuing...")
|
||||
|
||||
# Wait for any macros to finish running or other processing
|
||||
time.sleep(10) # Adjust time based on expected macro execution time
|
||||
|
||||
# Close Excel without saving
|
||||
close_excel_without_saving()
|
||||
|
||||
# Close any cmd.exe windows that might have opened, except Anaconda prompt
|
||||
close_cmd_window()
|
||||
|
||||
def main():
|
||||
directory = r'C:\Users\student\Desktop\Corpus' # Adjust the path to your files
|
||||
files = os.listdir(directory)
|
||||
excel_files = [file for file in files if file.endswith(('.xlsx', '.xlsm'))]
|
||||
|
||||
for file in excel_files:
|
||||
full_path = os.path.join(directory, file)
|
||||
open_excel_with_macros(full_path)
|
||||
time.sleep(5) # Adjust as needed between openings
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
||||
[](https://zenodo.org/doi/10.5281/zenodo.13208293)
|
||||
|
||||
|
||||
# Master Thesis: Development and Evaluation of Software for Forensic Log-Analysis Using Machine Learning and Genetic Programming
|
||||
|
4
dependencies/install.sh
vendored
4
dependencies/install.sh
vendored
@ -6,10 +6,6 @@ if [ -d "/content" ]; then
|
||||
echo "Installing dependencies"
|
||||
pip install -r "https://raw.githubusercontent.com/norandom/log2ml/main/dependencies/requirements.gpu.txt"
|
||||
|
||||
# https://docs.rapids.ai/deployment/stable/platforms/colab/
|
||||
git clone https://github.com/rapidsai/rapidsai-csp-utils.git
|
||||
python rapidsai-csp-utils/colab/pip-install.py
|
||||
|
||||
else
|
||||
echo "This does not appear to be a Google Colab environment."
|
||||
fi
|
||||
|
13
dependencies/install_cpu.sh
vendored
13
dependencies/install_cpu.sh
vendored
@ -1,13 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ "$(uname)" == "Darwin" ]] || [[ "$(uname)" == "Linux" ]]; then
|
||||
echo "The CPU installation is starting (macOS, Linux)."
|
||||
|
||||
echo "Installing dependencies"
|
||||
pip install -r "https://raw.githubusercontent.com/norandom/log2ml/main/dependencies/requirements.cgpu.txt"
|
||||
|
||||
echo "cuML will not be installed."
|
||||
|
||||
else
|
||||
echo "This does not appear to be a CPU environment."
|
||||
fi
|
29
dependencies/requirements.cpu.txt
vendored
29
dependencies/requirements.cpu.txt
vendored
@ -1,29 +0,0 @@
|
||||
openai==1.13.3
|
||||
langchain==0.1.10
|
||||
python-dotenv==1.0.1
|
||||
tiktoken==0.6.0
|
||||
langchain_openai==0.0.8
|
||||
langchain_experimental==0.0.53
|
||||
langchainhub==0.1.14
|
||||
ipywidgets
|
||||
transformers==4.39.0
|
||||
torch==2.2.1+cpu
|
||||
torchvision==0.17.1+cpu
|
||||
torchaudio==2.2.1+cpu
|
||||
sentence-transformers==2.5.1
|
||||
faiss_cpu==1.8.0
|
||||
linformer-pytorch==0.19.3
|
||||
PyGithub==2.3.0
|
||||
deap==1.4.1
|
||||
update_checker==0.18.0
|
||||
scikit-mdr==0.4.5
|
||||
skrebate==0.62
|
||||
xgboost==2.0.3
|
||||
stopit==1.1.2
|
||||
tpot==0.12.2
|
||||
umap-learn==0.5.6
|
||||
tabulate==0.9.0
|
||||
onnx==1.16.1
|
||||
skl2onnx==1.17.0
|
||||
protobuf==3.20.3
|
||||
dill==0.3.8
|
5
dependencies/requirements.gpu.txt
vendored
5
dependencies/requirements.gpu.txt
vendored
@ -22,8 +22,3 @@ xgboost==2.0.3
|
||||
stopit==1.1.2
|
||||
tpot==0.12.2
|
||||
umap-learn==0.5.6
|
||||
tabulate==0.9.0
|
||||
onnx==1.16.1
|
||||
skl2onnx==1.17.0
|
||||
protobuf==3.20.3
|
||||
dill==0.3.8
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user