Skip to content

Commit

Permalink
feature: support DLL agent stub (amd64 only)
Browse files Browse the repository at this point in the history
you will need to build the DLL yourself
  • Loading branch information
jm33-m0 committed Jan 24, 2024
1 parent f100936 commit eda0e94
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/lib/cc/buildAgent.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ var Arch_List = []string{
"riscv64",
}

// a wrapper for CmdFuncs
func genAgentWrapper() {
CliPrint("Generated agent binary: %s."+
"You can `use stager` to generate a one liner for your target host", GenAgent())
Expand All @@ -39,9 +38,10 @@ func GenAgent() (agent_binary_path string) {
)
now := time.Now()
stubFile := fmt.Sprintf("%s-%s", emp3r0r_data.Stub_Linux, arch_choice)
os_choice := CliAsk("Generate agent for (1) Linux, (2) Windows: ", false)
os_choice := CliAsk("Generate agent for (1) Linux, (2) Windows (3) Windows DLL: ", false)
is_win := os_choice == "2"
is_linux := os_choice == "1"
is_dll := os_choice == "3"
if is_linux {
CliPrintInfo("You chose Linux")
for n, arch := range Arch_List {
Expand Down Expand Up @@ -69,7 +69,15 @@ func GenAgent() (agent_binary_path string) {
EmpWorkSpace, arch_choice,
now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second())
}
if is_dll {
CliPrintInfo("You chose Windows DLL")
stubFile = fmt.Sprintf("%s-%s", emp3r0r_data.Stub_Windows_DLL, arch_choice)
outfile = fmt.Sprintf("%s/agent_windows_%s_%d-%d-%d_%d-%d-%d.dll",
EmpWorkSpace, arch_choice,
now.Year(), now.Month(), now.Day(), now.Hour(), now.Minute(), now.Second())
}

// is this stub file available?
if !util.IsExist(stubFile) {
CliPrintError("%s not found, build it first", stubFile)
return
Expand Down
1 change: 1 addition & 0 deletions core/lib/cc/cc.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ func InitConfig() (err error) {
// binaries
emp3r0r_data.Stub_Linux = EmpWorkSpace + "/stub"
emp3r0r_data.Stub_Windows = EmpWorkSpace + "/stub-win"
emp3r0r_data.Stub_Windows_DLL = EmpWorkSpace + "/stub-win-dll"

// copy stub binaries to ~/.emp3r0r
for _, arch := range Arch_List {
Expand Down
1 change: 1 addition & 0 deletions core/lib/data/def.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ var (
// to be updated by DirSetup
Stub_Linux = ""
Stub_Windows = ""
Stub_Windows_DLL = ""
Packer_Stub = ""
Packer_Stub_Windows = ""
)
Expand Down

0 comments on commit eda0e94

Please sign in to comment.