{"id":18482876,"url":"https://github.com/spaze/webleed","last_synced_at":"2025-05-13T20:24:56.225Z","repository":{"id":27373950,"uuid":"30849551","full_name":"spaze/webleed","owner":"spaze","description":"We Bleed scanner tools","archived":false,"fork":false,"pushed_at":"2016-04-07T20:17:23.000Z","size":57,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-25T13:41:34.696Z","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/spaze.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}},"created_at":"2015-02-16T01:40:03.000Z","updated_at":"2020-12-10T19:07:33.000Z","dependencies_parsed_at":"2022-08-31T22:22:22.236Z","dependency_job_id":null,"html_url":"https://github.com/spaze/webleed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spaze%2Fwebleed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spaze%2Fwebleed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spaze%2Fwebleed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spaze%2Fwebleed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spaze","download_url":"https://codeload.github.com/spaze/webleed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239199811,"owners_count":19598891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-06T12:31:36.390Z","updated_at":"2025-02-16T21:28:23.242Z","avatar_url":"https://github.com/spaze.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# We Bleed scanner tools\r\nhttps://heartbleed.michalspacek.cz/\r\n\r\nA bit about the project background: http://blog.testomato.com/michal-spacek-we-bleed/\r\n\r\nThe whole thing has two moving parts:\r\n\r\n1. The scanner\r\n2. The website (which is not moving much actually)\r\n\r\n## The scanner\r\nYou can run the back-end part (called the scanner) using the `scan.sh` script.\r\n\r\nThis is what it does:\r\n\r\n1. Download a list of IP ranges from RIPE\r\n2. Parse the list for IP addresses for given country (CZ in my case)\r\n3. For every port:\r\n  1. Run `masscan` to scan for open ports\r\n  2. Parse the result\r\n  3. Feed the parsed result to `ssltest.py` to scan for the Heartbleed vulnerability\r\n4. Parse the results\r\n5. Import the results\r\n6. Run a query to generate more queries\r\n7. Run those queries on the website database\r\n\r\n## The website\r\nDisplays just totals from the database, does not hold neither scan data nor list of vulnerable hosts.\r\nFeel free to copy https://heartbleed.michalspacek.cz/ if you wish (including the `highcharts-webleed.js` code), that's fine.\r\nI'll be happy for a link back to my site, but it's not required.\r\n\r\n## Setting it up\r\n1. Download and compile `masscan` from https://github.com/robertdavidgraham/masscan\r\n2. Clone `ssltest.py` from https://github.com/musalbas/heartbleed-masstest\r\n3. Copy `ip.template` to `ip`, edit it\r\n4. Load `database/scanner.sql` into a PostgreSQL database used for scan data\r\n5. Load `database/website.sql` into a MySQL database used for displaying the charts\r\n\r\n## Run it\r\n1. Run `scan.sh`\r\n  1. `masscan` displays how many hosts it's scanning (`Scanning 5534556 hosts`), copy the number and run `echo 5534556 \u003e data/total`\r\n2. Wait\r\n3. Run `parse.sh`\r\n4. Grab `data\u003cYYYY-MM-DD\u003e.tar.bz2`\r\n5. Extract it\r\n6. Import `data\u003cPORT\u003e.sql` into a PostgreSQL database\r\n7. Run `generate-query.py \u003ctable\u003e \u003cstart\u003e \u003cend\u003e`, where\r\n  1. `table` is the name of the table where to insert the data for the website, I use `webleed`\r\n  2. `start` is the date from `data\u003cYYYY-MM-DD\u003e.tar.bz2` archive\r\n  3. `end` is when the scanner has finished the latest scan\r\n8. Run the generated query on the PostgreSQL database\r\n9. Run the resulting queries (one rather complicated `INSERT INTO`) on the website database\r\n10. ...\r\n11. Profit!\r\n\r\n## List of files in the repository\r\n- `database/scanner.sql` - `CREATE TABLE` queries for scanner, for a PostgreSQL server\r\n- `database/website.sql` - `CREATE TABLE` for the website, for MySQL server\r\n- `resources/*` - icons and such\r\n- `cleanup.sh` - a cleanup script, deletes the logs and generated files, run after the data has been imported into the database\r\n- `exclude.txt` - excludes IP addresses, these networks do not like me\r\n- `generate-query.py` - generates a query which generates another query to be run on the MySQL database\r\n- `ip.template` - copy this to file called `ip` and add the IP address of your scanner, will be just inserted into the database for information purposes does not serve any other purpose\r\n- `parse.sh` - parse the scan results, generate `data*.sql` files\r\n- `parse-data.py` - parses data for one specific port, used by `parse.sh`\r\n- `parse-ripedb.py` - parser for RIPE data file\r\n- `README.md` - this file\r\n- `scan.sh` - downloads the RIPE data, parses it, runs the scanner, aka the glue\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspaze%2Fwebleed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspaze%2Fwebleed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspaze%2Fwebleed/lists"}