{"id":23392972,"url":"https://github.com/binarynoir/noircon","last_synced_at":"2025-04-08T15:43:14.059Z","repository":{"id":268614415,"uuid":"888130414","full_name":"binarynoir/noircon","owner":"binarynoir","description":"Monitor specified websites or IP addresses to see if it is reachable. It supports various notification methods including Pushover and native desktop notifications.","archived":false,"fork":false,"pushed_at":"2025-01-01T22:07:38.000Z","size":91,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T12:16:09.788Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","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/binarynoir.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"buy_me_a_coffee":"binarynoir","ko_fi":"binarynoir"}},"created_at":"2024-11-13T21:40:23.000Z","updated_at":"2025-01-01T22:07:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2d7750a-8d17-467a-a520-d87a99f01e89","html_url":"https://github.com/binarynoir/noircon","commit_stats":null,"previous_names":["binarynoir/noircon"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarynoir%2Fnoircon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarynoir%2Fnoircon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarynoir%2Fnoircon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarynoir%2Fnoircon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binarynoir","download_url":"https://codeload.github.com/binarynoir/noircon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247873852,"owners_count":21010545,"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":[],"created_at":"2024-12-22T05:16:51.869Z","updated_at":"2025-04-08T15:43:14.041Z","avatar_url":"https://github.com/binarynoir.png","language":"Shell","readme":"# NoirCon\n\nNoirCon monitors various types of addresses (e.g., IP addresses, URLs) to check their availability and sends notifications. It supports various notification methods including Pushover and native desktop notifications.\n\n[![Support me on Buy Me a Coffee](https://img.shields.io/badge/Support%20me-Buy%20Me%20a%20Coffee-orange?style=for-the-badge\u0026logo=buy-me-a-coffee)](https://buymeacoffee.com/binarynoir)\n[![Support me on Ko-fi](https://img.shields.io/badge/Support%20me-Ko--fi-blue?style=for-the-badge\u0026logo=ko-fi)](https://ko-fi.com/binarynoir)\n[![Visit my website](https://img.shields.io/badge/Website-binarynoir.tech-8c8c8c?style=for-the-badge)](https://binarynoir.tech)\n\n## Features\n\n- Monitors addresses to see if they are available\n- Sends notifications via Pushover and native desktop notifications (macOS, Linux, Windows)\n- Configurable check intervals\n- Verbose logging with different log levels\n- Background execution support\n- Customizable configuration\n- Supports multiple address monitoring\n- Custom scripts on FAIL, PASS, RECOVERED, and UNKNOWN\n- Detailed error reporting\n\n## Requirements\n\n- Bash 4.0+\n- `curl` for network requests\n- `powershell` for Windows desktop notifications\n- `notify-send` for Linux desktop notifications\n\n## Installation\n\n### macOS Using Homebrew\n\n1. Tap the repository (if not already tapped):\n\n   ```bash\n   brew tap binarynoir/noircon\n   ```\n\n2. Install NoirCon:\n\n   ```bash\n   brew install noircon\n   ```\n\n### Manual Installation (Linux/macOS Only)\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/binarynoir/noircon.git\n   cd noircon\n   ```\n\n2. Make the script executable:\n\n   ```bash\n   chmod +x noircon\n   ```\n\n3. Install `notify-send` for desktop notifications (if not already installed) on Linux:\n\n   ```bash\n   # On Debian/Ubuntu-based systems\n   sudo apt install libnotify-bin\n\n   # On Fedora-based systems\n   sudo dnf install libnotify\n\n   # On Arch-based systems\n   sudo pacman -S libnotify\n   ```\n\n### Windows Installation\n\n1. Install [Git for Windows](https://gitforwindows.org/) (includes Git Bash, if not installed).\n\n2. Clone the repository:\n\n   ```bash\n   git clone https://github.com/binarynoir/noircon.git\n   cd noircon\n   ```\n\n3. Make the script executable (in Git Bash or similar terminal):\n\n   ```bash\n   chmod +x noircon\n   ```\n\n4. Ensure PowerShell is enabled in your Git Bash environment for notifications.\n\n### Installing the Man Page (Linux/macOS Only)\n\n1. Move the man file to the appropriate directory:\n\n   ```bash\n   sudo mv noircon.1 /usr/local/share/man/man1/\n   ```\n\n2. Update the man database:\n\n   ```bash\n   sudo mandb\n   ```\n\n3. View the man page:\n\n   ```bash\n   man noircon\n   ```\n\n## Setting Up as a Service\n\n### Linux\n\n1. Create a systemd service file:\n\n   ```bash\n   sudo nano /etc/systemd/system/noircon.service\n   ```\n\n2. Add the following content to the service file:\n\n   ```ini\n   [Unit]\n   Description=NoirCon Service\n   After=network.target\n\n   [Service]\n   ExecStart=/path/to/noircon --start\n   WorkingDirectory=/path/to\n   StandardOutput=syslog\n   StandardError=syslog\n   Restart=always\n   User=your-username\n\n   [Install]\n   WantedBy=multi-user.target\n   ```\n\n   Replace `/path/to/noircon` with the actual path to the `noircon` script and `your-username` with your actual username.\n\n3. Reload systemd to apply the new service:\n\n   ```bash\n   sudo systemctl daemon-reload\n   ```\n\n4. Enable the service to start on boot:\n\n   ```bash\n   sudo systemctl enable noircon\n   ```\n\n5. Start the service:\n\n   ```bash\n   sudo systemctl start noircon\n   ```\n\n6. Check the status of the service:\n\n   ```bash\n   sudo systemctl status noircon\n   ```\n\n### macOS\n\n1. Create a launchd plist file:\n\n   ```bash\n   sudo nano /Library/LaunchDaemons/com.noircon.plist\n   ```\n\n2. Add the following content to the plist file:\n\n   ```xml\n   \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n   \u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n   \u003cplist version=\"1.0\"\u003e\n   \u003cdict\u003e\n       \u003ckey\u003eLabel\u003c/key\u003e\n       \u003cstring\u003ecom.noircon\u003c/string\u003e\n       \u003ckey\u003eProgramArguments\u003c/key\u003e\n       \u003carray\u003e\n           \u003cstring\u003e/path/to/noircon\u003c/string\u003e\n           \u003cstring\u003e--start\u003c/string\u003e\n       \u003c/array\u003e\n       \u003ckey\u003eWorkingDirectory\u003c/key\u003e\n       \u003cstring\u003e/path/to\u003c/string\u003e\n       \u003ckey\u003eRunAtLoad\u003c/key\u003e\n       \u003ctrue/\u003e\n       \u003ckey\u003eKeepAlive\u003c/key\u003e\n       \u003ctrue/\u003e\n       \u003ckey\u003eStandardOutPath\u003c/key\u003e\n       \u003cstring\u003e/var/log/noircon.log\u003c/string\u003e\n       \u003ckey\u003eStandardErrorPath\u003c/key\u003e\n       \u003cstring\u003e/var/log/noircon.log\u003c/string\u003e\n   \u003c/dict\u003e\n   \u003c/plist\u003e\n   ```\n\n   Replace `/path/to/noircon` with the actual path to the `noircon` script.\n\n3. Load the plist file to start the service:\n\n   ```bash\n   sudo launchctl load /Library/LaunchDaemons/com.noircon.plist\n   ```\n\n4. Check the status of the service:\n\n   ```bash\n   sudo launchctl list | grep com.noircon\n   ```\n\n5. To unload the service:\n\n   ```bash\n   sudo launchctl unload /Library/LaunchDaemons/com.noircon.plist\n   ```\n\n### Setting Up NoirCon as a Service on Windows\n\n1. **Create a Task in Task Scheduler**:\n\n   - Open Task Scheduler and select \"Create Task\".\n   - In the \"General\" tab, name the task \"NoirCon\" and select \"Run whether user is logged on or not\".\n   - In the \"Triggers\" tab, click \"New\" and set the trigger to \"At startup\".\n   - In the \"Actions\" tab, click \"New\" and set the action to \"Start a program\".\n     - In the \"Program/script\" field, enter the path to `bash.exe` (usually located in `C:\\Program Files\\Git\\bin\\bash.exe` if using Git Bash).\n     - In the \"Add arguments (optional)\" field, enter the path to the `noircon` script and the `--start` argument, e.g., `/path/to/noircon --start`.\n   - In the \"Conditions\" tab, uncheck \"Start the task only if the computer is on AC power\" to ensure it runs on battery power as well.\n   - In the \"Settings\" tab, ensure \"Allow task to be run on demand\" is checked.\n\n2. **Save and Test the Task**:\n\n   - Click \"OK\" to save the task.\n   - To test the task, right-click on the \"NoirCon\" task in Task Scheduler and select \"Run\".\n\n3. **Verify the Task**:\n\n   - Check the status of the task in Task Scheduler to ensure it is running.\n   - Verify that NoirCon is running by checking the log file or the expected notifications.\n\n## Usage\n\nRun the script with the desired options. Below are some examples:\n\n- Start application with default settings:\n\n  ```bash\n  ./noircon\n  ```\n\n- Specify a custom configuration file:\n\n  ```bash\n  ./noircon --config /path/to/config\n  ```\n\n- Run the script in the background:\n\n  ```bash\n  ./noircon --start\n  ```\n\n- Send Pushover notifications:\n\n  ```bash\n  ./noircon --pushover --user-key YOUR_USER_KEY --api-token YOUR_API_TOKEN\n  ```\n\n## Configuration\n\nNoirCon uses a configuration file to store default settings. The default location is `~/.config/noircon.json`. You can initialize a configuration file with default settings using:\n\n```bash\n./noircon --init\n```\n\n### Example Configuration File\n\n```json\n{\n   \"configuration\": {\n      \"CACHE_DIR\": \"/tmp/noircon_cache\",\n      \"LOG_FILE\": \"/tmp/noircon_cache/noircon.log\",\n      \"CHECK_INTERVAL\": \"60s\",\n      \"TIMEOUT\": \"5s\",\n      \"SYSTEM_NAME\": \"test system\",\n      \"PUSHOVER_NOTIFICATION\": \"false\",\n      \"PUSHOVER_USER_KEY\": \"\",\n      \"PUSHOVER_API_TOKEN\": \"\",\n      \"DESKTOP_NOTIFICATION\": \"true\",\n      \"VERBOSE\": \"false\",\n      \"LOG_LEVEL\": \"INFO\"\n   },\n   \"connections\": {\n      \"default\": [\n         {\n            \"NAME\": \"Ping Test\",\n            \"TYPE\": \"PING\",\n            \"HOST\": \"1.1.1.1\",\n            \"TIMEOUT\": \"3s\",\n            \"PASS_CMD\": \"./test/test_cmd.sh\",\n            \"FAIL_CMD\": \"./test/test_cmd.sh\"\n         },\n         {\n            \"NAME\": \"HTTP/S Test\",\n            \"TYPE\": \"HTTP\",\n            \"URL\": \"google.com\",\n            \"TIMEOUT\": \"3s\"\n         },\n         {\n            \"NAME\": \"TCP Test\",\n            \"TYPE\": \"TCP\",\n            \"HOST\": \"www.example.com\",\n            \"PORT\": \"443\",\n            \"TIMEOUT\": \"5s\"\n         },\n         {\n            \"NAME\": \"UDP Test\",\n            \"TYPE\": \"UDP\",\n            \"HOST\": \"pool.ntp.org\",\n            \"PORT\": \"123\",\n            \"TIMEOUT\": \"15s\"\n         },\n         {\n            \"NAME\": \"Domain Expiry Test\",\n            \"TYPE\": \"DOMAIN\",\n            \"DOMAIN\": \"google.com\",\n            \"EXPIRY_DAYS\": \"200d\",\n            \"TIMEOUT\": \"15s\",\n            \"CHECK_FREQUENCY\": \"30d\"\n         },\n         {\n            \"NAME\": \"Cert Expiry Test\",\n            \"TYPE\": \"CERT\",\n            \"DOMAIN\": \"google.com\",\n            \"EXPIRY_DAYS\": \"30d\",\n            \"TIMEOUT\": \"20s\",\n            \"PASS_CMD\": \"./test/test_cmd.sh\",\n            \"FAIL_CMD\": \"./test/test_cmd.sh\",\n            \"RECOVERED_CMD\": \"./test/test_cmd.sh\",\n            \"CHECK_FREQUENCY\": \"30d\"\n         }\n      ]\n   }\n}\n```\n\n## Options\n\n### General Options\n\n- `-h, --help`: Display the help message.\n- `-V, --version`: Display the script version.\n\n### Configuration and Initialization\n\n- `-c, --config \u003cconfig_file\u003e`: Specify a custom configuration file.\n- `-i, --init`: Initialize the configuration file.\n- `-f, --force-init`: Force initialize the configuration file if one exists.\n- `-S, --show-config`: Show the configuration settings.\n- `-e, --show-config-file`: Show the configuration file.\n- `-E, --edit-config`: Edit the configuration file.\n\n### Cache Management\n\n- `-x, --clean`: Delete all cached files.\n- `-C, --cache-dir \u003cpath\u003e`: Specify a custom cache directory.\n\n### Notification Options\n\n- `-n, --system-name \u003cname\u003e`: Name of the system running the script.\n- `-p, --pushover`: Send Pushover notifications.\n- `-u, --user-key \u003ckey\u003e`: Specify the user key for Pushover notifications.\n- `-a, --api-token \u003ctoken\u003e`: Specify the API token for Pushover notifications.\n- `-d, --desktop`: Send desktop notifications using AppleScript.\n\n### Logging and Output\n\n- `-v, --verbose`: Enable verbose output.\n- `-l, --log`: Log the log file to the screen.\n- `-o, --output \u003cfile\u003e`: Specify a custom log file location.\n- `-L, --log-level \u003clevel\u003e`: Set the log level (FATAL, ERROR, WARN, INFO, DEBUG).\n\n### Remote Connection Configuration\n\n- `-I, --interval \u003cs,m,h,d\u003e`: Set the interval between checks (default: 60 seconds).\n- `-T, --timeout \u003cs,m,h,d\u003e`: Set the connection timeout for remote connections (default: 5 seconds).\n- `-N, --repeat \u003cnumber\u003e`: Repeat the checks in interactive mode N number of times and exit (default: 0).\n- `-Z, --list-connections`: List the current status of all remote connections.\n- `-H, --history`: Output a history of the connections to the screen.\n- `-F, --force`: Ignore the check frequency and check all connections.\n\n### Process Management\n\n- `-s, --start`: Start the NoirCon service in the background.\n- `-k, --stop`: Stop the NoirCon service.\n- `-r, --restart`: Restart the NoirCon service.\n- `-t, --status`: Check the current status of the NoirCon service.\n\n## Docker Deployment Instructions\n\nThis guide provides step-by-step instructions to deploy the NoirCon service using Docker.\n\n### Docker Prerequisites\n\nEnsure you have the following installed on your system:\n\n- Docker\n\n### Using the Dockerfile\n\nTo download the `Dockerfile` from the GitHub repository, run the following command:\n\n```sh\ncurl -O https://raw.githubusercontent.com/binarynoir/noircon/main/Dockerfile\n```\n\n### Build and Deploy\n\nNavigate to the directory containing the `Dockerfile` and run the following command to build and start the service:\n\n```sh\ndocker build -t noircon-image .\ndocker run -d --restart unless-stopped --name noircon noircon-image\n```\n\n### Conclusion\n\nYou have successfully deployed the NoirCon service using Docker. The service will automatically start when the container is created and will restart if it stops unexpectedly. For any further modifications or assistance, feel free to ask!\n\n## Instructions for Running the Tests\n\nThis document provides instructions for running the quality assurance tests for the NoirCon script using the `test.sh` file.\n\n### Testing Prerequisites\n\nEnsure you have the following installed on your system:\n\n- Bash\n- Git (for cloning the repository)\n\n### Steps to Run the Tests\n\n1. **Navigate to the Test Directory**:\n\n   ```bash\n   cd test\n   ```\n\n2. **Update the Test Configuration File**: Open the `test.json` file in your preferred text editor and ensure it contains the following configuration:\n\n   ```json\n   {\n      \"configuration\": {\n         \"CACHE_DIR\": \"./test/cache/\",\n         \"LOG_FILE\": \"./test/cache/test.log\",\n         \"CHECK_INTERVAL\": \"60s\",\n         \"TIMEOUT\": \"5s\",\n         \"SYSTEM_NAME\": \"test system\",\n         \"PUSHOVER_NOTIFICATION\": \"false\",\n         \"PUSHOVER_USER_KEY\": \"\",\n         \"PUSHOVER_API_TOKEN\": \"\",\n         \"DESKTOP_NOTIFICATION\": \"true\",\n         \"VERBOSE\": \"false\",\n         \"LOG_LEVEL\": \"INFO\"\n      },\n      \"connections\": {\n         \"default\": [\n            {\n               \"NAME\": \"Ping Test\",\n               \"TYPE\": \"PING\",\n               \"HOST\": \"1.1.1.1\",\n               \"TIMEOUT\": \"3s\",\n               \"PASS_CMD\": \"./test/test_cmd.sh\",\n               \"FAIL_CMD\": \"./test/test_cmd.sh\"\n            },\n            {\n               \"NAME\": \"HTTP/S Test\",\n               \"TYPE\": \"HTTP\",\n               \"URL\": \"google.com\",\n               \"TIMEOUT\": \"3s\"\n            },\n            {\n               \"NAME\": \"TCP Test\",\n               \"TYPE\": \"TCP\",\n               \"HOST\": \"www.example.com\",\n               \"PORT\": \"443\",\n               \"TIMEOUT\": \"5s\"\n            },\n            {\n               \"NAME\": \"UDP Test\",\n               \"TYPE\": \"UDP\",\n               \"HOST\": \"pool.ntp.org\",\n               \"PORT\": \"123\",\n               \"TIMEOUT\": \"15s\"\n            },\n            {\n               \"NAME\": \"Domain Expiry Test\",\n               \"TYPE\": \"DOMAIN\",\n               \"DOMAIN\": \"google.com\",\n               \"EXPIRY_DAYS\": \"200d\",\n               \"TIMEOUT\": \"15s\",\n               \"CHECK_FREQUENCY\": \"30d\"\n            },\n            {\n               \"NAME\": \"Cert Expiry Test\",\n               \"TYPE\": \"CERT\",\n               \"DOMAIN\": \"google.com\",\n               \"EXPIRY_DAYS\": \"30d\",\n               \"TIMEOUT\": \"20s\",\n               \"PASS_CMD\": \"./test/test_cmd.sh\",\n               \"FAIL_CMD\": \"./test/test_cmd.sh\",\n               \"RECOVERED_CMD\": \"./test/test_cmd.sh\",\n               \"CHECK_FREQUENCY\": \"30d\"\n            }\n         ]\n      }\n   }\n   ```\n\n3. **Make the test script executable**:\n\n   ```bash\n   chmod +x test.sh\n   ```\n\n4. **Run the Test Script with Default Configuration**:\n\n   ```bash\n   ./test.sh\n   ```\n\n5. **Run the Test Script with a Custom Configuration File**:\n\n   ```bash\n   ./test.sh /path/to/custom_config_file\n   ```\n\n6. **Clean Up Test Files (optional)**:\n\n   ```bash\n   rm -rf ./test_cache\n   rm -f ./test.log\n   ```\n\n### Summary\n\nThe `test.sh` script will:\n\n1. Create a test configuration file (default or custom).\n2. Run various tests to check the functionality of NoirCon, including configuration initialization, cache directory creation, log file creation, and availability monitoring.\n3. Clean up the test files and directories after the tests are completed, except for the custom configuration file if it was passed in.\n\nFollow these instructions to ensure that NoirCon is functioning correctly. If you encounter any issues, please open an issue or submit a pull request on the GitHub repository.\n\n## Releases\n\n### Releasing New Versions\n\n- Update the changelog with new features and fixes.\n- Commit all changed files and create a pull request.\n- Run the release script from the project repo's root directory:\n\n  ```bash\n  ./scripts/publish-release.md\n  ```\n\n### Manually Releasing New Versions\n\n- Create a new GitHub release using the new version number as the \"Tag version\". Use the exact version number and include a prefix `v`.\n- Publish the release.\n\n  ```bash\n  git checkout main\n  git pull\n  git tag -a v1.y.z -m \"v1.y.z\"\n  git push --tags\n  ```\n\nRun `shasum` on the release for homebrew distribution.\n\n```bash\nshasum -a 256 noircon-1.x.x.tar.gz\n```\n\nThe release will automatically be drafted.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.\n\n## Author\n\nJohn Smith III\n\n## Acknowledgments\n\nThanks to all contributors and users for their support and feedback.\n","funding_links":["https://buymeacoffee.com/binarynoir","https://ko-fi.com/binarynoir"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarynoir%2Fnoircon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinarynoir%2Fnoircon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarynoir%2Fnoircon/lists"}