Skip to content

Commit 30b8f19

Browse files
committed
Public release
1 parent 1d2ee89 commit 30b8f19

File tree

12 files changed

+561
-1
lines changed

12 files changed

+561
-1
lines changed

.github/FUNDING.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# These are supported funding model platforms
2+
3+
github: p0dalirius

.github/banner.png

559 KB
Loading

.github/example_dn.png

204 KB
Loading

.github/example_value.png

228 KB
Loading
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Auto-prefix & Label Issues
2+
3+
on:
4+
issues:
5+
types: [opened, edited]
6+
7+
jobs:
8+
prefix_and_label:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Ensure labels exist, then prefix titles & add labels
12+
uses: actions/github-script@v6
13+
with:
14+
script: |
15+
const owner = context.repo.owner;
16+
const repo = context.repo.repo;
17+
18+
// 1. Ensure required labels exist
19+
const required = [
20+
{ name: 'bug', color: 'd73a4a', description: 'Something isn\'t working' },
21+
{ name: 'enhancement', color: 'a2eeef', description: 'New feature or request' }
22+
];
23+
24+
// Fetch current labels in the repo
25+
const { data: existingLabels } = await github.rest.issues.listLabelsForRepo({
26+
owner, repo, per_page: 100
27+
});
28+
const existingNames = new Set(existingLabels.map(l => l.name));
29+
30+
// Create any missing labels
31+
for (const lbl of required) {
32+
if (!existingNames.has(lbl.name)) {
33+
await github.rest.issues.createLabel({
34+
owner,
35+
repo,
36+
name: lbl.name,
37+
color: lbl.color,
38+
description: lbl.description
39+
});
40+
console.log(`Created label "${lbl.name}"`);
41+
}
42+
}
43+
44+
// 2. Fetch all open issues
45+
const issues = await github.paginate(
46+
github.rest.issues.listForRepo,
47+
{ owner, repo, state: 'open', per_page: 100 }
48+
);
49+
50+
// 3. Keyword sets
51+
const enhancementWords = ["add", "added", "improve", "improved"];
52+
const bugWords = ["bug", "error", "problem", "crash", "failed", "fix", "fixed"];
53+
54+
// 4. Process each issue
55+
for (const issue of issues) {
56+
const origTitle = issue.title;
57+
const lower = origTitle.toLowerCase();
58+
59+
// skip if already prefixed
60+
if (/^\[(bug|enhancement)\]/i.test(origTitle)) continue;
61+
62+
let prefix, labelToAdd;
63+
if (enhancementWords.some(w => lower.includes(w))) {
64+
prefix = "[enhancement]";
65+
labelToAdd = "enhancement";
66+
} else if (bugWords.some(w => lower.includes(w))) {
67+
prefix = "[bug]";
68+
labelToAdd = "bug";
69+
}
70+
71+
if (prefix) {
72+
// update title
73+
await github.rest.issues.update({
74+
owner, repo, issue_number: issue.number,
75+
title: `${prefix} ${origTitle}`
76+
});
77+
console.log(`Prefixed title of #${issue.number}`);
78+
79+
// add label
80+
await github.rest.issues.addLabels({
81+
owner, repo, issue_number: issue.number,
82+
labels: [labelToAdd]
83+
});
84+
console.log(`Added label "${labelToAdd}" to #${issue.number}`);
85+
}
86+
}

.github/workflows/commit.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build on commit
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
name: Build Release Assets
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
os: [linux, windows, darwin]
16+
arch: [amd64, arm64, 386]
17+
binaryname: [DescribeKeyCredentialLink]
18+
# Exclude incompatible couple of GOOS and GOARCH values
19+
exclude:
20+
- os: darwin
21+
arch: 386
22+
23+
env:
24+
GO111MODULE: 'on'
25+
CGO_ENABLED: '0'
26+
27+
steps:
28+
- name: Checkout Repository
29+
uses: actions/checkout@v3
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v4
33+
with:
34+
go-version: '1.22.1'
35+
36+
- name: Build Binary
37+
env:
38+
GOOS: ${{ matrix.os }}
39+
GOARCH: ${{ matrix.arch }}
40+
run: |
41+
mkdir -p build
42+
OUTPUT_PATH="../build/${{ matrix.binaryname }}-${{ matrix.os }}-${{ matrix.arch }}"
43+
# Build the binary
44+
go build -ldflags="-s -w" -o $OUTPUT_PATH${{ matrix.os == 'windows' && '.exe' || '' }}

