2018-08-13 07:48:32 +00:00
|
|
|
package oracle
|
|
|
|
|
|
|
|
import (
|
2018-08-15 07:17:18 +00:00
|
|
|
osm "git.loafle.net/overflow/service_matcher-go"
|
2018-08-13 07:48:32 +00:00
|
|
|
|
|
|
|
"net"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestOracle(t *testing.T) {
|
|
|
|
|
|
|
|
lm := NewOracleMatcher()
|
|
|
|
|
|
|
|
//port := types.NewPort("1521", types.NewHost("192.168.1.30"), types.TYPE_TCP)
|
|
|
|
//scanInfo := scaninfo.NewServiceScanInfo(port)
|
|
|
|
//var ipport string
|
|
|
|
//ipport = port.Host.Ip + ":" + string(port.Port)
|
|
|
|
|
|
|
|
client, _ := net.Dial("tcp", "192.168.1.15:1521")
|
|
|
|
|
|
|
|
defer client.Close()
|
|
|
|
|
|
|
|
t.Log(lm.PacketCount())
|
|
|
|
|
|
|
|
for ii := 0; ii < lm.PacketCount(); ii++ {
|
|
|
|
|
|
|
|
pack := lm.Packet(ii)
|
|
|
|
|
|
|
|
t.Log(pack)
|
|
|
|
|
|
|
|
client.Write(pack.Buffer)
|
|
|
|
|
|
|
|
bytes := make([]byte, 1024)
|
|
|
|
|
|
|
|
read, _ := client.Read(bytes)
|
|
|
|
|
|
|
|
t.Log(bytes)
|
|
|
|
|
2018-08-15 07:17:18 +00:00
|
|
|
b := lm.Match(ii, osm.NewPacket(bytes, read), nil)
|
2018-08-13 07:48:32 +00:00
|
|
|
|
|
|
|
if b {
|
|
|
|
t.Log("Good")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|