a honeypot ssh server in Go

honey-ssh-pot Curious about who and how attempts ssh login to your home server ? Me too… So I wrote a very simple ssh honeypot, just to collect interesting info about the kind guys who knocks my door :) warning: this is safe, but don’t run the service (well, ANY service) as root user. Even better if you can run it as a dedicate unprivileged user. This program is only for didactic use and not intended for deployment in a production network environment. If you want to have it exposed on the public internet, you must map port 22 of your wan router to the internal server port ( 2222 by default)… Do it at your risk! ...

June 26, 2018 · Andrea Manzini

a simple PNG decoder in Go

while working with image files, I needed a simple way to analyze content of a picture; so I wrote this tool that “walks” inside a PNG file and reports all the chunks seen; this is intended to be expanded with more features in a future. package main import ( "encoding/binary" "fmt" "io" "os" ) type chunk struct { Length uint32 ChunkType [4]byte } func main() { if len(os.Args) != 2 { fmt....

January 28, 2018 · Andrea Manzini

a simple HTTP rewriting proxy

This is an example of using goproxy, a fast and robust multithread proxy engine to develop an HTTP proxy that rewrites content on the fly, with multiple search and substitutions. It can be useful for debugging and other less noble (but useful) purposes … // rewriting_proxy project main.go package main import ( "bytes" "flag" "io/ioutil" "log" "net/http" "github.com/elazarl/goproxy" ) var replacements = []struct { from []byte to []byte }{ {[]byte("#e8ecec"), []byte("Red")}, // ugly colors!...

August 12, 2016 · Andrea Manzini

monit helper for quota monitoring in go

I want to keep under control a system where each user has an amount of filesystem quota reserved; in particular I would like to get notified if and when a user exceeds some treshold. Since I already have Monit in place in the server, I took the chance to write a small Go utility in order to retrieve the quota percentage. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 // quotachecker....

March 30, 2016 · Andrea Manzini