bcbc - China UnionPay Bank Card BIN Checker

repository·master·Indexed 41 days ago

https://github.com/hexindai/bcbc

A tool for identifying bank names, card types, and lengths from card numbers. It features a CLI for searching and generating random cards, an HTTP server providing a JSON API via the /cardInfo.json endpoint, and a Go package for integration. Current version: 0.0.16.

Tokens
1.4K
Snippets
12
Records
14
Agent score
50%

What's inside bcbc

  1. Install bcbc

    master

    You can install bcbc (China UnionPay Bank Card BIN Checker) using one of the following methods:

    1. Pre-built binaries: Download them directly from the GitHub Releases page.
    2. Go install: If you have Go installed, you can build and install it directly from the source code.
    go install github.com/hexindai/bcbc@latest
  2. Use bcbc in HTTP Server mode

    master

    You can run bcbc as an HTTP server to provide card information via an API. Use the serve command with the -p flag to specify the port.

    Once the server is running, you can query card information by making a GET request to the /cardInfo.json endpoint with the cardNo query parameter.

    # Start the server on port 3232
    $ bcbc serve -p :3232
    
    # Query card information via curl
    $ curl http://127.0.0.1:3232/cardInfo.json?cardNo=6222021234567890123
    
    # Response
    > {"bin":"622202","bank":"ICBC","name":"中国工商银行","type":"DC","length":19}
  3. Run the bcbc CLI tool

    master

    The bcbc tool is a command-line interface entrypoint. To use the tool, you execute the compiled binary. The application logic is managed by the cmd package, which handles command execution via cmd.Execute().

    # Assuming the binary is compiled and in your PATH
    bcbc --help
  4. Use bcbc in CLI mode

    master

    The CLI mode allows you to search for bank card information using a specific card number. Use the search command with the -c flag to provide the card number and the -o flag to specify the output format (e.g., json).

    To view the help menu and available commands, run bcbc -h.

    $ bcbc search -c 6222021234567890123 -o json
    
    > {"bin":"622202","bank":"ICBC","name":"中国工商银行","type":"DC","length":19}
  5. Configure the bcbc server port

    master

    You can specify the network address and port for the serve command using the --port or -p flag. The default value is :3232.

    Flags:
      -p, --port string   bcbc http server listening on port (default: ":3232")
  6. Use the bcbc CLI

    master

    The bcbc command-line interface is a China UnionPay Bank Card BIN Checker. You can execute the tool using the Execute() function from the cmd package, which triggers the root command.

    package main
    
    import "github.com/hexindai/hexindai/bcbc/cmd"
    
    func main() {
    	cmd.Execute()
    }
  7. Search bankcard info with the `search` command

    master

    The search command allows you to look up bankcard information using a specific card number. You can specify the output format as either text (default) or json.

    bcbc search --card <card_number> [--output <text|json>]
  8. Run the bcbc HTTP server with the serve command

    master

    The serve command starts an HTTP server that provides card information via a JSON endpoint. By default, the server listens on port :3232.

    When the server is running, you can request card information by making a request to the /cardInfo.json endpoint with a cardNo parameter. The server responds with a JSON payload containing the card details.

    bcbc serve --port :8080
    
    # Example request using curl:
    curl "http://localhost:3232/cardInfo.json?cardNo=1234567890123456"