1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-22 13:19:02 +08:00
This commit is contained in:
zu1k 2020-07-30 07:23:52 +08:00
parent 993783053b
commit efd48b4e9d

View File

@ -116,12 +116,12 @@ func (db *QQwry) searchIndex(ip uint32) uint32 {
buf := make([]byte, 7)
mid := uint32(0)
_ip := uint32(0)
ipUint := uint32(0)
for {
mid = common.GetMiddleOffset(start, end, 7)
buf = db.ReadData(7, mid)
_ip = binary.LittleEndian.Uint32(buf[:4])
ipUint = binary.LittleEndian.Uint32(buf[:4])
if end-start == 7 {
offset := common.ByteToUInt32(buf[4:])
@ -132,12 +132,11 @@ func (db *QQwry) searchIndex(ip uint32) uint32 {
return 0
}
// 找到的比较大,向前移
if _ip > ip {
if ipUint > ip {
end = mid
} else if _ip < ip { // 找到的比较小,向后移
} else if ipUint < ip {
start = mid
} else if _ip == ip {
} else if ipUint == ip {
return common.ByteToUInt32(buf[4:])
}
}