.github/workflows/release.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build and Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
name: Build Release Assets
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
os: [linux, windows, darwin]
15+
arch: [amd64, arm64, 386]
16+
binaryname: [DescribeKeyCredentialLink]
17+
# Exclude incompatible couple of GOOS and GOARCH values
18+
exclude:
19+
- os: darwin
20+
arch: 386
21+
22+
env:
23+
GO111MODULE: 'on'
24+
CGO_ENABLED: '0'
25+
26+
steps:
27+
- name: Checkout Repository
28+
uses: actions/checkout@v3
29+
30+
- name: Set up Go
31+
uses: actions/setup-go@v4
32+
with:
33+
go-version: '1.22.1'
34+
35+
- name: Build Binary
36+
env:
37+
GOOS: ${{ matrix.os }}
38+
GOARCH: ${{ matrix.arch }}
39+
run: |
40+
mkdir -p bin
41+
OUTPUT_PATH="../build/${{ matrix.binaryname }}-${{ matrix.os }}-${{ matrix.arch }}"
42+
# Build the binary
43+
go build -ldflags="-s -w" -o $OUTPUT_PATH${{ matrix.os == 'windows' && '.exe' || '' }}
44+
45+
- name: Prepare Release Assets
46+
if: ${{ success() }}
47+
run: |
48+
mkdir -p ./release/
49+
cp ./build/${{ matrix.binaryname }}-* ./release/
50+
51+
- name: Upload the Release binaries
52+
uses: svenstaro/upload-release-action@v2
53+
with:
54+
repo_token: ${{ secrets.GITHUB_TOKEN }}
55+
tag: ${{ github.ref }}
56+
file: ./release/${{ matrix.binaryname }}-*
57+
file_glob: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ go.work.sum
2323

