This commit is contained in:
crusader 2018-09-28 13:53:46 +09:00
parent 23ee90a233
commit ece34034bc
3 changed files with 8 additions and 3 deletions

View File

@ -24,5 +24,5 @@ if [ -z "${o_arch}" ]; then
exit 0
fi
rm ./dist
GOOS=${o_os} GOARCH=${o_arch} CGO_ENABLED=1 go build -a --installsuffix cgo --ldflags="-s" -o ./dist/probe ./cmd/main.go
rm -R ./dist
GOOS=${o_os} GOARCH=${o_arch} CGO_ENABLED=1 go build -a --installsuffix cgo --ldflags="-s" -o ./dist/probe-${o_os}-${o_arch} ./cmd/main.go

View File

@ -128,6 +128,10 @@ func handlePacketTCP(ps *pCapScan, packet gopacket.Packet) {
layer := packet.Layer(layers.LayerTypeTCP)
tcp, _ := layer.(*layers.TCP)
if !tcp.SYN || !tcp.ACK {
return
}
ps.tcpListenerChanMtx.RLock()
defer func() {
ps.tcpListenerChanMtx.RUnlock()

View File

@ -80,7 +80,8 @@ func (ps *pCapScan) Start() error {
}
// set filter
// todo add tcp, udp filter
if err = h.SetBPFFilter("arp or icmp or icmp6 and src net " + ps.zone.Network + " or (((tcp[tcpflags] & (tcp-syn|tcp-ack) != 0) or (tcp[tcpflags] & (tcp-rst) != 0)) and port 60000) or udp "); nil != err {
// if err = h.SetBPFFilter("arp or icmp or icmp6 and src net " + ps.zone.Network + " or (((tcp[tcpflags] & (tcp-syn|tcp-ack) != 0) or (tcp[tcpflags] & (tcp-rst) != 0)) and port 60000) or udp "); nil != err {
if err = h.SetBPFFilter("(arp or icmp or icmp6 or (((tcp[tcpflags] & (tcp-syn|tcp-ack) != 0) or (tcp[tcpflags] & (tcp-rst) != 0)) and port 60000) or udp) and src net " + ps.zone.Network); nil != err {
// if err = h.SetBPFFilter("arp or icmp or icmp6 or tcp or udp"); nil != err {
h.Close()
return err