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