From 0bcc48ccbb0dbb6812a7fd785d5f96412b3fb9de Mon Sep 17 00:00:00 2001 From: Alessandro Bresciani Date: Mon, 23 Dec 2024 11:52:26 +0100 Subject: [PATCH] using ldap.DialURL for ldaps banners as DialTLS is deprecated --- scanme/grabbers.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scanme/grabbers.go b/scanme/grabbers.go index 390b963..29bd2ba 100644 --- a/scanme/grabbers.go +++ b/scanme/grabbers.go @@ -75,9 +75,11 @@ func GrabMysqlBanner(ipAddress string, port int) (string, error) { } func GetLDAPBanner(ipAddress string, port int) (string, error) { + ldapURL := fmt.Sprintf("ldaps://%s:%d", ipAddress, port) + tlsConfig := &tls.Config{InsecureSkipVerify: true} - l, err := ldap.DialTLS("tcp", fmt.Sprintf("%s:%d", ipAddress, port), tlsConfig) + l, err := ldap.DialURL(ldapURL, ldap.DialWithTLSConfig(tlsConfig)) if err != nil { return "", err } @@ -105,7 +107,7 @@ func GetLDAPBanner(ipAddress string, port int) (string, error) { var serverInfo string for _, entry := range searchResult.Entries { for _, attr := range entry.Attributes { - serverInfo += fmt.Sprintf("%s: %s", attr.Name, attr.Values) + serverInfo += fmt.Sprintf("%s: %s\n", attr.Name, attr.Values) } }