111 lines
2.0 KiB
Go
111 lines
2.0 KiB
Go
package ldap
|
|
|
|
//
|
|
//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 SetUp() {
|
|
//// fmt.Println("SetUp")
|
|
////}
|
|
////
|
|
////func TearDown() {
|
|
//// fmt.Println("TearDown")
|
|
////}
|
|
//
|
|
////func TestMain(m *testing.M) {
|
|
//// SetUp()
|
|
//// m.Run()
|
|
//// TearDown()
|
|
////}
|
|
//
|
|
//func TestAAAA(t *testing.T) {
|
|
// ///animals := []Animal{Dog{}, Cat{}, Llama{}, JavaProgrammer{}}
|
|
//
|
|
// var ttt [][]int = make([][]int, 10)
|
|
//
|
|
// var aaa []int
|
|
// aaa = append(aaa, 111)
|
|
//
|
|
// ttt = append(ttt, aaa)
|
|
//
|
|
// fmt.Println(cap(ttt))
|
|
//
|
|
//}
|
|
//
|
|
//func ldapRun(client net.Conn, t *testing.T) {
|
|
// lm := NewLDAPMatcher()
|
|
//
|
|
// port := types.NewPort("389", 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)
|
|
// //client, _ := net.Dial("tcp", ipport)
|
|
// //defer client.Close()
|
|
//
|
|
// fmt.Println(lm.PacketCount())
|
|
//
|
|
// for ii := 0; ii < lm.PacketCount(); ii++ {
|
|
//
|
|
// pack := lm.Packet(ii)
|
|
//
|
|
// bytes := make([]byte, 1024)
|
|
//
|
|
// client.Write(pack.Buffer)
|
|
//
|
|
// read, _ := client.Read(bytes)
|
|
//
|
|
// if read <= 0 {
|
|
// bb := lm.IsNoResponse(ii)
|
|
// if bb {
|
|
//
|
|
// t.Log("IsNoResponse good")
|
|
// break
|
|
// }
|
|
//
|
|
// }
|
|
//
|
|
// fmt.Println(bytes)
|
|
//
|
|
// b := lm.Match(ii, packet.NewPacket(bytes, read), scanInfo)
|
|
//
|
|
// if b {
|
|
// t.Log("Good")
|
|
// }
|
|
//
|
|
// }
|
|
//
|
|
// t.Log(scanInfo)
|
|
//}
|
|
//
|
|
//func TestLdapTls(t *testing.T) {
|
|
// conn, _ := tls.Dial(
|
|
// "tcp",
|
|
// "192.168.1.215:636",
|
|
// &tls.Config{
|
|
// InsecureSkipVerify: true,
|
|
// ServerName: "192.168.1.215",
|
|
// },
|
|
// )
|
|
//
|
|
// defer conn.Close()
|
|
//
|
|
// ldapRun(conn, t)
|
|
//}
|
|
//
|
|
//func TestLdapNormal(t *testing.T) {
|
|
// client, _ := net.Dial("tcp", "192.168.1.215:389")
|
|
//
|
|
// defer client.Close()
|
|
//
|
|
// ldapRun(client, t)
|
|
//}
|