commit e79a1490a9dff1c39685162cbfe0cb3393ed2aba Author: Marc Koch Date: Thu Aug 14 13:53:51 2025 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c49bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env diff --git a/General Info/All breaches.bru b/General Info/All breaches.bru new file mode 100644 index 0000000..772efc4 --- /dev/null +++ b/General Info/All breaches.bru @@ -0,0 +1,23 @@ +meta { + name: All breaches + type: http + seq: 2 +} + +get { + url: https://haveibeenpwned.com/api/v3/breaches + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting all breached sites in the system](https://haveibeenpwned.com/API/v3#AllBreaches) +} diff --git a/General Info/All dataclasses.bru b/General Info/All dataclasses.bru new file mode 100644 index 0000000..7ed1f10 --- /dev/null +++ b/General Info/All dataclasses.bru @@ -0,0 +1,23 @@ +meta { + name: All dataclasses + type: http + seq: 2 +} + +get { + url: https://haveibeenpwned.com/api/v3/dataclasses + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting all data classes](https://haveibeenpwned.com/API/v3#AllDataClasses) +} diff --git a/General Info/Latest breach.bru b/General Info/Latest breach.bru new file mode 100644 index 0000000..6b1cac4 --- /dev/null +++ b/General Info/Latest breach.bru @@ -0,0 +1,23 @@ +meta { + name: Latest breach + type: http + seq: 2 +} + +get { + url: https://haveibeenpwned.com/api/v3/latestbreach + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting the most recently added breach](https://haveibeenpwned.com/API/v3#MostRecentBreach) +} diff --git a/General Info/Single breach.bru b/General Info/Single breach.bru new file mode 100644 index 0000000..84bfa03 --- /dev/null +++ b/General Info/Single breach.bru @@ -0,0 +1,27 @@ +meta { + name: Single breach + type: http + seq: 2 +} + +get { + url: https://haveibeenpwned.com/api/v3/breach/{{breach_name}} + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +vars:pre-request { + breach_name: VerificationsIO +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting a single breached site by name](https://haveibeenpwned.com/API/v3#SingleBreach) +} diff --git a/General Info/folder.bru b/General Info/folder.bru new file mode 100644 index 0000000..9a22737 --- /dev/null +++ b/General Info/folder.bru @@ -0,0 +1,8 @@ +meta { + name: General Info + seq: 4 +} + +auth { + mode: inherit +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..ea027b9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2025 marc + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Our Breaches/All breaches for account.bru b/Our Breaches/All breaches for account.bru new file mode 100644 index 0000000..d001c6d --- /dev/null +++ b/Our Breaches/All breaches for account.bru @@ -0,0 +1,27 @@ +meta { + name: All breaches for account + type: http + seq: 1 +} + +get { + url: https://haveibeenpwned.com/api/v3/breachedaccount/{{account}} + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +vars:pre-request { + account: john.doe@example.org +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting all breaches for an account](https://haveibeenpwned.com/API/v3#BreachesForAccount) +} diff --git a/Our Breaches/All breaches for domain.bru b/Our Breaches/All breaches for domain.bru new file mode 100644 index 0000000..23143fa --- /dev/null +++ b/Our Breaches/All breaches for domain.bru @@ -0,0 +1,27 @@ +meta { + name: All breaches for domain + type: http + seq: 2 +} + +get { + url: https://haveibeenpwned.com/api/v3/breacheddomain/{{domain}} + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +vars:pre-request { + domain: example.org +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting all breached email addresses for a domain](https://haveibeenpwned.com/API/v3#BreachesForDomain) +} diff --git a/Our Breaches/All pastes for an account.bru b/Our Breaches/All pastes for an account.bru new file mode 100644 index 0000000..24d3e43 --- /dev/null +++ b/Our Breaches/All pastes for an account.bru @@ -0,0 +1,27 @@ +meta { + name: All pastes for an account + type: http + seq: 2 +} + +get { + url: https://haveibeenpwned.com/api/v3/pasteaccount/{{email}} + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +vars:pre-request { + email: john.doe@example.org +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting all pastes for an account](https://haveibeenpwned.com/API/v3#PastesForAccount) +} diff --git a/Our Breaches/All stealder log domains for an email address.bru b/Our Breaches/All stealder log domains for an email address.bru new file mode 100644 index 0000000..69c2a17 --- /dev/null +++ b/Our Breaches/All stealder log domains for an email address.bru @@ -0,0 +1,27 @@ +meta { + name: All stealder log domains for an email address + type: http + seq: 2 +} + +get { + url: https://haveibeenpwned.com/api/v3/stealerlogsbyemail/{{account}} + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +vars:pre-request { + account: john.doe@example.org +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting all stealer log domains for an email address](https://haveibeenpwned.com/API/v3#StealerLogsForEmail) +} diff --git a/Our Breaches/All stealder log email addresses for a website domain.bru b/Our Breaches/All stealder log email addresses for a website domain.bru new file mode 100644 index 0000000..332a123 --- /dev/null +++ b/Our Breaches/All stealder log email addresses for a website domain.bru @@ -0,0 +1,27 @@ +meta { + name: All stealder log email addresses for a website domain + type: http + seq: 2 +} + +get { + url: https://haveibeenpwned.com/api/v3/stealerlogsbywebsitedomain/{{domain}}?domain=example.org + body: none + auth: inherit +} + +params:query { + domain: example.org +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting all stealer log email addresses for a website domain](https://haveibeenpwned.com/API/v3#StealerLogsForWebsiteDomain) +} diff --git a/Our Breaches/All stealder log email addresses for an email domain.bru b/Our Breaches/All stealder log email addresses for an email domain.bru new file mode 100644 index 0000000..6403a7a --- /dev/null +++ b/Our Breaches/All stealder log email addresses for an email domain.bru @@ -0,0 +1,27 @@ +meta { + name: All stealder log email addresses for an email domain + type: http + seq: 2 +} + +get { + url: https://haveibeenpwned.com/api/v3/stealerlogsbyemaildomain/{{domain}} + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +vars:pre-request { + domain: example.org +} + +settings { + encodeUrl: true +} + +docs { + See: [Getting all stealer log email aliases for an email domain](https://haveibeenpwned.com/API/v3#StealerLogsForEmailDomain) +} diff --git a/Our Breaches/folder.bru b/Our Breaches/folder.bru new file mode 100644 index 0000000..317fc6a --- /dev/null +++ b/Our Breaches/folder.bru @@ -0,0 +1,8 @@ +meta { + name: Our Breaches + seq: 3 +} + +auth { + mode: inherit +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..8e026f5 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Bruno Collection for »Have I Been Pwned« + +A [Bruno](https://www.usebruno.com/) collection with requests for the **Have I Been Pawned** API. + +[Official API Documentation](https://haveibeenpwned.com/API/v3) diff --git a/Search password by range.bru b/Search password by range.bru new file mode 100644 index 0000000..22f8865 --- /dev/null +++ b/Search password by range.bru @@ -0,0 +1,65 @@ +meta { + name: Search password by range + type: http + seq: 2 +} + +get { + url: https://api.pwnedpasswords.com/range/{{password_hashed_prefix}} + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +vars:pre-request { + password: 123456 +} + +script:pre-request { + const CryptoJS = require('crypto-js'); + + const password = bru.interpolate("{{password}}"); + const password_hashed = CryptoJS.SHA1(password).toString().toUpperCase(); + const password_hashed_prefix = password_hashed.substring(0,5); + const password_hashed_suffix = password_hashed.substring(5); + + bru.setVar("password_hashed_prefix", password_hashed_prefix) + bru.setVar("password_hashed_suffix", password_hashed_suffix) +} + +script:post-response { + let data = res.getBody(); + + const suffix = bru.getVar("password_hashed_suffix") + const password = bru.interpolate("{{password}}"); + + const regex = new RegExp(`^(?${suffix}):(?\\d*)`, "m"); + + const match = data.match(regex) + + const result = match ? { + password: password, + found: true, + occurrences: Number(match.groups.occurrences) + } + : { + password: password, + found: false, + occurrences: 0 + }; + + res.setBody(JSON.stringify(result, null, 4)) // Bug: https://github.com/usebruno/bruno/issues/4748 +} + +settings { + encodeUrl: true +} + +docs { + **The password is not sent to the server!** It is hashed locally and part of the hash is sent to HIBP. + + See: [Searching by Range](https://haveibeenpwned.com/API/v3#SearchingPwnedPasswordsByRange) +} diff --git a/Subscription/All subscribed domains.bru b/Subscription/All subscribed domains.bru new file mode 100644 index 0000000..d69d6ec --- /dev/null +++ b/Subscription/All subscribed domains.bru @@ -0,0 +1,23 @@ +meta { + name: All subscribed domains + type: http + seq: 4 +} + +get { + url: https://haveibeenpwned.com/api/v3/subscribeddomains + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +settings { + encodeUrl: true +} + +docs { + [Getting all subscribed domains](https://haveibeenpwned.com/API/v3#SubscribedDomains) +} diff --git a/Subscription/Subscription status.bru b/Subscription/Subscription status.bru new file mode 100644 index 0000000..d914356 --- /dev/null +++ b/Subscription/Subscription status.bru @@ -0,0 +1,23 @@ +meta { + name: Subscription status + type: http + seq: 12 +} + +get { + url: https://haveibeenpwned.com/api/v3/subscription/status + body: none + auth: inherit +} + +headers { + hibp-api-key: {{hibp-api-key}} +} + +settings { + encodeUrl: true +} + +docs { + See: [Subscription](https://haveibeenpwned.com/API/v3#SubscriptionStatus) +} diff --git a/Subscription/folder.bru b/Subscription/folder.bru new file mode 100644 index 0000000..5f15901 --- /dev/null +++ b/Subscription/folder.bru @@ -0,0 +1,8 @@ +meta { + name: Subscription + seq: 5 +} + +auth { + mode: inherit +} diff --git a/bruno.json b/bruno.json new file mode 100644 index 0000000..6d0235f --- /dev/null +++ b/bruno.json @@ -0,0 +1,9 @@ +{ + "version": "1", + "name": "Have I Been Pwned", + "type": "collection", + "ignore": [ + "node_modules", + ".git" + ] +} \ No newline at end of file diff --git a/collection.bru b/collection.bru new file mode 100644 index 0000000..bc861ae --- /dev/null +++ b/collection.bru @@ -0,0 +1,5 @@ +docs { + A collection of requests for the **Have I Been Pawned** API. + + [Official API Documentation](https://haveibeenpwned.com/API/v3) +} diff --git a/environments/Have I Been Pwned.bru b/environments/Have I Been Pwned.bru new file mode 100644 index 0000000..7581d6e --- /dev/null +++ b/environments/Have I Been Pwned.bru @@ -0,0 +1,3 @@ +vars:secret [ + hibp-api-key +]