2424
# env file
2525
.env
26+
27+
# Builds dir
28+
./bin/

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,64 @@
1-
# ParseMsDSKeyCredentialLink
1+
![](./.github/banner.png)
2+
3+
<p align="center">
4+
A cross-platform tool to parse and describe the contents of a raw msDS-KeyCredentialLink data blob.
5+
<br>
6+
<a href="https://github.com/TheManticoreProject/DescribeKeyCredentialLink/actions/workflows/release.yaml" title="Build"><img alt="Build and Release" src="https://github.com/TheManticoreProject/DescribeKeyCredentialLink/actions/workflows/release.yaml/badge.svg"></a>
7+
<img alt="GitHub release (latest by date)" src="https://img.shields.io/github/v/release/TheManticoreProject/DescribeKeyCredentialLink">
8+
<img alt="Go Report Card" src="https://goreportcard.com/badge/github.com/TheManticoreProject/DescribeKeyCredentialLink">
9+
<br>
10+
</p>
11+
12+
## Features
13+
14+
- [x] Read msDS-KeyCredentialLink data blob:
15+
- [x] from LDAP
16+
- [x] from a file
17+
- [x] from raw string
18+
19+
## Usage
20+
21+
```
22+
$ ./DescribeKeyCredentialLink -h
23+
DescribeKeyCredentialLink - by Remi GASCOU (Podalirius) @ TheManticoreProject - v1.3.0
24+
25+
Usage: DescribeKeyCredentialLink [--quiet] [--debug] [--domain <string>] --username <string> [--password <string>] [--hashes <string>] [--dc-ip <string>] [--ldap-port <tcp port>] [--use-ldaps] [--distinguished-name <string>] [--value <string>]
26+
27+
-q, --quiet Show no information at all. (default: false)
28+
-d, --debug Debug mode. (default: false)
29+
30+
Authentication:
31+
-d, --domain <string> Active Directory domain to authenticate to. (default: "")
32+
-u, --username <string> User to authenticate as.
33+
-p, --password <string> Password to authenticate with. (default: "")
34+
-H, --hashes <string> NT/LM hashes, format is LMhash:NThash. (default: "")
35+
36+
LDAP Connection Settings:
37+
-dc, --dc-ip <string> IP Address of the domain controller or KDC (Key Distribution Center) for Kerberos. If omitted, it will use the domain part (FQDN) specified in the identity parameter. (default: "")
38+
-lp, --ldap-port <tcp port> Port number to connect to LDAP server. (default: 389)
39+
-L, --use-ldaps Use LDAPS instead of LDAP. (default: false)
40+
41+
Source Values:
42+
-D, --distinguished-name <string> Distinguished Name. (default: "")
43+
-v, --value <string> Raw string value of of msDS-KeyCredentialLink, it typically starts with 'B:'. (default: "")
44+
```
45+
46+
## Demonstration with a `--distinguished-name` in the LDAP
47+
48+
```bash
49+
./DescribeKeyCredentialLink --domain "MANTICORE.local" --username "Administrator" --password "Admin123!" --dc-ip "192.168.56.101" --debug --distinguished-name "CN=DC01,CN=Computers,DC=MANTICORE,DC=local"
50+
```
51+
52+
![](./.github/example_dn.png)
53+
54+
## Demonstration with a `--value`
55+
56+
```bash
57+
./DescribeKeyCredentialLink --debug --value "B:828:0002000020000108E2E5700BC0E9522D434C139C15B767678284D922DF7E92BA0DD17D62407E9D200002A786DBE1C8FD5259753E75E32DE90CA2CBE04D2A2AF4DACC29DB7C6B06FE3E411B0103525341310008000003000000000100000000000000000000010001CC86F6DEB74305A202C68F94489B82C499C6F21A74D5E290869E82FFF5B5774B961251741E42D7FEC1F5EEAE52B5C759DE321491987D6586F9F3672B4E5B88EB32827480D4444D958275113832EA7B52E91E8ED414796E6AE9061BE323D3BBFACF4448FE2451DF9325393FE1189CE53E7AE6D02E7710D71EB1F16B8ACCF13EB63F34834021DAF3398962A6C1DF4F359CE9A81BD2E6FA3D9DD095898C9FC2E2316DD10B59A5C0C09A71EA12CE70E3AC6EA42C74E258A0C13F102577B9AB2B55658A4F72CAFCDF26B0EBB124EEB3F7D97BD705D04FFA4B0D4C442F68CDC724A5DD4B42B114BB3A667A54F7A733A26F7AFC6FA09CEC688246EC32494668148C09950100040101000500100006335A9368151ACC785211B3C9DA8EC9720200070100080008A7E1A5606E06DA01080009A7E1A5606E06DA01:CN=PC12,CN=Computers,DC=LAB,DC=local"
58+
```
59+
60+
![](./.github/example_value.png)
61+
62+
## Contributing
63+
64+
Pull requests are welcome. Feel free to open an issue if you want to add other features.

go.mod

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
module github.com/TheManticoreProject/DescribeKeyCredentialLink
2+
3+
go 1.24.0
4+
5+
require (
6+
github.com/TheManticoreProject/Manticore v1.0.9-0.20251112154051-eb49d08444c4
7+
github.com/TheManticoreProject/goopts v1.2.4
8+
)
9+
10+
require (
11+
github.com/TheManticoreProject/winacl v1.2.14 // indirect
12+
github.com/alexbrainman/sspi v0.0.0-20250919150558-7d374ff0d59e // indirect
13+
github.com/go-ldap/ldap/v3 v3.4.12 // indirect
14+
github.com/hashicorp/go-uuid v1.0.3 // indirect
15+
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
16+
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
17+
github.com/jcmturner/gofork v1.7.6 // indirect
18+
github.com/jcmturner/goidentity/v6 v6.0.1 // indirect
19+
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
20+
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
21+
golang.org/x/net v0.47.0 // indirect
22+
)
23+
24+
require (
25+
github.com/Azure/go-ntlmssp v0.1.0 // indirect
26+
// indirect
27+
github.com/go-asn1-ber/asn1-ber v1.5.8-0.20250403174932-29230038a667 // indirect
28+
github.com/google/uuid v1.6.0 // indirect
29+
golang.org/x/crypto v0.44.0 // indirect
30+
)

0 commit comments

Comments
 (0)