87 lines
1.5 KiB
Go
87 lines
1.5 KiB
Go
|
package pop
|
||
|
|
||
|
//
|
||
|
//import (
|
||
|
// "crypto/tls"
|
||
|
// "fmt"
|
||
|
// "loafle.com/overflow/collector/discovery/scan/matcher/packet"
|
||
|
// "loafle.com/overflow/collector/discovery/scan/matcher/scaninfo"
|
||
|
// "loafle.com/overflow/collector/discovery/types"
|
||
|
// "net"
|
||
|
// "testing"
|
||
|
//)
|
||
|
//
|
||
|
//func TestPopTLS(t *testing.T) {
|
||
|
// conn, _ := tls.Dial(
|
||
|
// "tcp",
|
||
|
// "192.168.1.215:995",
|
||
|
// &tls.Config{
|
||
|
// InsecureSkipVerify: true,
|
||
|
// ServerName: "192.168.1.215",
|
||
|
// },
|
||
|
// )
|
||
|
//
|
||
|
// defer conn.Close()
|
||
|
//
|
||
|
// pop3Run(conn, t)
|
||
|
//}
|
||
|
//
|
||
|
//func TestPopNor(t *testing.T) {
|
||
|
//
|
||
|
// client, _ := net.Dial("tcp", "192.168.1.215:110")
|
||
|
//
|
||
|
// defer client.Close()
|
||
|
//
|
||
|
// pop3Run(client, t)
|
||
|
//
|
||
|
//}
|
||
|
//
|
||
|
//func pop3Run(client net.Conn, t *testing.T) {
|
||
|
//
|
||
|
// lm := NewPOPMatcher()
|
||
|
//
|
||
|
// port := types.NewPort("110", types.NewHost("192.168.1.215"), types.TYPE_TCP)
|
||
|
// scanInfo := scaninfo.NewServiceScanInfo(port)
|
||
|
// var ipport string
|
||
|
// ipport = port.Host.Ip + ":" + string(port.Port)
|
||
|
//
|
||
|
// fmt.Println(ipport)
|
||
|
//
|
||
|
// bytett := make([]byte, 1024)
|
||
|
//
|
||
|
// read, _ := client.Read(bytett)
|
||
|
//
|
||
|
// bb := lm.Match(0, packet.NewPacket(bytett, read), scanInfo)
|
||
|
//
|
||
|
// if bb {
|
||
|
// t.Log("good!")
|
||
|
// }
|
||
|
//
|
||
|
// fmt.Println(lm.PacketCount())
|
||
|
//
|
||
|
// for ii := 0; ii < lm.PacketCount(); ii++ {
|
||
|
//
|
||
|
// pack := lm.Packet(ii)
|
||
|
//
|
||
|
// //fmt.Println(pack)
|
||
|
//
|
||
|
// client.Write(pack.Buffer)
|
||
|
//
|
||
|
// bytes := make([]byte, 1024)
|
||
|
//
|
||
|
// rr, _ := client.Read(bytes)
|
||
|
//
|
||
|
// //fmt.Println(bytes)
|
||
|
//
|
||
|
// b := lm.Match(ii+1, packet.NewPacket(bytes, rr), scanInfo)
|
||
|
//
|
||
|
// if b {
|
||
|
// t.Log("send Good!")
|
||
|
// }
|
||
|
//
|
||
|
// }
|
||
|
//
|
||
|
// t.Log(scanInfo)
|
||
|
//
|
||
|
//}
|