我试图写有golang一个TCP SYN端口扫描,我发现在C版这里的解决方案:http://www.binarytides.com/tcp-syn-portscan-in-c-with-linux-sockets/如何使用golang进行tcp syn端口扫描?

我想实现它去,我怎么能发送TCP报头像这在golang:

//TCP Header 
    tcph->source = htons (source_port); 
    tcph->dest = htons (80); 
    tcph->seq = htonl(1105024978); 
    tcph->ack_seq = 0; 
    tcph->doff = sizeof(struct tcphdr)/4;  //Size of tcp header 
    tcph->fin=0; 
    tcph->syn=1; 
    tcph->rst=0; 
    tcph->psh=0; 
    tcph->ack=0; 
    tcph->urg=0; 
    tcph->window = htons (14600); // maximum allowed window size 
    tcph->check = 0; //if you set a checksum to zero, your kernel's IP stack should fill in the correct checksum during transmission 
    tcph->urg_ptr = 0; 

我必须使用系统调用或cgo吗?如果有人能帮助我,我真的很感激。

2013-11-15 Billy Shea