摘要:
太乱了,只把自己写的代码传上来:#basicserver.pyimport sockethost = ''port = 51423s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)s.bind((host,port))print "Waiting for connections ..."s.listen(5)while True: clientsock,clientaddr = s.accept() 阅读全文
摘要:
libpcap是开源库,主要完成数据包捕获功能下面是自己的测试例子:原理展示测试:#include #define BUFSIZE 1024int main(){ char error_content[PCAP_ERRBUF_SIZE]; struct pcap_pkthdr protocol_header; pcap_t *pcap_handle; struct bpf_program bpf_filter; char bpf_filter_string[] = ""; const u_char *packe... 阅读全文