{"id":15099177,"url":"https://github.com/0x30c4/ghostbin","last_synced_at":"2025-06-16T13:03:06.860Z","repository":{"id":229805386,"uuid":"777673554","full_name":"0x30c4/GhostBin","owner":"0x30c4","description":"GhostBin is a lightweight, high-performance pastebin built with Go and Redis. Designed with simplicity and speed in mind, GhostBin offers a fast and efficient platform for sharing text snippets effortlessly.","archived":false,"fork":false,"pushed_at":"2025-03-20T18:54:12.000Z","size":3211,"stargazers_count":26,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"v2.0","last_synced_at":"2025-03-28T10:47:38.202Z","etag":null,"topics":["curl","docker","docker-compose","go","golang","paste","pastebin","pastebin-service"],"latest_commit_sha":null,"homepage":"https://gbin.me","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0x30c4.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-26T09:54:40.000Z","updated_at":"2025-02-26T13:24:40.000Z","dependencies_parsed_at":"2024-03-26T11:25:40.967Z","dependency_job_id":"a289b13f-1bee-481f-9c02-050843e7007d","html_url":"https://github.com/0x30c4/GhostBin","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.0714285714285714,"last_synced_commit":"e465616cdde36c8aa229766141af14e5186f43ee"},"previous_names":["0x30c4/ghostbin"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x30c4%2FGhostBin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x30c4%2FGhostBin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x30c4%2FGhostBin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0x30c4%2FGhostBin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0x30c4","download_url":"https://codeload.github.com/0x30c4/GhostBin/tar.gz/refs/heads/v2.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248974483,"owners_count":21192152,"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":["curl","docker","docker-compose","go","golang","paste","pastebin","pastebin-service"],"created_at":"2024-09-25T17:07:07.736Z","updated_at":"2025-04-14T22:35:33.573Z","avatar_url":"https://github.com/0x30c4.png","language":"Go","funding_links":["https://liberapay.com/sanaf/donate"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eGhostBin\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./assets/logo.png\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/languages/top/0x30c4/GhostBin?style=flat-square\" alt=\"Test\"\u003e\n\u003c/p\u003e\n\u003cp align=\"justify\"\u003e\n  GhostBin is a lightweight, high-performance pastebin built with Go and Redis. Designed with simplicity and speed in mind, GhostBin offers a fast and efficient platform for sharing text snippets effortlessly.\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"mailto:support@gbin.me\"\u003e support@gbin.me \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\u003cimg src=\"./assets/ghostbindemo.gif\"\u003e\n\u003cbr\u003e\n\n## Table of Contents\n\n- [How To Use GhostBin](#how-to-use-ghostbin)\n  - [Command Line Cient](#cli-client)\n  - [Basic Usage](#basic-usage)\n  - [Pipe Output of a Command](#pipe-output-of-a-command)\n  - [Burn and Expire](#burn-and-expire)\n  - [Secure Deletion](#secure-deletion)\n  - [Example](#example)\n- [Deployment](#deployment)\n  - [Built With](#built-with)\n  - [Prerequisites](#prerequisites)\n  - [Docker Compose](#docker-compose)\n  - [Contributing](#contributing)\n  - [License](#license)\n- [Test](#test)\n  - [Test Coverage](#current-test-coverage)\n- [TODO](#todo)\n- [Contribution](#contribution)\n- [Donate](#donate)\n\n## How To Use GhostBin\n\n### Command Line Client\n\nYou can use this script to upload your pastes easily. \u003ca href=\"https://raw.githubusercontent.com/0x30c4/GhostBin/main/gbin.sh\"\u003e gbin.sh \u003c/a\u003e\n\n```bash\nUsage: gbin.sh [-f filename] [-e expire_seconds] [-r max_reads] [-d deepurl_length] [-s secret]\n  -f: The filename to upload. Use '-' to pipe output of a command.\n  -e: Expire time in seconds (default: no expiration).\n  -r: Maximum number of reads (default: unlimited).\n  -d: Length of the URL (default: random URL length).\n  -s: Secret for deletion (default: none).\n```\n\n```bash\n\n#!/bin/bash\n\n# Usage: ./ghostbin.sh [-f filename] [-e expire_seconds] [-r max_reads] [-d deepurl_length] [-s secret]\n\n# Default values\nEXPIRE=\"18446744073709551615\"  # No expiration by default\nREADS=\"0\"                      # No read limit by default\nDEEPURL=\"0\"                    # Default URL length\nSECRET=\"\"                      # No secret by default\nFILENAME=\"-\"                   # Default to pipe input\n\n# Function to display usage\nusage() {\n  echo \"Usage: $0 [-f filename] [-e expire_seconds] [-r max_reads] [-d deepurl_length] [-s secret]\"\n  echo \"  -f: The filename to upload. Use '-' to pipe output of a command.\"\n  echo \"  -e: Expire time in seconds (default: no expiration).\"\n  echo \"  -r: Maximum number of reads (default: unlimited).\"\n  echo \"  -d: Length of the URL (default: random URL length).\"\n  echo \"  -s: Secret for deletion (default: none).\"\n  exit 1\n}\n\n# Parse command-line arguments\nwhile getopts \"f:e:r:d:s:\" opt; do\n  case ${opt} in\n    f ) FILENAME=$OPTARG ;;\n    e ) EXPIRE=$OPTARG ;;\n    r ) READS=$OPTARG ;;\n    d ) DEEPURL=$OPTARG ;;\n    s ) SECRET=$OPTARG ;;\n    * ) usage ;;\n  esac\ndone\n\n# Check if filename is provided or input is piped\nif [ -z \"$FILENAME\" ] \u0026\u0026 [ -t 0 ]; then\n  usage\nfi\n\n# Build the curl command\nCURL_CMD=\"curl -F \\\"f=@${FILENAME}\\\"\"\n[ \"$EXPIRE\" != \"18446744073709551615\" ] \u0026\u0026 CURL_CMD+=\" -F \\\"expire=${EXPIRE}\\\"\"\n[ \"$READS\" != \"0\" ] \u0026\u0026 CURL_CMD+=\" -F \\\"read=${READS}\\\"\"\n[ \"$DEEPURL\" != \"0\" ] \u0026\u0026 CURL_CMD+=\" -F \\\"deepurl=${DEEPURL}\\\"\"\n[ -n \"$SECRET\" ] \u0026\u0026 CURL_CMD+=\" -F \\\"secret=${SECRET}\\\"\"\n\n# Append the GhostBin URL\nCURL_CMD+=\" gbin.me\"\n\n# Execute the curl command\nif [ \"$FILENAME\" == \"-\" ]; then\n  # Handle piped input\n  cat | eval $CURL_CMD\nelse\n  # Handle file input\n  eval $CURL_CMD\nfi\n```\n\n### Basic Usage\n\n```bash\n# Upload a file\n$ curl -F \"f=@filename.ext\" gbin.me\n```\n\n### Pipe Output of a Command\n\n```bash\n# Pipe output of a command\n$ cat file | curl -F \"f=@-\" gbin.me\n$ find /var/log/nginx -name \"*.log\" | curl -F \"f=@-\" gbin.me\n```\n\n### Burn and Expire\n\n```bash\n# Paste will expire after 69 seconds\n$ curl -F \"f=@filename.ext\" -F \"expire=69\" gbin.me\n\n# Paste will expire after 3 reads\n$ curl -F \"f=@filename.ext\" -F \"read=3\" gbin.me\n\n# Set a custom URL length\n$ curl -F \"f=@filename.ext\" -F \"deepurl=3\" gbin.me\n```\n\n### Secure Deletion\n\n```bash\n# Set a secret for deletion\n$ curl -F \"f=@filename.ext\" -F \"secret=password\" gbin.me\n\n# Delete paste using secret\n$ curl -XDELETE -F \"secret=password\" gbin.me/pasteid\n```\n\n### Example\n\n```bash\n# Create a paste with specific settings\n$ curl -F \"f=@filename.ext\" -F \"deepurl=12\" -F \"expire=69\" -F \"read=1\" gbin.me\n```\n\nFor more details and advanced usage, please refer to the [documentation](https://gbin.me).\n\n## Deployment\nWant to run a server like this? clone it! Remember centralization is bad.\n\n### Built With.\n\n* [Docker](https://www.docker.com) - Platform and Software Deployment\n* [Go](https://go.dev) - Backend Frame-work.\n* [Redis](https://redis.io/) - DataStore DataStore\n\n### Prerequisites.\n\nMake sure you have [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git), [make](https://tldp.org/HOWTO/Software-Building-HOWTO-3.html) and [Docker](https://www.docker.com/products/docker-desktop) installed.\n\n### Docker Compose\n\nGhostBin can be easily deployed using Docker Compose. Follow these steps to deploy GhostBin:\n\n1. **Clone Repository**: Clone the GhostBin repository to your server.\n\n2. **Configuration**: Duplicate the `env-example` file and rename it as `.env.dev` for local development or `.env.prod` for the production environment. Customize the contents of these files according to your requirements.\n\n3. **Build**: Build the Docker images for GhostBin using the provided Makefile command:\n\n    ```bash\n    make build\n    ```\n\n4. **Development Environment**:\n\n    ```bash\n    make up-dev\n    ```\n\n5. **Production Environment**:\n\n    ```bash\n    make up-prod\n    ```\n\n6. **Access Logs**:\n\n    To access logs, you can use:\n\n    ```bash\n    make logs\n    ```\n\n    To tail logs in real-time:\n\n    ```bash\n    make logs-tail\n    ```\n\n7. **Additional Commands**:\n\n    - `make down-dev` / `make down-prod`: Shutdown the development/production environment.\n    - `make restart-dev` / `make restart-prod`: Restart the development/production environment.\n    - `make exec-dev` / `make exec-prod`: Access the shell of the development/production container.\n\n## Test\nI am presently working on writing the unit tests. 🫠\n\n### Current Test Coverage\n\u003cimg src=\"./assets/testcover.svg\"\u003e\n\n## TODO\n  - Write test for handlers\n  - Write file delete daemon\n\n## Contributing\n\nContributions to GhostBin are welcome! If you find any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request on our [GitHub repository](https://github.com/0x30c4/GhostBin).\n\n## License\n\nGhostBin is licensed under the [BSD 3-Clause License](https://github.com/0x30c4/GhostBin/blob/main/LICENSE).\n\n\n## Contribution\nPull requests are welcome.\n\nFor major changes, please open an issue first to discuss what you would like to change.\n\n## Donate\nYou can support this project via Liberapay.\nThe monthly hosting cost is right now 12 Dollar.\n\u003cbr\u003e\n\u003ca target=\"_blank\" href=\"https://liberapay.com/sanaf/donate\"\u003e\u003cimg src=\"https://img.shields.io/liberapay/gives/1\"\u003e\u003c/a\u003e\n\nMonero wallet address: 83BDAy6tN99PVud2sUnjyoMzsUDdXJCoMjjwJ59cVwPF91RccxLWCVsfD9imMqxUaMhMG1brzuVBeAM4KREUSf9U9efbKx1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x30c4%2Fghostbin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0x30c4%2Fghostbin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0x30c4%2Fghostbin/lists"}