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
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm ./dist
|
rm -R ./dist
|
||||||
GOOS=${o_os} GOARCH=${o_arch} CGO_ENABLED=1 go build -a --installsuffix cgo --ldflags="-s" -o ./dist/probe ./cmd/main.go
|
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)
|
layer := packet.Layer(layers.LayerTypeTCP)
|
||||||
tcp, _ := layer.(*layers.TCP)
|
tcp, _ := layer.(*layers.TCP)
|
||||||
|
|
||||||
|
if !tcp.SYN || !tcp.ACK {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ps.tcpListenerChanMtx.RLock()
|
ps.tcpListenerChanMtx.RLock()
|
||||||
defer func() {
|
defer func() {
|
||||||
ps.tcpListenerChanMtx.RUnlock()
|
ps.tcpListenerChanMtx.RUnlock()
|
||||||
|
|
|
@ -80,7 +80,8 @@ func (ps *pCapScan) Start() error {
|
||||||
}
|
}
|
||||||
// set filter
|
// set filter
|
||||||
// todo add tcp, udp 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 {
|
// if err = h.SetBPFFilter("arp or icmp or icmp6 or tcp or udp"); nil != err {
|
||||||
h.Close()
|
h.Close()
|
||||||
return err
|
return err
|
||||||
|
|
Loading…
Reference in New Issue
Block a user