2
我試圖寫有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嗎?如果有人能幫助我,我真的很感激。