Skip to content

Instantly share code, notes, and snippets.

@jackyyf
Created July 27, 2017 05:28
Show Gist options
  • Save jackyyf/0525cb9d4e10ec4ac4f4fa29868fc5e2 to your computer and use it in GitHub Desktop.
Save jackyyf/0525cb9d4e10ec4ac4f4fa29868fc5e2 to your computer and use it in GitHub Desktop.
Fuck you golang.
package main
import (
"reflect"
"net"
)
func main() {
addr, err := net.ResolveTCPAddr("tcp", "119.29.29.29:80")
if err != nil {
panic(err)
}
conn, err := net.DialTCP("tcp", nil, addr)
if err != nil {
panic(err)
}
// Let's go to the war zone.
// (*(*TCPConn).conn.fd).sysfd
v := reflect.ValueOf(*conn)
c := v.FieldByName("conn")
fdp := c.FieldByName("fd")
fd := reflect.Indirect(fdp)
sysfd := fd.FieldByName("sysfd")
print(sysfd.Int())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment