{"id":16829307,"url":"https://github.com/bwmarrin/go-objectsid","last_synced_at":"2025-03-22T04:30:31.972Z","repository":{"id":57502774,"uuid":"224055312","full_name":"bwmarrin/go-objectsid","owner":"bwmarrin","description":"A Go (golang) Utility package for decoding Active Directory objectSID","archived":false,"fork":false,"pushed_at":"2019-11-26T14:45:45.000Z","size":6,"stargazers_count":26,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T08:02:08.854Z","etag":null,"topics":["active-directory","go","golang","objectsid","sid-format"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bwmarrin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-25T22:42:06.000Z","updated_at":"2025-01-05T01:17:10.000Z","dependencies_parsed_at":"2022-08-31T08:01:59.309Z","dependency_job_id":null,"html_url":"https://github.com/bwmarrin/go-objectsid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwmarrin%2Fgo-objectsid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwmarrin%2Fgo-objectsid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwmarrin%2Fgo-objectsid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bwmarrin%2Fgo-objectsid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bwmarrin","download_url":"https://codeload.github.com/bwmarrin/go-objectsid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244907420,"owners_count":20529850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["active-directory","go","golang","objectsid","sid-format"],"created_at":"2024-10-13T11:32:28.447Z","updated_at":"2025-03-22T04:30:31.701Z","avatar_url":"https://github.com/bwmarrin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-objectsid\n====\n[![Discord Gophers](https://img.shields.io/badge/Discord%20Gophers-%23info-blue.svg)](https://discord.gg/0f1SbxBZjYq9jLBk)\n\ngo-objectsid is a [Go](https://golang.org/) package for decoding binary\nActive Directory ObjectSID value into a human-readable string format.\n\n**For help with this package or general Go discussion, please join the [Discord \nGophers](https://discord.gg/0f1SbxBZjYq9jLBk) chat server.**\n\n## Status\nI just wrote this after finding a few examples in other languages.  It seems to \nwork based on my minimal testing.  Please report any bugs you find.\n  \n### Binary ObjectSID Format\n```\nbyte[0]   - Revision Level\nbyte[1]   - count of Sub-Authorities\nbyte[2-7] - 48 bit Authority (big-endian)\nbyte[8+]  - n Sub-Authorities, 32 bits each (little-endian)\n```\n\n### String ObjectSID Format\n`S-{Revision}-{Authority}-{SubAuthority1}-{SubAuthority2}...-{SubAuthorityN}`\n\n\n\n## Getting Started\n\n### Installing\n\nThis assumes you already have a working Go environment, if not please see\n[this page](https://golang.org/doc/install) first.\n\n```sh\ngo get github.com/bwmarrin/go-objectsid\n```\n\n\n### Usage\n\nImport the package into your project then call the Decode function with a\nbinary objectSID.  It will return a SID object that contains each individual \ncomponent of the SID along with a String() method to generate a properly formatted\nSID string. \n\n\n**Example Program:**\n\n```go\npackage main\n\nimport (\n\t\"encoding/base64\"\n\t\"fmt\"\n\n\t\"github.com/bwmarrin/go-objectsid\"\n)\n\nfunc main() {\n\t// A objectSID in base64\n\t// This is just here for the purpose of an example program\n\tb64sid := `AQUAAAAAAAUVAAAArC22DNydmGz4WUTnUAQAAA==`\n\n\t// Convert the above into binary form. This is the value you would\n\t// get from a LDAP query on AD.\n\tbsid, _ := base64.StdEncoding.DecodeString(b64sid)\n\n\t// Decode the binary objectsid into a SID object\n\tsid := objectsid.Decode(bsid)\n\n\t// Print out just one component of the SID\n\tfmt.Println(sid.Authority)\n\n\t// Print out the relative identifier\n\tfmt.Println(sid.RID())\n\n\t// Print the entire ObjectSID\n\tfmt.Println(sid)\n}\n```\n\n### Credit\nThis was wrote using the below page as a reference.\n\nhttp://www.adamretter.org.uk/blog/entries/active-directory-ldap-users-primary-group.xml\n\n### Reference\nThis page has a lot of useful information on the SID format.\n\nhttps://docs.microsoft.com/en-us/windows/security/identity-protection/access-control/security-identifiers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwmarrin%2Fgo-objectsid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbwmarrin%2Fgo-objectsid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbwmarrin%2Fgo-objectsid/lists"}