How akinerkisa/htlogin works
Project Type and Purpose
• HTLogin is an open-source, command-line tool (no frontend UI, no persistent server).
• It orchestrates multiple HTTP login attempts using injection payloads, default credentials, rate-limit checks, etc.
File Structure
• htlogin.py – the single entry-point script (contains CLI parsing, orchestration, modules).
• languages.json – configuration for multi-language success/failure keyword lists.
• requirements.txt – external libraries (e.g., requests, argparse or click).
• README.md – documentation.
• LICENSE – license information.
README for Architectural Insights
• CLI flags drive behavior (URL(s), credential list, rate limit, verbose, proxy, HTTP method).
• HTLogin uses four detection techniques: HTTP status code (302 redirect), cookies, keyword analysis, content-length comparison.
• Extensible via languages.json for adding more languages.
a. CLI Parser
– Reads and validates input flags/arguments.
b. Configuration Loader
– Loads default credential list, rate-limit, language keywords (languages.json).
c. Payload Generator
– Emits payloads for SQLi, NoSQLi, LDAP, XPath, default credentials.
d. HTTP Client
– Sends GET/POST requests (with optional proxy), applies rate limits.
e. Response Analyzer
– Four sub-modules:
1. Redirect Detector (302 status + Location header)
2. Cookie Inspector (session cookie patterns)
3. Keyword Scanner (success/failure words from languages.json)
4. Content Comparator (page length diff)
f. Result Aggregator & Reporter
– Collects pass/fail results, handles verbose mode, writes to console or output file.
g. External Systems
– Target web application (login endpoint)
– Optional credentials file, URL list file
Relationships & Data Flows
• The user invokes htlogin.py via the terminal → CLI Parser.
• CLI Parser → Configuration Loader (to fetch defaults & JSON keywords).
• CLI Parser → Orchestrator Loop over URLs (single or list).
• For each URL:
– Payload Generator → HTTP Client → receives HTTP Response → Response Analyzer → Result Aggregator.
• Result Aggregator → Output Writer (console/file).
Architectural Patterns & Principles
• Modular/Pipeline Pattern: each responsibility (parsing, loading, generating, analyzing, reporting) is isolated.
• Configuration-driven behavior (languages.json, credentials file).
• Single-threaded, sequential orchestration with rate-limit throttling.
Essential Elements
• Annotations on external libraries (e.g., Python “requests”, “argparse/click”).