Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support VPN reset on macOS + Add VPN to test.yml #247

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ jobs:
run: |
ACCOUNT=0
KEY=1
SMALL_BUSINESS_KEY=1
EMAIL_API=mailticking
SMALL_BUSINESS_KEY=0
VPN=1
EMAIL_API=developermail
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git clone --depth 1 https://github.com/rzc0d3r/ESET-KeyGen.git
Expand All @@ -40,8 +41,6 @@ jobs:
echo -e "\nAccounts generated:" >> $GITHUB_STEP_SUMMARY
cat ./*ACCOUNTS.txt >> $GITHUB_STEP_SUMMARY
fi
if [[ ${KEY} != 0 && ${SMALL_BUSINESS_KEY} != 0 ]]
then
if [[ ${KEY} != 0 ]]
then
for ((attempt=1;attempt<=${KEY};++attempt))
Expand All @@ -56,6 +55,15 @@ jobs:
python3 main.py --chrome --small-business-key --email-api ${EMAIL_API} --skip-update-check --no-logo --disable-progress-bar
done
fi
if [[ ${VPN} != 0 ]]
then
for ((attempt=1;attempt<=${VPN};++attempt))
do
python3 main.py --chrome --vpn-codes --email-api ${EMAIL_API} --skip-update-check --no-logo --disable-progress-bar
done
fi
if [[ ${KEY} != 0 || ${SMALL_BUSINESS_KEY} != 0 || ${VPN} != 0 ]]
then
echo -e "\nKeys generated:" >> $GITHUB_STEP_SUMMARY
cat ./*KEYS.txt >> $GITHUB_STEP_SUMMARY
fi
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.exe
*.pyc
*.txt
*.txt
.DS_STORE
13 changes: 10 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
from modules.EsetTools import EsetVPN as EV
from modules.EsetTools import EsetProtectHubRegister as EPHR
from modules.EsetTools import EsetProtectHubKeygen as EPHK
from modules.EsetTools import EsetVPNReset as EVR
from modules.EsetTools import EsetVPNReset as EVR
from modules.EsetTools import EsetVPNResetMac as EVRM

from modules.SharedTools import *
from modules.Updater import get_assets_from_version, parse_update_json, updater_main
Expand Down Expand Up @@ -259,8 +260,14 @@ def main(disable_exit=False):
time.sleep(3) # exit-delay
sys.exit(0)
elif args['reset_eset_vpn']:
print(f'{Fore.LIGHTMAGENTA_EX}-- Reset ESET VPN --{Fore.RESET}\n')
EVR()
print(f'{Fore.LIGHTMAGENTA_EX}-- Reset ESET VPN --{Fore.RESET}\n')
if sys.platform == "darwin":
EVRM()
elif sys.platform.startswith('win'):
EVR()
else:
raise RuntimeError('This feature is for Windows and macOS only!!!')

if len(sys.argv) == 1:
input('\nPress Enter to exit...')
else:
Expand Down
33 changes: 31 additions & 2 deletions modules/EsetTools.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from .EmailAPIs import *


import subprocess
from subprocess import check_output, DEVNULL

import colorama
import time
import sys

from pathlib import Path

class EsetRegister(object):
def __init__(self, registered_email_obj: OneSecEmailAPI, eset_password: str, driver: Chrome):
Expand Down Expand Up @@ -396,4 +399,30 @@ def EsetVPNReset(key_path='SOFTWARE\\ESET\\ESET VPN', value_name='authHash'):
except PermissionError:
raise RuntimeError(f'Permission denied while accessing: {key_path}\\{value_name}')
except Exception as e:
raise RuntimeError(e)
raise RuntimeError(e)

def EsetVPNResetMac(app_name='ESET VPN', file_name='Preferences/com.eset.ESET VPN.plist'):

if not sys.platform == "darwin":
raise RuntimeError('This feature is for macOS only!!!')
try:
# Use AppleScript to quit the application
script = f'tell application "{app_name}" to quit'
subprocess.run(["osascript", "-e", script], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
except:
pass

time.sleep(2)

try:
# Get the full path to the file in the Library folder
library_path = Path.home() / "Library" / file_name

# Check if the file exists and remove it
if library_path.is_file():
library_path.unlink()
console_log(f'ESET VPN has been successfully reset!!!', OK)
else:
print(f"File '{file_name}' does not exist.")
except Exception as e:
print(f"An error occurred: {e}")
2 changes: 1 addition & 1 deletion wiki/ResetEsetVPN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Reset ESET VPN [Windows only]
# Reset ESET VPN

---

Expand Down