common-pw

command module
v0.0.0-...-e7dba7b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2017 License: MIT Imports: 3 Imported by: 0

README

Common Password Checker

common-pw is a go packge implementing a JSON API endpoint to check if a password is in the top X most commonly used. Data is used from Probable Word List

Usage

Installing

Clone repo git clone https://github.com/mtchavez/common-pw

Large Datasets

Download the data from the probable word list repository and place in the data directory. Currently Top32Million-probable.txt is not in version control because of size.

Server

Run the server on port 3000 with go run main.go. The password filters will build in the background and can take ~20 seconds to build. The time it took to build will be logged out.

Checking Passwords

Use cURL or something similar to post to /validate with a JSON body:

{
  "password": "the password to check"
}

Examples:

$ curl -s -XPOST -H "Content-Type: application/json" http://localhost:3000/validate --data '{"password": "iloveyou"}' | jq
{
  "status": "OK",
  "top196": "true",
  "top3575": "true",
  "top95k": "true"
}

$ curl -s -XPOST -H "Content-Type: application/json" http://localhost:3000/validate --data '{"password": "annabelle"}' | jq
{
  "status": "OK",
  "top196": "false",
  "top3575": "true",
  "top95k": "true"
}

$ curl -s -XPOST -H "Content-Type: application/json" http://localhost:3000/validate --data '{"password": "!@#$%^&*("}' | jq
{
  "status": "OK",
  "top196": "false",
  "top3575": "false",
  "top95k": "true"
}

$ curl -s -XPOST -H "Content-Type: application/json" http://localhost:3000/validate --data '{"password": "Portlandia"}' | jq
{
  "status": "OK",
  "top196": "false",
  "top3575": "false",
  "top95k": "false"
}

$ curl -s -XPOST -H "Content-Type: application/json" http://localhost:3000/validate --data '{"password": "Portlandia"}' | jq
{
  "status": "OK",
  "top196": "false",
  "top32m": "true",
  "top3575": "false",
  "top95k": "false"
}

A password is required

$ curl -s -XPOST -H "Content-Type: application/json" http://localhost:3000/validate --data '{}' | jq
{
  "error": "a password must be provided",
  "status": "failed"
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL