network_service_matcher/wmi/wmi_test.go

50 lines
796 B
Go
Raw Normal View History

2017-12-04 07:27:08 +00:00
package wmi
import (
"fmt"
"net"
"testing"
2017-12-04 08:16:03 +00:00
cnsm "git.loafle.net/commons_go/network_service_matcher"
2017-12-04 07:27:08 +00:00
)
func TestWMI(t *testing.T) {
lm := NewMatcher()
//port := types.NewPort("135", types.NewHost("192.168.1.1"), types.TYPE_TCP)
//scanInfo := scaninfo.NewServiceScanInfo(port)
//var ipport string
//ipport = port.Host.Ip + ":" + string(port.Port)
//fmt.Println(ipport)
client, _ := net.Dial("tcp", "192.168.1.106:135")
defer client.Close()
fmt.Println(lm.PacketCount())
for ii := 0; ii < lm.PacketCount(); ii++ {
pack := lm.Packet(ii)
fmt.Println(pack)
client.Write(pack.Buffer)
bytes := make([]byte, 1024)
read, _ := client.Read(bytes)
//fmt.Println(bytes)
b := lm.Match(nil, ii, cnsm.NewPacket(bytes, read))
if b {
fmt.Println("Good")
}
}
}