{"id":50609747,"url":"https://github.com/ail-project/favi-db","last_synced_at":"2026-06-06T02:30:32.560Z","repository":{"id":357984407,"uuid":"1238498548","full_name":"ail-project/favi-db","owner":"ail-project","description":"favi-db stores favicon metadata and hash values in a Redis-compatible backend.","archived":false,"fork":false,"pushed_at":"2026-05-15T05:36:07.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-15T06:43:32.669Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ail-project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-14T07:10:18.000Z","updated_at":"2026-05-15T05:36:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ail-project/favi-db","commit_stats":null,"previous_names":["ail-project/favi-db"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/ail-project/favi-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ail-project%2Ffavi-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ail-project%2Ffavi-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ail-project%2Ffavi-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ail-project%2Ffavi-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ail-project","download_url":"https://codeload.github.com/ail-project/favi-db/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ail-project%2Ffavi-db/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33967639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-06T02:00:07.033Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-06T02:30:31.569Z","updated_at":"2026-06-06T02:30:32.555Z","avatar_url":"https://github.com/ail-project.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# favi-db - a favicon-registry\n\nA small Flask service that stores favicon metadata and hash values in a Valkey-compatible backend (also works with Redis and Kvrocks).\n\nThe project is intentionally structured as a basis for a larger system:\n\n- no original favicon file is persisted;\n- hash-centric storage keyed by `sha256`;\n- set-based indexes for hash values, hosts, URLs, and tags;\n- MurmurHash3 favicon hash support using the Shodan-style base64 convention;\n- a companion CLI that discovers favicons, computes hashes locally, and submits metadata via the API.\n\n## Layout\n\n```text\napp/\n  __init__.py             Flask application factory\n  api/routes.py           HTTP API\n  redis_client.py         request-scoped backend client\n  services/hashing.py     favicon hash calculation\n  services/store.py       backend storage and indexes\ntools/favicon_fetch.py    companion discovery/submission CLI\ntests/                    pytest tests\n```\n\n## Run locally\n\n```bash\npython -m venv .venv\n. .venv/bin/activate\npip install -r requirements-dev.txt\n\n# Start Valkey-compatible backend (Valkey, Kvrocks, Redis, DragonflyDB)\nvalkey-server\n\nexport REDIS_URL=redis://localhost:6379/0\n# optional alias (takes precedence when set)\n# export VALKEY_URL=redis://localhost:6379/0\nexport API_TOKEN=change-me\nflask --app app.wsgi:app run --debug\n```\n\n## API\n\nFull endpoint reference: [`docs/API.md`](docs/API.md).\n\nOpenAPI/Swagger:\n\n- OpenAPI JSON: `GET /api/v1/openapi.json`\n- Swagger UI: `GET /api/v1/docs`\n\n\n### Health\n\n```bash\ncurl http://127.0.0.1:5000/api/v1/health\n```\n\n### Add favicon metadata\n\nThe recommended path is to calculate hashes on the client side and submit only metadata and hashes.\n\n```bash\ncurl -X POST http://127.0.0.1:5000/api/v1/favicons \\\n  -H 'Authorization: Bearer change-me' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"host\": \"example.org\",\n    \"url\": \"https://example.org/favicon.ico\",\n    \"hashes\": {\n      \"sha256\": \"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef\",\n      \"sha1\": \"dummy\",\n      \"md5\": \"dummy\",\n      \"mmh3\": \"-123456789\"\n    },\n    \"metadata\": {\n      \"content_type\": \"image/x-icon\",\n      \"size\": 1150,\n      \"http_status\": 200\n    },\n    \"tags\": [\"seed\"]\n  }'\n```\n\nFor convenience during prototyping, the API also accepts `favicon_base64`. The server computes hashes and discards the bytes; it still does not persist the original file.\n\n### Get by SHA-256\n\n```bash\ncurl http://127.0.0.1:5000/api/v1/favicons/\u003csha256\u003e\n```\n\n### Search\n\n```bash\n# Search by Shodan-style mmh3 favicon hash\ncurl 'http://127.0.0.1:5000/api/v1/search?algo=mmh3\u0026value=-123456789'\n\n# Search by alias\ncurl 'http://127.0.0.1:5000/api/v1/search?algo=murmur3\u0026value=-123456789'\n\n# Search by host\ncurl 'http://127.0.0.1:5000/api/v1/search?host=example.org'\n\n# Search by tag\ncurl 'http://127.0.0.1:5000/api/v1/search?tag=seed'\n```\n\n## Companion CLI\n\n```bash\npython -m tools.favicon_fetch https://example.org \\\n  --api http://127.0.0.1:5000/api/v1 \\\n  --token change-me \\\n  --tag example \\\n  --first\n```\n\nDry-run mode prints the payload without calling the API:\n\n```bash\npython -m tools.favicon_fetch https://example.org --dry-run --first\n```\n\nOptional brute-force discovery with a wordlist:\n\n```bash\npython -m tools.favicon_fetch https://example.org \\\n  --wordlist favicon-paths.txt \\\n  --api http://127.0.0.1:5000/api/v1 \\\n  --token change-me\n```\n\n## Valkey/Kvrocks data model\n\nCanonical record:\n\n```text\nfavicon:\u003csha256\u003e -\u003e JSON\n```\n\nAssociated sets and indexes:\n\n```text\nfavicons                          set of sha256 values\nfavicon:\u003csha256\u003e:hosts            set of hosts where observed\nfavicon:\u003csha256\u003e:urls             set of favicon URLs where observed\nfavicon:\u003csha256\u003e:tags             set of labels\nfavicon:\u003csha256\u003e:observations     capped list of last 100 observations\nidx:hash:\u003calgo\u003e:\u003cvalue\u003e           set of sha256 values\nidx:host:\u003chost\u003e                   set of sha256 values\nidx:url:\u003csha256(url)\u003e             set of sha256 values\nidx:tag:\u003ctag\u003e                     set of sha256 values\nurl:\u003csha256(url)\u003e                 original URL string for reverse lookup/debugging\n```\n\n## Notes for later expansion\n\nGood next additions would be:\n\n- stricter JSON schema validation;\n- API pagination;\n- authentication/authorization beyond one write token;\n- enrichment jobs for TLS certificate, HTTP headers, screenshots, ASN, and passive DNS metadata;\n- deduplication policies when multiple hosts share one favicon;\n- background task queue for large scans;\n- export endpoints for MISP objects or other threat-intel formats.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fail-project%2Ffavi-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fail-project%2Ffavi-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fail-project%2Ffavi-db/lists"}