network_service_matcher/oracle/oracle_test.go

48 lines
754 B
Go
Raw Normal View History

2017-12-04 07:27:08 +00:00
package oracle
import (
cnsm "git.loafle.net/commons_go/network_service_matcher"
"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)
b := lm.Match(ii, cnsm.NewPacket(bytes, read), nil)
if b {
t.Log("Good")
}
}
}