feat: add version subcommand to help with issues (#400)
This commit is contained in:
committed by
GitHub
parent
c11e3217ea
commit
18ffb7af61
@@ -1,57 +0,0 @@
|
|||||||
Before filing, search open and closed issues and check the FAQ in the README.
|
|
||||||
If this is a security issue, do not post details in a public issue.
|
|
||||||
Do not include IPs or any other information that can identify a vulnerable network in your issue.
|
|
||||||
|
|
||||||
## Issue type
|
|
||||||
|
|
||||||
- [ ] Bug report
|
|
||||||
- [ ] Feature request
|
|
||||||
- [ ] Documentation issue
|
|
||||||
- [ ] Question
|
|
||||||
|
|
||||||
## Context
|
|
||||||
|
|
||||||
### Install method
|
|
||||||
|
|
||||||
- [ ] Docker image `ullaakut/cameradar`
|
|
||||||
- [ ] Custom Docker build
|
|
||||||
- [ ] Pre-compiled binary
|
|
||||||
- [ ] Custom binary build
|
|
||||||
- [ ] Not sure
|
|
||||||
|
|
||||||
### Version
|
|
||||||
|
|
||||||
- [ ] Release tag: <tag>
|
|
||||||
- [ ] Latest commit on `master`
|
|
||||||
- [ ] Fork: <fork URL>
|
|
||||||
- [ ] Commit: <hash>
|
|
||||||
|
|
||||||
## Environment
|
|
||||||
|
|
||||||
- OS: <Windows | macOS | Linux | Other>
|
|
||||||
- OS version: <version>
|
|
||||||
- Architecture: <arch>
|
|
||||||
|
|
||||||
## Description
|
|
||||||
|
|
||||||
### Expected behavior
|
|
||||||
|
|
||||||
<expected behavior>
|
|
||||||
|
|
||||||
### Actual behavior
|
|
||||||
|
|
||||||
<actual behavior>
|
|
||||||
|
|
||||||
### Steps to reproduce
|
|
||||||
|
|
||||||
1. <step>
|
|
||||||
2. <step>
|
|
||||||
3. <step>
|
|
||||||
|
|
||||||
### Logs
|
|
||||||
|
|
||||||
If this is a CLI or Docker issue, run with debug logs and paste output.
|
|
||||||
|
|
||||||
```text
|
|
||||||
<logs>
|
|
||||||
```
|
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
name: Bug report
|
||||||
|
description: Create a report to help Cameradar improve
|
||||||
|
labels:
|
||||||
|
- needs-triage
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please make sure your problem is not already addressed in another issue.
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
description: Please give a clear and concise description of the bug.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: Cameradar version
|
||||||
|
description: Output of `cameradar version`
|
||||||
|
render: bash
|
||||||
|
placeholder: |
|
||||||
|
Version: v6.0.2-SNAPSHOT-c11e321
|
||||||
|
Commit: c11e3217ea0b1ea9e45d0da4c072e07775bde68c
|
||||||
|
Build date: 2026-02-03T10:02:30Z
|
||||||
|
Nmap: 7.94SVN
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: dropdown
|
||||||
|
id: env
|
||||||
|
attributes:
|
||||||
|
label: Environment
|
||||||
|
description: How do you run cameradar?
|
||||||
|
options:
|
||||||
|
- `ullaakut/cameradar` docker image
|
||||||
|
- Precompiled binary from GitHub releases
|
||||||
|
- Custom docker image
|
||||||
|
- Custom binary build
|
||||||
|
default: 0
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: os
|
||||||
|
attributes:
|
||||||
|
label: Operating system
|
||||||
|
description: Operating system where you run cameradar.
|
||||||
|
render: bash
|
||||||
|
placeholder: |
|
||||||
|
- OS: <Windows | macOS | Linux | Other>
|
||||||
|
- OS version: <version>
|
||||||
|
- Architecture: <arch>
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
- type: textarea
|
||||||
|
id: cmd
|
||||||
|
attributes:
|
||||||
|
label: Command
|
||||||
|
description: The command that you ran and all of its arguments. Make sure to redact any sensitive information. Make sure to run your command in debug mode.
|
||||||
|
placeholder: |
|
||||||
|
E.g. `docker run --net=host -it ullaakut/cameradar -t localhost --debug`
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: output
|
||||||
|
attributes:
|
||||||
|
label: Output logs
|
||||||
|
description: Output of the command you ran, including any error messages. Make sure to redact any sensitive information.
|
||||||
|
placeholder: |
|
||||||
|
2026-02-03T09:33:24Z [INFO] Startup: Running cameradar version 6.0.2-SNAPSHOT-75bf524, commit 75bf524
|
||||||
|
2026-02-03T09:33:24Z [INFO] Startup: targets: localhost
|
||||||
|
2026-02-03T09:33:24Z [INFO] Startup: ports: 554, 5554, 8554, http
|
||||||
|
...
|
||||||
|
Accessible streams: 1
|
||||||
|
• 127.0.0.1:8554 (GStreamer rtspd)
|
||||||
|
Authentication: digest
|
||||||
|
Routes: live.sdp
|
||||||
|
Credentials: admin:12345
|
||||||
|
Availability: yes
|
||||||
|
RTSP URL: rtsp://admin:12345@127.0.0.1:8554/live.sdp
|
||||||
|
Admin panel: http://127.0.0.1/
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: Expected behavior
|
||||||
|
description: What is the expected behavior?
|
||||||
|
placeholder: |
|
||||||
|
E.g. "Cameradar should have been able to find the camera's RTSP stream using the provided credentials."
|
||||||
|
- type: textarea
|
||||||
|
id: additional
|
||||||
|
attributes:
|
||||||
|
label: Additional Info
|
||||||
|
description: Additional info you want to provide such as system info, target info, network conditions etc.
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
- type: checkboxes
|
||||||
|
id: terms
|
||||||
|
attributes:
|
||||||
|
label: Code of Conduct
|
||||||
|
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Ullaakut/cameradar/blob/main/CODE_OF_CONDUCT.md).
|
||||||
|
options:
|
||||||
|
- label: I agree to follow this project's Code of Conduct
|
||||||
|
required: true
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: Cameradar Community discussion board
|
||||||
|
url: https://github.com/Ullaakut/cameradar/discussions
|
||||||
|
about: Please ask and answer questions here.
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
name: Feature request
|
||||||
|
description: Propose a feature or enhancement to help Cameradar improve
|
||||||
|
labels:
|
||||||
|
- needs-triage
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please make sure your request is not already proposed in another issue.
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Description
|
||||||
|
description: Please give a clear and concise description of the feature request.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: additional
|
||||||
|
attributes:
|
||||||
|
label: Additional Info
|
||||||
|
description: Additional info you want to provide.
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
- type: checkboxes
|
||||||
|
id: terms
|
||||||
|
attributes:
|
||||||
|
label: Code of Conduct
|
||||||
|
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Ullaakut/cameradar/blob/main/CODE_OF_CONDUCT.md).
|
||||||
|
options:
|
||||||
|
- label: I agree to follow this project's Code of Conduct
|
||||||
|
required: true
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
# Contributor Covenant Code of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
We as members, contributors, and leaders pledge to make participation in our
|
||||||
|
community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||||
|
identity and expression, level of experience, education, socio-economic status,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity
|
||||||
|
and orientation.
|
||||||
|
|
||||||
|
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||||
|
diverse, inclusive, and healthy community.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to a positive environment for our
|
||||||
|
community include:
|
||||||
|
|
||||||
|
* Demonstrating empathy and kindness toward other people
|
||||||
|
* Being respectful of differing opinions, viewpoints, and experiences
|
||||||
|
* Giving and gracefully accepting constructive feedback
|
||||||
|
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||||
|
and learning from the experience
|
||||||
|
* Focusing on what is best not just for us as individuals, but for the
|
||||||
|
overall community
|
||||||
|
|
||||||
|
Examples of unacceptable behavior include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery, and sexual attention or
|
||||||
|
advances of any kind
|
||||||
|
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or email
|
||||||
|
address, without their explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
## Enforcement Responsibilities
|
||||||
|
|
||||||
|
Community leaders are responsible for clarifying and enforcing our standards of
|
||||||
|
acceptable behavior and will take appropriate and fair corrective action in
|
||||||
|
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||||
|
or harmful.
|
||||||
|
|
||||||
|
Community leaders have the right and responsibility to remove, edit, or reject
|
||||||
|
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||||
|
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||||
|
decisions when appropriate.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies within all community spaces, and also applies when
|
||||||
|
an individual is officially representing the community in public spaces.
|
||||||
|
Examples of representing our community include using an official e-mail address,
|
||||||
|
posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported to the community leaders responsible for enforcement at
|
||||||
|
`contact+cameradar@glaulabs.com`.
|
||||||
|
All complaints will be reviewed and investigated promptly and fairly.
|
||||||
|
|
||||||
|
All community leaders are obligated to respect the privacy and security of the
|
||||||
|
reporter of any incident.
|
||||||
|
|
||||||
|
## Enforcement Guidelines
|
||||||
|
|
||||||
|
Community leaders will follow these Community Impact Guidelines in determining
|
||||||
|
the consequences for any action they deem in violation of this Code of Conduct:
|
||||||
|
|
||||||
|
### 1. Correction
|
||||||
|
|
||||||
|
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||||
|
unprofessional or unwelcome in the community.
|
||||||
|
|
||||||
|
**Consequence**: A private, written warning from community leaders, providing
|
||||||
|
clarity around the nature of the violation and an explanation of why the
|
||||||
|
behavior was inappropriate. A public apology may be requested.
|
||||||
|
|
||||||
|
### 2. Warning
|
||||||
|
|
||||||
|
**Community Impact**: A violation through a single incident or series
|
||||||
|
of actions.
|
||||||
|
|
||||||
|
**Consequence**: A warning with consequences for continued behavior. No
|
||||||
|
interaction with the people involved, including unsolicited interaction with
|
||||||
|
those enforcing the Code of Conduct, for a specified period of time. This
|
||||||
|
includes avoiding interactions in community spaces as well as external channels
|
||||||
|
like social media. Violating these terms may lead to a temporary or
|
||||||
|
permanent ban.
|
||||||
|
|
||||||
|
### 3. Temporary Ban
|
||||||
|
|
||||||
|
**Community Impact**: A serious violation of community standards, including
|
||||||
|
sustained inappropriate behavior.
|
||||||
|
|
||||||
|
**Consequence**: A temporary ban from any sort of interaction or public
|
||||||
|
communication with the community for a specified period of time. No public or
|
||||||
|
private interaction with the people involved, including unsolicited interaction
|
||||||
|
with those enforcing the Code of Conduct, is allowed during this period.
|
||||||
|
Violating these terms may lead to a permanent ban.
|
||||||
|
|
||||||
|
### 4. Permanent Ban
|
||||||
|
|
||||||
|
**Community Impact**: Demonstrating a pattern of violation of community
|
||||||
|
standards, including sustained inappropriate behavior, harassment of an
|
||||||
|
individual, or aggression toward or disparagement of classes of individuals.
|
||||||
|
|
||||||
|
**Consequence**: A permanent ban from any sort of public interaction within
|
||||||
|
the community.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||||
|
version 2.0, available at
|
||||||
|
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||||
|
|
||||||
|
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||||
|
enforcement ladder](https://github.com/mozilla/diversity).
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
||||||
|
|
||||||
|
For answers to common questions about this code of conduct, see the FAQ at
|
||||||
|
https://www.contributor-covenant.org/faq. Translations are available at
|
||||||
|
https://www.contributor-covenant.org/translations.
|
||||||
+18
-4
@@ -121,11 +121,25 @@ func realMain() (code int) {
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
scanCommand := &cli.Command{
|
||||||
|
Name: "scan",
|
||||||
|
Usage: "Scan targets for RTSP streams",
|
||||||
|
Flags: flags,
|
||||||
|
Action: runCameradar,
|
||||||
|
}
|
||||||
|
|
||||||
app := &cli.Command{
|
app := &cli.Command{
|
||||||
Name: "Cameradar",
|
Name: "Cameradar",
|
||||||
Version: version,
|
Version: version,
|
||||||
Flags: flags,
|
DefaultCommand: scanCommand.Name,
|
||||||
Action: runCameradar,
|
Commands: []*cli.Command{
|
||||||
|
scanCommand,
|
||||||
|
{
|
||||||
|
Name: "version",
|
||||||
|
Usage: "Print version information",
|
||||||
|
Action: printVersion,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/Ullaakut/cameradar/v6/internal/ui"
|
||||||
|
"github.com/urfave/cli/v3"
|
||||||
|
)
|
||||||
|
|
||||||
|
func printVersion(ctx context.Context, _ *cli.Command) error {
|
||||||
|
buildInfo := ui.BuildInfo{Version: version, Commit: commit, Date: date}
|
||||||
|
nmapVersion := getNmapVersion(ctx)
|
||||||
|
_, err := fmt.Fprintf(
|
||||||
|
os.Stdout,
|
||||||
|
"Version:\t%s\nCommit:\t\t%s\nBuild date:\t%s\nNmap:\t\t%s\n",
|
||||||
|
buildInfo.DisplayVersion(),
|
||||||
|
buildInfo.ShortCommit(),
|
||||||
|
buildInfo.Date,
|
||||||
|
nmapVersion,
|
||||||
|
)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const unknownVersion = "unknown"
|
||||||
|
|
||||||
|
func getNmapVersion(ctx context.Context) string {
|
||||||
|
output, err := exec.CommandContext(ctx, "nmap", "--version").Output()
|
||||||
|
if err != nil {
|
||||||
|
return unknownVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
lines := strings.SplitN(string(output), "\n", 2)
|
||||||
|
firstLine := strings.TrimSpace(lines[0])
|
||||||
|
const prefix = "Nmap version "
|
||||||
|
if !strings.HasPrefix(firstLine, prefix) {
|
||||||
|
return unknownVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
versionPart := strings.TrimSpace(strings.TrimPrefix(firstLine, prefix))
|
||||||
|
fields := strings.Fields(versionPart)
|
||||||
|
if len(fields) == 0 {
|
||||||
|
return unknownVersion
|
||||||
|
}
|
||||||
|
return fields[0]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user