rzc0d3r/ESET-KeyGen

Make the software installable

Closed this issue · 45 comments

I was wondering if there could be a way to make this software installable. Then we could just run a command, say esetkeygen in command prompt and the software opens!

And the updater could update the software as well

Btw developermail seems to be broken:

ESET KeyGen v1.5.2.7 by rzc0d3r

-- Browsers Initializer --

[  INFO  ] Initializing Google Chrome for Linux

-- KeyGen --

[  INFO  ] [developermail] Mail registration...
[ FAILED ] Mail registration was not completed, try using a different Email API!

I see we can add software to %localappdata%\Microsoft\WindowsApps and rename it as esetkeygen

Now the updater has to somehow install it there

We probably could make the updater check for %localappdata%\Microsoft\WindowsApps\esetkeygen, and if it exists, make it update that.

Ok so this is the plan I have in mind:

  1. Add a --install argument that puts the binary as %localappdata%\Microsoft\WindowsApps\esetkeygen
  2. The --update when run, will first check presence of %localappdata%\Microsoft\WindowsApps\esetkeygen. If present, it will update the binary there, else will follow the older way.

On macOS , the path becomes /usr/local/bin/esetkeygen. You will need root access on macOS for this, also the updater should make the new binary executable (chmod a+x)

I'm not very good at python, so will need your help

Итак, вот какой план у меня в голове:

  1. Добавьте аргумент --install, который помещает двоичный файл как%localappdata%\Microsoft\WindowsApps\esetkeygen
  2. При запуске --update сначала проверит наличие %localappdata%\Microsoft\WindowsApps\esetkeygen. Если он присутствует, он обновит двоичный файл там, в противном случае будет следовать старому способу.

На macOS путь становится /usr/local/bin/esetkeygen. Для этого вам понадобится root-доступ на macOS, также программа обновления должна сделать новый исполняемый файл (chmod a+x)

During the upgrade, a copy of the executable will be created and control will be transferred to it, since you cannot overwrite files while the main executable is running.

This is necessary in case the .exe from the installation folder is launched

Итак, вот какой план у меня в голове:

  1. Добавьте аргумент --install, который помещает двоичный файл как%localappdata%\Microsoft\WindowsApps\esetkeygen
  2. При запуске --update сначала проверит наличие %localappdata%\Microsoft\WindowsApps\esetkeygen. Если он присутствует, он обновит двоичный файл там, в противном случае будет следовать старому способу.

На macOS путь становится /usr/local/bin/esetkeygen. Для этого вам понадобится root-доступ на macOS, также программа обновления должна сделать новый исполняемый файл (chmod a+x)

During the upgrade, a copy of the executable will be created and control will be transferred to it, since you cannot overwrite files while the main executable is running.

I guess you can invoke a power shell command to replace the old exe with new one. Anyways, I just had an idea and thought the software would be very convenient like this.

We can do this as well.

Create a separate exe named updater, it can simply update the software.

Also, the need for checks whether esetkeygen.exe is there or not gets eliminated

So whenever software checks for update, it can instruct the user to use the updater app if they have it installed.

And if user uses the --install argument, the keygen and updater shall be simultaneously installed

Then the updater will be a separate file and will weigh quite a lot

And then it is better to release builds in the form of Zip files, which will contain both the keygen and the updater itself

And who will update the updater)

Well seems more complex than I thought 😅

I'll close this

It can be done as I wrote earlier, just via control transfer

We'll hold off on that for now.

We'll hold off on that for now.

I thought it was impossible. You can reopen this if you wanna work on this I guess.

We'll hold off on that for now.

I thought it was impossible. You can reopen this if you wanna work on this I guess.

image

The beginning has been made

I've never messed around with this kind of code before, but now can pass absolutely all arguments to the updater

image

image

image


image

Nice!

@echo off

:: Fetch the latest release page
curl -sL https://github.com/rzc0d3r/ESET-KeyGen/releases/latest > temp.html

:: Extract the line containing the release title
for /f "tokens=*" %%i in ('findstr /c:"<title>Release" temp.html') do set "var1=%%i"

:: Extract the version number from the line
for /f "tokens=2 delims= " %%i in ("%var1%") do set "version=%%i"

:: Display the version number
echo Latest Release Version: %version%

:: Clean up the temporary file
del temp.html

This batch script can fetch the latest version of the software from your repo. We can use this as an updater by using curl to download the software.

I've finally made a small but useful batch script that downloads the latest version:

@echo off

