{"id":31978628,"url":"https://github.com/nyaosorg/go-windows-su","last_synced_at":"2025-10-14T22:24:49.996Z","repository":{"id":57518936,"uuid":"234673049","full_name":"nyaosorg/go-windows-su","owner":"nyaosorg","description":"Switch or test Windows' administrator mode","archived":false,"fork":false,"pushed_at":"2022-05-29T13:00:23.000Z","size":22,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-15T12:48:35.227Z","etag":null,"topics":["go","golang","windows"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/nyaosorg/go-windows-su","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nyaosorg.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":"2020-01-18T02:57:14.000Z","updated_at":"2024-10-31T14:03:09.000Z","dependencies_parsed_at":"2022-09-26T18:00:45.257Z","dependency_job_id":null,"html_url":"https://github.com/nyaosorg/go-windows-su","commit_stats":null,"previous_names":["zetamatta/go-windows-su"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/nyaosorg/go-windows-su","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyaosorg%2Fgo-windows-su","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyaosorg%2Fgo-windows-su/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyaosorg%2Fgo-windows-su/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyaosorg%2Fgo-windows-su/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nyaosorg","download_url":"https://codeload.github.com/nyaosorg/go-windows-su/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyaosorg%2Fgo-windows-su/sbom","scorecard":{"id":699783,"data":{"date":"2025-08-11","repo":{"name":"github.com/nyaosorg/go-windows-su","commit":"e7aeff2d30d9af3f2178c2e6d76c69a3993cb2b5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Code-Review","score":0,"reason":"Found 0/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.1.0 not signed: https://api.github.com/repos/nyaosorg/go-windows-su/releases/23911453","Warn: release artifact v0.1.0 does not have provenance: https://api.github.com/repos/nyaosorg/go-windows-su/releases/23911453"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T04:55:48.807Z","repository_id":57518936,"created_at":"2025-08-22T04:55:48.808Z","updated_at":"2025-08-22T04:55:48.808Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279021780,"owners_count":26087055,"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","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["go","golang","windows"],"created_at":"2025-10-14T22:24:47.486Z","updated_at":"2025-10-14T22:24:49.991Z","avatar_url":"https://github.com/nyaosorg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-windows-su\r\n=============\r\n\r\nSwitch or test administrator's mode\r\n\r\n[Switch](./cmd/chhosts/main.go)\r\n------------------------------\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n    \"os\"\r\n    \"path/filepath\"\r\n\r\n    \"github.com/nyaosorg/go-windows-su\"\r\n)\r\n\r\nfunc main() {\r\n    windir := os.Getenv(\"SystemRoot\")\r\n    hosts := filepath.Join(windir, `system32\\drivers\\etc\\hosts`)\r\n\r\n    su.ShellExecute(su.RUNAS,\r\n        \"notepad\",\r\n        hosts,\r\n        `C:\\`)\r\n}\r\n```\r\n\r\nIf you call the executable on the network by su.ShellExecute,\r\ngive the parameter the path filtered by filepath.EvalSymlinks.\r\n\r\n[Test](./cmd/isElevated/main.go)\r\n--------------------------------\r\n\r\n```go\r\npackage main\r\n\r\nimport (\r\n    \"fmt\"\r\n    \"os\"\r\n\r\n    \"github.com/nyaosorg/go-windows-su\"\r\n)\r\n\r\nfunc main() {\r\n    flag, err := su.IsElevated()\r\n    if err != nil {\r\n        fmt.Fprintln(os.Stderr, err.Error())\r\n        os.Exit(2)\r\n    } else if flag {\r\n        fmt.Println(\"Administrator mode\")\r\n        os.Exit(0)\r\n    } else {\r\n        fmt.Println(\"Not administrator mode\")\r\n        os.Exit(1)\r\n    }\r\n}\r\n```\r\n\r\nSample Application\r\n------------------\r\n\r\n[source](./cmd/sucopy/main.go)\r\n\r\n```\r\nsucopy SRC DST\r\n```\r\n\r\nExecute `copy` built in CMD.EXE in Administrator-mode.\r\n`sucopy` keeps network-drives.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyaosorg%2Fgo-windows-su","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnyaosorg%2Fgo-windows-su","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyaosorg%2Fgo-windows-su/lists"}