ing
This commit is contained in:
parent
40b3282f38
commit
d14425f824
|
@ -3,6 +3,7 @@ package ftp
|
|||
import (
|
||||
"crypto/tls"
|
||||
"net"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -10,17 +11,19 @@ import (
|
|||
)
|
||||
|
||||
func TestFTP(t *testing.T) {
|
||||
ip := "192.168.100.21"
|
||||
port := 2121
|
||||
|
||||
m := NewMatcher()
|
||||
|
||||
conn, err := net.Dial("tcp", "192.168.1.229:21")
|
||||
conn, err := net.Dial("tcp", net.JoinHostPort(ip, strconv.Itoa(port)))
|
||||
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
matchCtx := osm.NewMatchCtx("192.168.1.229", 21)
|
||||
matchCtx := osm.NewMatchCtx(ip, port)
|
||||
|
||||
for i := 0; i < m.PacketCount(matchCtx); i++ {
|
||||
_, err := conn.Write(m.Packet(matchCtx, i).Buffer)
|
||||
|
@ -41,6 +44,8 @@ func TestFTP(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestFTPS(t *testing.T) {
|
||||
ip := "192.168.100.21"
|
||||
port := 2121
|
||||
|
||||
m := NewMatcher()
|
||||
|
||||
|
@ -51,10 +56,10 @@ func TestFTPS(t *testing.T) {
|
|||
conn, err := tls.DialWithDialer(
|
||||
dialer,
|
||||
"tcp",
|
||||
"192.168.1.201:990",
|
||||
net.JoinHostPort(ip, strconv.Itoa(port)),
|
||||
&tls.Config{
|
||||
InsecureSkipVerify: true,
|
||||
ServerName: "192.168.1.201",
|
||||
ServerName: ip,
|
||||
},
|
||||
)
|
||||
|
||||
|
@ -63,7 +68,7 @@ func TestFTPS(t *testing.T) {
|
|||
}
|
||||
defer conn.Close()
|
||||
|
||||
matchCtx := osm.NewMatchCtx("192.168.1.201", 990)
|
||||
matchCtx := osm.NewMatchCtx(ip, port)
|
||||
|
||||
for i := 0; i < m.PacketCount(matchCtx); i++ {
|
||||
_, err := conn.Write(m.Packet(matchCtx, i).Buffer)
|
||||
|
|
Loading…
Reference in New Issue
Block a user