mirror of
https://github.com/sairson/Yasso.git
synced 2026-02-07 04:24:34 +08:00
45 lines
1.7 KiB
Go
45 lines
1.7 KiB
Go
package ldap
|
|
|
|
import (
|
|
"Yasso/pkg/exploit/ldap/core/query"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// LdapAuthAndQuery ldap 认证并且查询目标
|
|
// 设置参数 command , filter, user , password, dc host , name
|
|
func LdapAuthAndQuery(ldapServer, ldapUser, ldapPassword, command, filter, name string, all bool) {
|
|
s := strings.Split(ldapServer, ".")
|
|
baseDN := ""
|
|
for x := 1; x < len(s); x++ {
|
|
if x == len(s)-1 {
|
|
baseDN += "DC=" + s[x]
|
|
} else {
|
|
baseDN += "DC=" + s[x] + ","
|
|
}
|
|
}
|
|
ldapServer = fmt.Sprintf("%s:389", ldapServer)
|
|
query.LdapListQuery(ldapServer, ldapUser, ldapPassword, baseDN, command, filter, name, all)
|
|
}
|
|
|
|
func ListLdapCommand() {
|
|
fmt.Println(" 可执行的查询命令")
|
|
fmt.Println(" dc - 列出域控制器")
|
|
fmt.Println(" domain-trust - 列出域信任关系")
|
|
fmt.Println(" users - 列出域内全部用户")
|
|
fmt.Println(" computers - 列出域内全部计算机")
|
|
fmt.Println(" groups - 列出域内组和成员")
|
|
fmt.Println(" spn - 列出服务的spn对象")
|
|
fmt.Println(" never-loggedon - 列出域内从未登陆过的用户")
|
|
fmt.Println(" gpo - 列出gpo规则对象")
|
|
fmt.Println(" ou - 列出组织单位")
|
|
fmt.Println(" ms-sql - 列出SQL Server服务(注册的)")
|
|
fmt.Println(" asreproast - 列出AS-REP可托管账户")
|
|
fmt.Println(" unconstrained - 列出不受约束委派的用户")
|
|
fmt.Println(" admin-priv - 列出域内管理员权限组")
|
|
fmt.Println(" 可执行的过滤器指令(users,groups,computers)")
|
|
fmt.Println(" list - 仅仅列出全部对象")
|
|
fmt.Println(" full-data - 列出全部对象带有对象属性")
|
|
fmt.Println(" membership - 列出全部的成员从一个对象当中")
|
|
}
|