+fancy banner & backslash bug fix & better instruction

This commit is contained in:
Print3M
2025-08-18 15:51:36 +02:00
parent 4e49a4e579
commit aa8e2d857a
9 changed files with 57 additions and 27 deletions
+1 -1
View File
@@ -3,4 +3,4 @@ project/
*.lib
*.def
*.cpp
.vscode/
./.vscode
+2 -12
View File
@@ -1,16 +1,6 @@
{
"files.associations": {
"algorithm": "cpp",
"*.template": "c",
"cstdarg": "cpp",
"typeinfo": "c",
"functional": "cpp",
"array": "c",
"deque": "c",
"string": "c",
"unordered_map": "c",
"vector": "c",
"string_view": "c",
"initializer_list": "c"
"*.cpp.template": "cpp",
"*.sh.template": "shellscript",
}
}
+28 -1
View File
@@ -77,10 +77,37 @@ func ParseCli() *CliFlags {
}
if flags.Static && !IsValidDllName(flags.OriginalPath) {
fmt.Fprintf(os.Stderr, "[!] Invalid parameter value:\n")
fmt.Fprintf(os.Stderr, "[!] Invalid '-x' parameter value:\n")
fmt.Fprintf(os.Stderr, "In case of static linking enabled '-x' parameter must be valid Windows DLL file name with no path information. E.g. kernel32.dll, user32.dll.")
os.Exit(1)
}
return &flags
}
func PrintBanner() {
banner := `
▓█████▄ ██▓ ██▓
▒██▀ ██▌▓██▒ ▓██▒ By @Print3M
░██ █▌▒██░ ▒██░ (print3m.github.io/)
░▓█▄ ▌▒██░ ▒██░
░▒████▓ ░██████▒░██████▒ Documentation:
▒▒▓ ▒ ░ ▒░▓ ░░ ▒░▓ ░ github.com/Print3M/DllShimmer
░ ▒ ▒ ░ ░ ▒ ░░ ░ ▒ ░
░ ░ ░ ░ ░ ░ ░ 2025
░ ░ ░ ░ ░
░
██████ ██░ ██ ██▓ ███▄ ▄███▓ ███▄ ▄███▓▓█████ ██▀███
▒██ ▒ ▓██░ ██▒▓██▒▓██▒▀█▀ ██▒▓██▒▀█▀ ██▒▓█ ▀ ▓██ ▒ ██▒
░ ▓██▄ ▒██▀▀██░▒██▒▓██ ▓██░▓██ ▓██░▒███ ▓██ ░▄█ ▒
▒ ██▒░▓█ ░██ ░██░▒██ ▒██ ▒██ ▒██ ▒▓█ ▄ ▒██▀▀█▄
▒██████▒▒░▓█▒░██▓░██░▒██▒ ░██▒▒██▒ ░██▒░▒████▒░██▓ ▒██▒
▒ ▒▓▒ ▒ ░ ▒ ░░▒░▒░▓ ░ ▒░ ░ ░░ ▒░ ░ ░░░ ▒░ ░░ ▒▓ ░▒▓░
░ ░▒ ░ ░ ▒ ░▒░ ░ ▒ ░░ ░ ░░ ░ ░ ░ ░ ░ ░▒ ░ ▒░
░ ░ ░ ░ ░░ ░ ▒ ░░ ░ ░ ░ ░ ░░ ░
░ ░ ░ ░ ░ ░ ░ ░ ░ ░
`
fmt.Print(banner)
fmt.Println()
}
+2 -1
View File
@@ -19,10 +19,11 @@ type Dll struct {
ExportedFunctions []ExportedFunction
}
func ParseDll(path string) *Dll {
func ParseDll(path string, originalPath string) *Dll {
var dll Dll
dll.Name = filepath.Base(path)
dll.OriginalPath = originalPath
pe, err := peparser.New(path, &peparser.Options{})
if err != nil {
+11 -6
View File
@@ -5,6 +5,7 @@ import (
"dllshimmer/dll"
"dllshimmer/output"
"embed"
"fmt"
"path/filepath"
)
@@ -14,14 +15,10 @@ var templatesFS embed.FS
func main() {
flags := cli.ParseCli()
// var params tmpl.CodeFileParams
// params.Functions = dll.ExportedFunctions
// params.OriginalPath = flags.OriginalPath
// params.DllName = filepath.Base(flags.Input)
// params.Mutex = flags.Mutex
cli.PrintBanner()
out := output.Output{
Dll: dll.ParseDll(flags.Input),
Dll: dll.ParseDll(flags.Input, flags.OriginalPath),
OutputDir: filepath.Clean(flags.Output),
TemplatesFS: &templatesFS,
}
@@ -33,4 +30,12 @@ func main() {
if flags.Static {
out.CreateLibFile()
}
fmt.Println()
fmt.Println("What to do next?")
fmt.Println()
fmt.Printf(" 1. Jump into the '%s/' directory.\n", out.OutputDir)
fmt.Printf(" 2. Add your backdoor to the '%s' file.\n", out.GetCodeFileName())
fmt.Printf(" 3. Compile project using the '%s' script.\n", out.GetCompileScriptName())
fmt.Println()
}
+1 -1
View File
@@ -72,7 +72,7 @@ func (o *Output) CreateCodeFile(mutex bool, isStaticLinked bool) {
params := CodeFileParams{
Functions: o.Dll.ExportedFunctions,
OriginalPath: o.Dll.OriginalPath,
OriginalPath: sanitizePathForInjection(o.Dll.OriginalPath),
Mutex: mutex,
DllName: o.Dll.Name,
}
+7
View File
@@ -0,0 +1,7 @@
package output
import "strings"
func sanitizePathForInjection(path string) string {
return strings.ReplaceAll(path, "\\", "\\\\")
}
+3 -3
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
#
# Generated by DllShimmer (https://github.com/Print3M/DllShimmer)
#
# Author: Print3M (https://print3m.github.io/)
# Generated by DllShimmer (github.com/Print3M/DllShimmer)
#
# Author: Print3M (print3m.github.io/)
set -ueo pipefail
+2 -2
View File
@@ -1,6 +1,6 @@
// Generated by DllShimmer (https://github.com/Print3M/DllShimmer)
// Generated by DllShimmer (github.com/Print3M/DllShimmer)
//
// Author: Print3M (https://print3m.github.io/)
// Author: Print3M (print3m.github.io/)
{{- $r := . }}
#include <windows.h>