network_service_matcher/telnet/telnet_test.go

35 lines
606 B
Go
Raw Normal View History

2017-12-04 07:27:08 +00:00
package telnet
import (
"fmt"
cnsm "git.loafle.net/commons_go/network_service_matcher"
"net"
"testing"
)
func TestTelnetMatcher_Match(t *testing.T) {
//port := types.NewPort("23", types.NewHost("192.168.1.210"), types.TYPE_TCP)
//telnet := NewTelnetMatcher()
//
//var ipport string
//ipport = port.Host.Ip + ":" + string(port.Port)
client, _ := net.Dial("tcp", "192.168.1.105:23")
defer client.Close()
bytes := make([]byte, 512)
l, _ := client.Read(bytes)
fmt.Println("length :", l)
fmt.Println(bytes)
b := NewMatcher().Match(nil, 0, cnsm.NewPacket(bytes, l))
fmt.Println(b)
}