ing
This commit is contained in:
parent
23ee90a233
commit
ece34034bc
4
build.sh
4
build.sh
|
@ -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
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user