2 Machines:
- Local:
nc
- Remote:
nc
andgo
On local you have your toto.go
. You want to compile it w/o installing go
(You are lazy or you don't want to install go for stealth/quickness reasons or whatever)
On Remote machine:
nc -l -p 1234 > dummy.go && go build -o dummy dummy.go && nc -w 3 [LOCAL_MACHINE_IP] 4444 < dummy
On Local machine:
nc -w 3 [REMOTE_MACHINE_IP] 1234 < ./toto.go && nc -l -p 4444 > toto
wait for compilation demands: nc -l -p 1234 > dummy.go && go build -o dummy dummy.go && nc -w 3 [LOCAL_MACHINE_IP] 4444 < dummy
1.Source this shell script:
#!/bin/bash
remotego(){
FILENAME=$(echo $2 |cut -d "." -f -1)
if [ "$1" == "build" ]; then
nc -w 3 $REMOTE 1234 < $2 && nc -l -p 4444 > $FILENAME && chmod +x $FILENAME
fi
if [ "$1" == "run" ]; then
nc -w 3 $REMOTE 1234 < $2 && nc -l -p 4444 > $FILENAME && chmod +x $FILENAME && ./$FILENAME && rm $FILENAME
fi
}
- Configure
$REMOTE
envar:export $REMOTE=[REMOTE_MACHINE_IP]
- Play with:
remotego build toto.go
or evenremotego run toto.go
Limits: run is not avaiblable + binary filename will be "dummy" (don't succeed to use xargs
to exec a binary and rename my binary file)
On both machine: tar
,compress
,uncompress
nc -l -p 1234| uncompress -c | tar xvfp - |xargs go build -o dummy && tar cfp - dummy | compress -c | nc -w 3 [LOCAL_MACHINE_IP] 4444
#!/bin/bash
remotego(){
FILENAME=$(echo $2 |cut -d "." -f -1)
if [ "$1" == "build" ]; then
tar cfp - $2 | compress -c | nc -w 3 $REMOTE 1234 && nc -l -p 4444| uncompress -c | tar xvfp -
fi
}