.
This commit is contained in:
parent
74b626cd9d
commit
cf81c9a442
|
@ -56,7 +56,7 @@ func (s *SocketHeahthCrawler) CheckHeahth(params map[string]interface{}) (bool,
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
|
|
||||||
if s.m.IsPrePacket() == true {
|
if s.m.IsPrePacket() == true {
|
||||||
bytes := make([]byte, 1024)
|
bytes := make([]byte, 1024)
|
||||||
n, _ := conn.Read(bytes)
|
n, _ := conn.Read(bytes)
|
||||||
|
@ -64,42 +64,42 @@ func (s *SocketHeahthCrawler) CheckHeahth(params map[string]interface{}) (bool,
|
||||||
if s.m.Match(0, p, nil) == false {
|
if s.m.Match(0, p, nil) == false {
|
||||||
return false, nil
|
return false, nil
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for i := 1 ; i < s.m.PacketCount(); i++ {
|
for i := 1; i < s.m.PacketCount(); i++ {
|
||||||
pack := s.m.Packet(i)
|
pack := s.m.Packet(i)
|
||||||
conn.Write(pack.Buffer)
|
conn.Write(pack.Buffer)
|
||||||
bytes := make([]byte, 1024)
|
bytes := make([]byte, 1024)
|
||||||
n, _ := conn.Read(bytes)
|
n, _ := conn.Read(bytes)
|
||||||
|
|
||||||
if s.m.IsNoResponse(i) == true { // empty last response
|
if s.m.IsNoResponse(i) == true { // empty last response
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
p := packet.NewPacket(bytes, n)
|
p := packet.NewPacket(bytes, n)
|
||||||
if s.m.Match(i, p, nil) == false {
|
if s.m.Match(i, p, nil) == false {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for i := 0 ; i < s.m.PacketCount(); i++ {
|
for i := 0; i < s.m.PacketCount(); i++ {
|
||||||
pack := s.m.Packet(i)
|
pack := s.m.Packet(i)
|
||||||
conn.Write(pack.Buffer)
|
conn.Write(pack.Buffer)
|
||||||
bytes := make([]byte, 1024)
|
bytes := make([]byte, 1024)
|
||||||
n, _ := conn.Read(bytes)
|
n, _ := conn.Read(bytes)
|
||||||
|
|
||||||
if s.m.IsNoResponse(i) == true { // empty last response
|
if s.m.IsNoResponse(i) == true { // empty last response
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
p := packet.NewPacket(bytes, n)
|
p := packet.NewPacket(bytes, n)
|
||||||
if s.m.Match(i, p, nil) == false {
|
if s.m.Match(i, p, nil) == false {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user