Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: lkarlslund/ldapnomnom
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.6
Choose a base ref
...
head repository: lkarlslund/ldapnomnom
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Sep 24, 2022

  1. Upgraded LDAP module

    lkarlslund committed Sep 24, 2022
    Copy the full SHA
    098ca09 View commit details

Commits on Sep 26, 2022

  1. It's red vs blue

    lkarlslund committed Sep 26, 2022
    Copy the full SHA
    5e62bec View commit details

Commits on Dec 15, 2022

  1. Copy the full SHA
    64921bd View commit details
  2. Copy the full SHA
    6ea0cd7 View commit details
  3. Copy the full SHA
    61637bd View commit details

Commits on Jan 4, 2023

  1. Copy the full SHA
    f8d6aaf View commit details

Commits on Mar 31, 2023

  1. Copy the full SHA
    21a8627 View commit details

Commits on Dec 15, 2023

  1. Copy the full SHA
    792d446 View commit details
  2. Copy the full SHA
    200b79b View commit details
  3. Copy the full SHA
    a77c77e View commit details

Commits on Feb 7, 2024

  1. Minor module upgrade

    lkarlslund committed Feb 7, 2024
    Copy the full SHA
    680e316 View commit details
  2. Updated readme to mention that Microsoft Defender for Identity now de…

    …tects this based on bad guess count
    lkarlslund committed Feb 7, 2024
    Copy the full SHA
    5792223 View commit details
  3. Copy the full SHA
    cf250d1 View commit details

Commits on Feb 19, 2024

  1. Copy the full SHA
    c578678 View commit details
  2. Obfuscated builds

    lkarlslund committed Feb 19, 2024
    Copy the full SHA
    2c9c4a0 View commit details
  3. Build fix

    lkarlslund committed Feb 19, 2024
    Copy the full SHA
    ff52afc View commit details
  4. Build fix take two

    lkarlslund committed Feb 19, 2024
    Copy the full SHA
    c6f0fc1 View commit details
  5. Another build fix

    lkarlslund committed Feb 19, 2024
    Copy the full SHA
    76e7177 View commit details
  6. Build update

    lkarlslund committed Feb 19, 2024
    Copy the full SHA
    f06417a View commit details
  7. Typo

    lkarlslund committed Feb 19, 2024
    Copy the full SHA
    a7ce063 View commit details
  8. Also literals

    lkarlslund committed Feb 19, 2024
    Copy the full SHA
    6dbe9fe View commit details

Commits on Oct 31, 2024

  1. License year fix

    lkarlslund committed Oct 31, 2024
    Copy the full SHA
    8ccc061 View commit details
  2. Copy the full SHA
    a7a7f64 View commit details
  3. Fix automated builds

    lkarlslund committed Oct 31, 2024
    Copy the full SHA
    c48f174 View commit details
  4. Wait for output to finish

    lkarlslund committed Oct 31, 2024
    Copy the full SHA
    3d9d127 View commit details
  5. Copy the full SHA
    5bc12f4 View commit details

Commits on Nov 5, 2024

  1. Copy the full SHA
    c7be868 View commit details
  2. Reconnect fix

    lkarlslund committed Nov 5, 2024
    Copy the full SHA
    f9dd354 View commit details
  3. More error checking

    lkarlslund committed Nov 5, 2024
    Copy the full SHA
    063bd8d View commit details
  4. Copy the full SHA
    0a4a529 View commit details

Commits on Nov 9, 2024

  1. Added version information

    lkarlslund committed Nov 9, 2024
    Copy the full SHA
    bdc7fae View commit details
Showing with 681 additions and 221 deletions.
  1. +39 −36 .github/workflows/prerelease.yml
  2. +37 −34 .github/workflows/release.yml
  3. +3 −1 .gitignore
  4. BIN bruteforce-50k.png
  5. +59 −32 build.ps1
  6. +98 −0 dumpRootDSE.go
  7. +18 −12 go.mod
  8. +98 −29 go.sum
  9. +1 −1 license.MD
  10. +231 −68 main.go
  11. +27 −8 readme.MD
  12. +70 −0 stringgen.go