echo.
echo ESET Keygen Updater by AdityaGarg8
echo.
echo Press Enter to update ESET Keygen
pause >nul

:: Check if system is 32bit or 64bit

if "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
    set "arch=64"
) else if "%PROCESSOR_ARCHITECTURE%" == "x86" (
    set "arch=32"
)

:: Fetch the latest release page
curl -sL https://github.com/rzc0d3r/ESET-KeyGen/releases/latest > %temp%\eset.html

:: Extract the line containing the release title
for /f "tokens=*" %%i in ('findstr /c:"<title>Release" %temp%\eset.html') do set "var1=%%i"

:: Extract the version number from the line
for /f "tokens=2 delims= " %%i in ("%var1%") do set "version=%%i"

:: Display the version number
echo.
echo Latest Release Version: %version%
echo.
echo Updating ESET Keygen
echo.
curl -#L https://github.com/rzc0d3r/ESET-KeyGen/releases/download/%version%/ESET-KeyGen_%version%_win%arch%.exe > %localappdata%\Microsoft\WindowsApps\esetkeygen.exe
echo.
echo Press enter to exit...

:: Clean up the temporary file
del %temp%\eset.html

Save it with .bat as file extension and see it work!

Also, I guess something like this should be able to run the batch script from the keygen:

import subprocess
import os
import sys

# Path to your batch script
batch_script = r"%localappdata%\Microsoft\WindowsApps\updateeset.bat"

# Start the batch script
subprocess.Popen(batch_script, shell=True, env=os.environ)

# Terminate the Python program
sys.exit()

It immediately terminates the software after batch script is executed.

As long as you don't change the versioning system and name of the binaries, the batch script will work just fine. Although, in other cases changes won't be difficult as well.

This updater can also be used as an installer as well since it just downloads and puts the software at its place.

We will need to add a config file containing all the startup arguments so that a person can customize it to their liking, rather than having to change the settings each time

For this file you need to locate it in the file system, on windows this is easy to do as my install algorithm moves everything to a folder and everything can be stored there. But on macOS it's more complicated, I need to select a folder for it

We will need to add a config file containing all the startup arguments so that a person can customize it to their liking, rather than having to change the settings each time

Tbh I don't really find adding a config file useful. After all, most people just need to generate keys. Although, you can add a "Do you want to update" prompt instead of asking the user to run again using --update

For this file you need to locate it in the file system, on windows this is easy to do as my install algorithm moves everything to a folder and everything can be stored there. But on macOS it's more complicated, I need to select a folder for it

You can make a $HOME/.esetconfig file as a config.

But again, I don't think a config is actually needed, since it's something like, "oh my antivirus expired, let me quickly get a key for the next 30 days" and forget this even existed.

But again, I don't think a config is actually needed, since it's something like, "oh my antivirus expired, let me quickly get a key for the next 30 days" and forget this even existed.

People wrote to me in chat that they were tired of changing the settings every time :)

I've tried to make everything convenient by creating a menu.

But again, I don't think a config is actually needed, since it's something like, "oh my antivirus expired, let me quickly get a key for the next 30 days" and forget this even existed.

People wrote to me in chat that they were tired of changing the settings every time :)

Oh, I see. Such configs I guess will make sense in installation cases then.

We will need to add a config file containing all the startup arguments so that a person can customize it to their liking, rather than having to change the settings each time

Tbh I don't really find adding a config file useful. After all, most people just need to generate keys. Although, you can add a "Do you want to update" prompt instead of asking the user to run again using --update

Then it can be made the default, you can also use --skip-update-check to skip it.

For this file you need to locate it in the file system, on windows this is easy to do as my install algorithm moves everything to a folder and everything can be stored there. But on macOS it's more complicated, I need to select a folder for it

For configs, you can also use $HOME/Library/Application Support/ESET Keygen

For this file you need to locate it in the file system, on windows this is easy to do as my install algorithm moves everything to a folder and everything can be stored there. But on macOS it's more complicated, I need to select a folder for it

For configs, you can also use $HOME/Library/Application Support/ESET Keygen

replace ESET Keygen with the name of the folder you want.

If you are planning to use the batch script I made for updates, I can add the option for downloading the config as well to them. Also, I haven’t tested the hack of terminating the program after invoking the updater yet since I don't know how to integrate this into your code.

Why don't we go to Telegram? I don't feel comfortable writing a lot of text here..

Ok 😅

I messaged you in your personal telegram as mentioned in the readme