Metadata-Version: 2.4
Name: sosmed-scanner
Version: 0.4.0
Summary: Check whether a username exists on public profile pages - 20 platforms, zero dependencies (Python standard library only).
Author: Nuzuli
License: MIT
Project-URL: Homepage, https://github.com/Nuzuli/sosmed-scanner
Project-URL: Repository, https://github.com/Nuzuli/sosmed-scanner
Keywords: username-checker,osint,cli,social-media
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Internet
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Sosmed Scanner



![CI](https://github.com/Nuzuli/sosmed-scanner/actions/workflows/ci.yml/badge.svg)

![Demo](demo.gif)



A small Python command-line tool that checks whether a username exists on public profile pages. It uses only the standard library and reads public information only.

## Project Type

This is a standard library only command-line tool, not infrastructure code.

## Features

- Checks 20 platforms: GitHub, GitLab, Reddit, Medium, DEV, PyPI, YouTube, Mastodon, Tumblr, Flickr, SoundCloud, Dribbble, Linktree, Gravatar, Codeberg, SourceHut, Keybase, Chess.com, Docker Hub, and Hugging Face.
- Three clear statuses: `found`, `not_found`, and `unknown` (for blocked or failed requests).
- Plain text, JSON, or CSV output.
- Polite by default: sends a descriptive User-Agent, uses a timeout, and waits between requests.
- Optional debug logging with `--verbose`.
- No third-party runtime dependencies.

## Architecture

- `sosmed_scanner/network.py`: HTTP request helper. Network errors are returned as data, never raised.
- `sosmed_scanner/scanner.py`: platform list, username validation, and the scan loop.
- `sosmed_scanner/cli.py`: argument parsing, logging setup, and output formatting.
- `tests/`: unit and integration tests that use mocks, so no real network access is needed.

### Quick Start (fresh clone)

The tool itself runs on Python 3.8 or newer and has no dependencies. The development toolchain (tests, lint, type checks) is pinned for Python 3.12, which is what CI uses.

```bash
git clone https://github.com/Nuzuli/sosmed-scanner.git
cd sosmed-scanner
python -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.lock
pytest
```

On Windows, activate the environment with `.venv\Scripts\activate`.

`requirements-dev.lock` is committed to the repository and checked by CI, so every install uses the same pinned versions. After changing `requirements-dev.txt`, regenerate the lockfile by running the "Update lockfile" workflow in the Actions tab; CI fails if the two files disagree.

## Usage

Run from the repository root:

`python -m sosmed_scanner.cli target_username`

Options:

- `-p`, `--platform NAME`: scan only this platform (repeatable), for example `-p github -p dev`
- `--json`: print results as JSON
- `--csv`: print results as CSV (columns: platform, status, url, detail)
- `--delay SECONDS`: pause between requests (default `0.5`)
- `-v`, `--verbose`: print debug details to stderr

Example output:

```
GitHub     found      https://github.com/alice
GitLab     not_found  https://gitlab.com/alice
Reddit     unknown    https://www.reddit.com/user/alice  (HTTP 429)
```
## Logging

Diagnostic messages are emitted at DEBUG level as one JSON object per record. Every record has an `event` key plus event-specific fields, for example:

```json
{"event": "fetch_done", "status": 200, "url": "https://github.com/octocat"}
```

Events: `scan_start`, `platform_result`, `scan_done`, `fetch_start`, `fetch_done`, `fetch_failed`.

## Exit Codes

- `0`: scan finished
- `2`: invalid input (bad username or unknown platform)

## Understanding Results

- `found`: the profile page returned HTTP 200.
- `not_found`: the profile page returned HTTP 404.
- `unknown`: anything else, such as rate limiting, blocking, or a network error. The `detail` field explains why.

## Development

Run the checks locally:

```
ruff check sosmed_scanner tests
mypy sosmed_scanner
pytest -v --cov=sosmed_scanner --cov-fail-under=80
```

The same checks, plus a dependency audit, run on every push through GitHub Actions.

## Responsible Use

Use this tool only for lawful purposes, such as checking your own username or brand. It reads public pages only. Respect each platform's terms of service and do not use it for harassment or profiling people.

## License

MIT License. See `LICENSE`.
