Skip to main content

CogPIE: Cognitive Pattern Inference Engine

A hybrid multi-layer password generation engine that exploits cognitive biases in human password creation. CogPIE combines semantic expansion, cognitive transforms, Markov+PCFG hybrid ranking, entropy scoring, and policy filtering to predict PII-derived passwords with high accuracy.

Architecture

CogPIE implements a 5-layer pipeline:

  1. Semantic Expander: Generates base candidates from profile data (names, dates, keywords, pets, companies)
  2. Cognitive Transforms: Applies psychologically-motivated transformations (leetspeak, case variations, suffix patterns, anchoring bias)
  3. Markov+PCFG Hybrid Ranker: Scores candidates using a trained character-level Markov model combined with PCFG structural templates
  4. Entropy Scorer: Filters and re-ranks based on entropy thresholds
  5. Policy Filter: Applies password policy constraints (length, complexity requirements)

Key Results

Corpus Training Size Coverage (hit@10K) hit@1K MRR Median Rank
RockYou (standalone) 1M 75.95% 75.95% 0.137 35
Brazilian (wlist_brasil + melissa) 13.1M 99.50% 66.45% 0.003 618
Medium (5 sources) 41M 98.70% 92.75% 0.030 179
RockYou (comparative) 1M 50.15% 30.20% 0.001 N/A

Comparative Analysis (2,000 targets, 1M training)

Algorithm hit@100 hit@1K Coverage MRR
CogPIE 1.70% 30.20% 50.15% 0.0013
CUPP-style 45.60% 47.55% 47.55% 0.0308
Markov-3 1.85% 4.20% 4.80% 0.0015

CogPIE surpasses CUPP at budget >= 1,000 guesses. Markov collapses catastrophically at scale (28.5% -> 4.8%).

GPU Acceleration

CUDA backend with 20x speedup on RTX 4060 (1M corpus):

  • CPU: 15.12s/profile
  • GPU: 0.75s/profile (174 MB VRAM)

Installation

pip install cogpie

For GPU acceleration (CUDA):

pip install cogpie[gpu]

CLI

cogpie --profile target.json --corpus rockyou.txt --max 50000 -o candidates.txt

Usage

from cogpie.engine import CogPIEEngine

engine = CogPIEEngine(use_gpu=True)

# Train on a password corpus
with open("corpus.txt") as f:
    for line in f:
        engine.ranker.train(line.strip())

# Generate candidates for a profile
profile = {
    "names": ["joao"],
    "dates": ["1990", "0315"],
    "keywords": ["flamengo"],
    "pets": ["rex"],
    "companies": ["acme"],
    "phones": [],
    "emails": ["joao@example.com"],
    "old_passwords": ["joao123"],
    "numbers": ["42"],
}
candidates = engine.generate(profile, max_candidates=10000)
for password, score in candidates[:10]:
    print(f"{password}: {score:.4f}")

Research Paper

The full academic paper is available in docs/research/cogpie-paper/:

  • English: cogpie-paper.md / cogpie-paper.html
  • Portuguese (BR): cogpie-paper-pt-br.md / cogpie-paper-pt-br.html

42 references, MITRE ATT&CK/CWE/OWASP/NIST D3FEND mappings, 55 unit tests as experimental evidence.

Requirements

  • Python >= 3.10
  • PyTorch >= 2.0 (optional, for GPU acceleration)
  • CUDA-capable GPU (optional, falls back to CPU)

Author

Andre Henrique de Oliveira (@mrhenrike) / Uniao Geek

License

MIT License. See LICENSE for details.

Metadata

Release files for cogpie 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cogpie 0.2.0
File Size Uploaded Provenance
cogpie-0.2.0.tar.gz 34.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cogpie 0.2.0
File Interpreter ABI Platform
cogpie-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 72.8 kB

Release files / cogpie-0.2.0.tar.gz

Download URL cogpie-0.2.0.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
62e0c481396e5113c616cecc615fdeb9da9c539292d0b092bbba000c92bce49e
BLAKE2b-256 checksum
How to use checksums
011154b3608c1b060774d7f8685e4af9e7458c4493d395211649287495b57e74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / cogpie-0.2.0-py3-none-any.whl

Download URL cogpie-0.2.0-py3-none-any.whl
Size 38.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ba0ade16428d640d5cc267ffe4769bda9f5d8eee34c732852e1dcc71ef544ba
BLAKE2b-256 checksum
How to use checksums
4de6ac397874e3e1c2ba7ccdcf2723263a5459b41ba7b46ccc9ffe3284dd1587
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Security for cogpie 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page