Skip to content

mtchavez/common-pw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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"
}

Releases

No releases published

Packages

No packages published

Languages