2017-12-04 07:27:08 +00:00
|
|
|
package ssh
|
|
|
|
|
|
|
|
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 TestSSHMatcher_Match(t *testing.T) {
|
|
|
|
|
|
|
|
//port := types.NewPort("22", types.NewHost("192.168.1.103"), types.TYPE_TCP)
|
|
|
|
//ssh := NewSSHMatcher()
|
|
|
|
//
|
|
|
|
//var ipport string
|
|
|
|
//ipport = port.Host.Ip + ":" + string(port.Port)
|
|
|
|
|
|
|
|
client, _ := net.Dial("tcp", "192.168.1.10:22")
|
|
|
|
|
|
|
|
defer client.Close()
|
|
|
|
|
|
|
|
bytes := make([]byte, 512)
|
|
|
|
|
|
|
|
l, _ := client.Read(bytes)
|
|
|
|
|
|
|
|
fmt.Println(bytes)
|
|
|
|
|
|
|
|
b := NewMatcher().Match(nil, 0, cnsm.NewPacket(bytes, l))
|
|
|
|
|
|
|
|
fmt.Println(b)
|
|
|
|
|
|
|
|
}
|