2017-08-03 10:08:34 +00:00
|
|
|
package rmi
|
|
|
|
|
|
|
|
//import (
|
|
|
|
// "fmt"
|
2017-08-04 02:32:31 +00:00
|
|
|
// "git.loafle.net/overflow/overflow_probe/collector/core/scan/service/matcher/packet"
|
|
|
|
// "git.loafle.net/overflow/overflow_probe/collector/discovery/types"
|
2017-08-03 10:08:34 +00:00
|
|
|
// "net"
|
|
|
|
// "testing"
|
|
|
|
//)
|
|
|
|
//
|
|
|
|
//func TestNew(t *testing.T) {
|
|
|
|
// r := NewRMIMatcher()
|
|
|
|
// fmt.Println("TestNew: ", r)
|
|
|
|
//}
|
|
|
|
//func TestRMIMatcher_Match(t *testing.T) {
|
|
|
|
//
|
|
|
|
// fmt.Println("Match")
|
|
|
|
//
|
|
|
|
// hm := NewRMIMatcher()
|
|
|
|
//
|
|
|
|
// port := types.NewPort("9840", types.NewHost("192.168.1.101"), types.TYPE_TCP)
|
|
|
|
//
|
|
|
|
// var ipport string
|
|
|
|
// ipport = port.Host.Ip + ":" + string(port.Port)
|
|
|
|
//
|
|
|
|
// //fmt.Println(ipport)
|
|
|
|
//
|
|
|
|
// client, _ := net.Dial("tcp", ipport)
|
|
|
|
//
|
|
|
|
// defer client.Close()
|
|
|
|
//
|
|
|
|
// pack := hm.Packet(0)
|
|
|
|
//
|
|
|
|
// fmt.Println(pack.Buffer)
|
|
|
|
//
|
|
|
|
// //writer.WriteString(pack)
|
|
|
|
// client.Write(pack.Buffer)
|
|
|
|
//
|
|
|
|
// bytes := make([]byte, 512)
|
|
|
|
//
|
|
|
|
// l, _ := client.Read(bytes)
|
|
|
|
//
|
|
|
|
// //fmt.Println(bytes)
|
|
|
|
//
|
|
|
|
// t1 := hm.Match(0, packet.NewPacket(bytes, l), nil)
|
|
|
|
//
|
|
|
|
// fmt.Println(t1)
|
|
|
|
//}
|