75 changes: 39 additions & 36 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
name: Build and publish pre-release

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Build
run: ./build.ps1
shell: pwsh

- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: Binaries
path: binaries/*

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "prerelease"
prerelease: true
title: "Development Build"
files: |
name: Build and publish pre-release

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Install Garble
run: go install mvdan.cc/garble@latest

- name: Build
run: ./build.ps1
shell: pwsh

- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: Binaries
path: binaries/*

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "prerelease"
prerelease: true
title: "Development Build"
files: |
binaries/*
71 changes: 37 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
name: Build and publish release

on:
push:
tags: [ "*.*.*" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Build
run: ./build.ps1
shell: pwsh

- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: Binaries
path: binaries/*

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
name: Build and publish release

on:
push:
tags: [ "*.*.*" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23

- name: Install Garble
run: go install mvdan.cc/garble@latest

- name: Build
run: ./build.ps1
shell: pwsh

- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: Binaries
path: binaries/*

- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
binaries/*
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
binaries/*
binaries
build
.vscode
Binary file added bruteforce-50k.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 59 additions & 32 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,32 +1,59 @@
function BuildVariants {
param (
$ldflags,
$compileflags,
$prefix,
$suffix,
$arch,
$os,
$path
)

foreach ($currentarch in $arch) {
foreach ($currentos in $os) {
$env:GOARCH = $currentarch
$env:GOOS = $currentos
$outputfile = "binaries/$prefix-$currentos-$currentarch$suffix"
if ($currentos -eq "windows") {
$outputfile += ".exe"
}
go build -ldflags "$ldflags" -o $outputfile $compileflags $path
if (Get-Command "cyclonedx-gomod" -ErrorAction SilentlyContinue)
{
cyclonedx-gomod app -json -licenses -output $outputfile.bom.json -main $path .
}
}
}
}

Set-Location $PSScriptRoot

# Release
BuildVariants -ldflags "$LDFLAGS -s" -prefix ldapnomnom -path . -arch @("386", "amd64", "arm64") -os @("windows", "darwin", "linux")
function BuildVariants {
param (
$builder,
$ldflags,
$compileflags,
$prefix,
$arch,
$os,
$path
)

foreach ($currentarch in $arch) {
foreach ($currentos in $os) {
$env:GOARCH = $currentarch
$env:GOOS = $currentos

# More sensible naming for x64
$namearch = $currentarch
if ($namearch -eq "amd64") {
$namearch = "x64"
}

$outputfile = "binaries/$prefix-$currentos-$namearch"
if ($currentos -eq "windows") {
$outputfile += ".exe"
}
go build -ldflags "$ldflags" -o $outputfile $compileflags $path

$outputfile = "binaries/$prefix-$currentos-$namearch-obfuscated"
if ($currentos -eq "windows") {
$outputfile += ".exe"
}
garble -seed=random -tiny -literals build -ldflags "$ldflags" -o $outputfile $compileflags $path

if (Get-Command "cyclonedx-gomod" -ErrorAction SilentlyContinue)
{
cyclonedx-gomod app -json -licenses -output $outputfile.bom.json -main $path .
}
}
}
}

Set-Location $PSScriptRoot

$COMMIT = git rev-parse --short HEAD
$VERSION = git describe --tags --exclude latest --exclude devbuild
$DIRTYFILES = git status --porcelain
$BUILDER = "go"

if ("$DIRTYFILES" -ne "") {
$VERSION = "$VERSION-local-changes"
}

Write-Output "Building $VERSION"

$LDFLAGS = "-X main.Version=$VERSION"

# Release
BuildVariants -ldflags "$LDFLAGS -s" -prefix ldapnomnom -path . -arch @("386", "amd64", "arm64") -os @("windows", "darwin", "linux")
98 changes: 98 additions & 0 deletions dumpRootDSE.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package main

import (
"github.com/lkarlslund/ldap/v3"
)

var defaultDumpAttrs = []string{
"configurationNamingContext",
"currentTime",
"defaultNamingContext",
"dNSHostName",
"dsSchemaAttrCount",
"dsSchemaClassCount",
"dsSchemaPrefixCount",
"dsServiceName",
"highestCommittedUSN",
"isGlobalCatalogReady",
"isSynchronized",
"ldapServiceName",
"namingContexts",
"netlogon",
"pendingPropagations",
"rootDomainNamingContext",
"schemaNamingContext",
"serverName",
"subschemaSubentry",
"supportedCapabilities",
"supportedControl",
"supportedLDAPPolicies",
"supportedLDAPVersion",
"supportedSASLMechanisms",
"domainControllerFunctionality",
"domainFunctionality",
"forestFunctionality",
"msDS-ReplAllInboundNeighbors",
"msDS-ReplAllOutboundNeighbors",
"msDS-ReplConnectionFailures",
"msDS-ReplLinkFailures",
"msDS-ReplPendingOps",
"msDS-ReplQueueStatistics",
"msDS-TopQuotaUsage",
"supportedConfigurableSettings",
"supportedExtension",
"validFSMOs",
"dsaVersionString",
"msDS-PortLDAP",
"msDS-PortSSL",
"msDS-PrincipalName",
"serviceAccountInfo",
"spnRegistrationResult",
"tokenGroups",
"usnAtRifm",
"approximateHighestInternalObjectID",
"databaseGuid",
"schemaIndexUpdateState",
"dumpLdapNotifications",
"msDS-ProcessLinksOperations",
"msDS-SegmentCacheInfo",
"msDS-ThreadStates",
"ConfigurableSettingsEffective",
"LDAPPoliciesEffective",
"msDS-ArenaInfo",
"msDS-Anchor",
"msDS-PrefixTable",
"msDS-SupportedRootDSEAttributes",
"msDS-SupportedRootDSEModifications",
}

func dumpRootDSE(conn *ldap.Conn) (map[string][]string, error) {
result := make(map[string][]string)

// See if we can ask the server what attributes it knows about
probeAttrs := getRootDSEAttribute(conn, "msDS-SupportedRootDSEAttributes")
if len(probeAttrs) == 0 {
probeAttrs = defaultDumpAttrs
}

// Extract what we can
for _, attribute := range probeAttrs {
result[attribute] = getRootDSEAttribute(conn, attribute)
}
return result, nil
}

func getRootDSEAttribute(conn *ldap.Conn, attribute string) []string {
request := ldap.NewSearchRequest(
"", // The base dn to search
ldap.ScopeBaseObject, ldap.NeverDerefAliases, 0, 0, false,
"(objectClass=*)", // The filter to apply
[]string{attribute}, // A list attributes to retrieve
nil,
)
response, err := conn.Search(request)
if err == nil && len(response.Entries) == 1 && len(response.Entries[0].Attributes) == 1 {
return response.Entries[0].Attributes[0].Values
}
return nil
}
30 changes: 18 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
module github.com/lkarlslund/ldapnomnom

go 1.19
go 1.23

require (
github.com/Showmax/go-fqdn v1.0.0
github.com/lkarlslund/ldap/v3 v3.2.4-0.20210621153959-85555023df29
github.com/schollz/progressbar/v3 v3.11.0
github.com/lkarlslund/ldap/v3 v3.4.4-2
github.com/schollz/progressbar/v3 v3.17.0
)

require (
github.com/Azure/go-ntlmssp v0.0.0-20211209120228-48547f28849e // indirect
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
github.com/jcmturner/gofork v1.7.6 // indirect
github.com/jcmturner/goidentity/v6 v6.0.1 // indirect
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/stretchr/testify v1.7.0 // indirect
golang.org/x/crypto v0.0.0-20220307211146-efcb8507fb70 // indirect
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/stretchr/testify v1.9.0 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
)
Loading