mirror of
https://github.com/indetectables-net/toolkit.git
synced 2025-07-12 17:33:22 +00:00
Changes in Installer generator code
This commit is contained in:
parent
25d6597fb7
commit
e07b388098
@ -9,6 +9,7 @@ import argparse
|
||||
import pathlib
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import py7zr
|
||||
import pefile
|
||||
import colorama
|
||||
@ -66,6 +67,9 @@ class GenerateInstall:
|
||||
'de4dot': ['de4dot.exe', 'de4dot-x64.exe'],
|
||||
'netunpack': ['netunpack.exe', 'netunpack-64.exe'],
|
||||
}
|
||||
self.fix_tool_exe_link_creation = [
|
||||
'api monitor', 'scylla', 'netunpack', 'qunpack',
|
||||
]
|
||||
self.compact_tool_list = [
|
||||
# analysis
|
||||
'die', 'exeinfope', 'pestudio',
|
||||
@ -231,7 +235,11 @@ class GenerateInstall:
|
||||
iss_components = f'{component_name(self.section_name)}\\{component_name(self.tool_name)}'
|
||||
iss_parameters = f'Parameters: "/K ""{iss_filename}""";' if pe_data['is_cli'] else ''
|
||||
iss_icon = f'IconFilename: "{iss_filename}";' if pe_data['is_cli'] else ''
|
||||
iss_check = 'Check: Is64BitInstallMode;' if pe_data['is_x64'] else ''
|
||||
iss_check = 'Check: Is64BitInstallMode;' if pe_data['is_x64'] else 'Check: not Is64BitInstallMode;'
|
||||
|
||||
if self.tool_name.lower() in self.fix_tool_exe_link_creation:
|
||||
print(colorama.Fore.MAGENTA + f' [!] force link creation')
|
||||
iss_check = 'Check: Is64BitInstallMode;' if pe_data['is_x64'] else ''
|
||||
|
||||
if pe_data['is_x64']:
|
||||
print(colorama.Fore.MAGENTA + f' [!] x64 exe')
|
||||
@ -315,6 +323,10 @@ class GenerateInstall:
|
||||
print(colorama.Fore.YELLOW + f'[+] Generate cli register code')
|
||||
|
||||
lines_list = []
|
||||
lines_list.append('{')
|
||||
lines_list.append(';;;;; AUTOGENERATED!')
|
||||
lines_list.append(';;;;;;;;;;;;;;;;;;;;;;;;;')
|
||||
lines_list.append('}')
|
||||
|
||||
# install hook
|
||||
lines_list.append('procedure CurStepChanged(CurStep: TSetupStep);')
|
||||
@ -343,6 +355,7 @@ class GenerateInstall:
|
||||
lines_list.append('')
|
||||
|
||||
# save
|
||||
shutil.copy('sections\\cli.iss.base', 'sections\\cli.iss')
|
||||
with open('sections\\cli.iss', 'a') as file:
|
||||
file.writelines('\n'.join(lines_list))
|
||||
|
||||
|
47
bin/installer/sections/cli.iss.base
Normal file
47
bin/installer/sections/cli.iss.base
Normal file
@ -0,0 +1,47 @@
|
||||
[Code]
|
||||
procedure EnvAddPath(Path: string);
|
||||
var
|
||||
Paths: string;
|
||||
begin
|
||||
{ Retrieve current path (use empty string if entry not exists) }
|
||||
if not RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths) then
|
||||
Paths := '';
|
||||
|
||||
{ Skip if string already found in path }
|
||||
if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then
|
||||
exit;
|
||||
|
||||
{ App string to the end of the path variable }
|
||||
Paths := Paths + ';'+ Path //+';'
|
||||
|
||||
{ Overwrite (or create if missing) path environment variable }
|
||||
if RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths) then
|
||||
Log(Format('The [%s] added to PATH: [%s]', [Path, Paths]))
|
||||
else
|
||||
Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths]));
|
||||
end;
|
||||
|
||||
procedure EnvRemovePath(Path: string);
|
||||
var
|
||||
Paths: string;
|
||||
P: Integer;
|
||||
begin
|
||||
{ Skip if registry entry not exists }
|
||||
if not RegQueryStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths) then
|
||||
exit;
|
||||
|
||||
{ Skip if string not found in path }
|
||||
P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
|
||||
if P = 0 then
|
||||
exit;
|
||||
|
||||
{ Update path variable }
|
||||
Delete(Paths, P - 1, Length(Path) + 1);
|
||||
|
||||
{ Overwrite path environment variable }
|
||||
if RegWriteStringValue(HKEY_CURRENT_USER, 'Environment', 'Path', Paths) then
|
||||
Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths]))
|
||||
else
|
||||
Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths]));
|
||||
end;
|
||||
|
Loading…
x
Reference in New Issue
Block a user