Created
July 27, 2017 05:28
-
-
Save jackyyf/0525cb9d4e10ec4ac4f4fa29868fc5e2 to your computer and use it in GitHub Desktop.
Fuck you golang.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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