package oracle


import (

	"git.loafle.net/overflow/overflow_probe/matcher/packet"


	"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, packet.NewPacket(bytes, read), nil)

		if b {
			t.Log("Good")
		}

	}



}
