- 論壇徽章:
- 1
|
自己解決吧
提示一下:
1.tcpdump是用什么方法抓包的? tcpdump可以看到源,目的端口,數(shù)據(jù)包長度, 這是應(yīng)用層的辦法(pcap編程)
2.這些數(shù)據(jù)網(wǎng)卡驅(qū)動肯定知道, 那么在內(nèi)核里面用鉤子函數(shù)(hook)也可以搞到, 這是內(nèi)核模塊的辦法(最著名的鉤子函數(shù)是netfilter,它有個(gè)外殼程序叫做iptable)
3.思科交換機(jī)的netflow(硬件方法)
最簡單的也是最傻的方法:
cat /proc/net/dev
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 966352 894 0 0 0 0 0 0 966352 894 0 0 0 0 0 0
eth0: 1592167 1766 0 0 0 0 0 0 371755 2171 0 0 0 0 0 0
sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
|