httpprobe-axx 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Богдан
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: httpprobe-axx
3
+ Version: 0.1.0
4
+ Summary: Учебный HTTP-клиент для white-hat: запросы и анализ заголовков безопасности
5
+ Author: Богдан
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://pypi.org/project/httpprobe-axx/
8
+ Keywords: http,security,whitehat,education
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Intended Audience :: Education
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests>=2.31
16
+ Dynamic: license-file
17
+
18
+ # httpprobe-axx
19
+
20
+ Учебный HTTP-клиент для white-hat: запросы и анализ заголовков безопасности.
21
+
22
+ ⚠️ **Только для своих сайтов или с разрешения владельца.**
23
+ Это образовательный проект, а не инструмент для атак.
24
+
25
+ ## Установка
26
+
27
+ pip install httpprobe-axx
28
+
29
+ ## Что умеет
30
+
31
+ - `get(url)` — GET-запрос
32
+ - `head(url)` — только заголовки
33
+ - `status(url)` — код ответа (200, 404, ...)
34
+ - `is_alive(url)` — отвечает ли сайт
35
+ - `security_headers(url)` — какие защитные заголовки есть
36
+ - `check_https(url)` — использует ли сайт HTTPS
37
+ - `report(url)` — красивый текстовый отчёт
38
+
39
+ ## Пример
40
+
41
+ import httpprobe_axx as h
42
+
43
+ print(h.is_alive("https://example.com")) # True
44
+ print(h.report("https://github.com"))
45
+
46
+ Пример вывода:
47
+
48
+ === Отчёт по https://github.com ===
49
+
50
+ HTTPS: ✅ да
51
+ Итоговый URL: https://github.com/
52
+ Статус: 200
53
+ Ответ за: 280 мс
54
+
55
+ Заголовки безопасности:
56
+ ✅ Strict-Transport-Security
57
+ ✅ Content-Security-Policy
58
+ ✅ X-Frame-Options
59
+ ✅ X-Content-Type-Options
60
+ ✅ Referrer-Policy
61
+ ❌ Permissions-Policy
62
+ → Ограничение API браузера
63
+
64
+ Итог: 5/6 защитных заголовков присутствуют
65
+
66
+ ## Какие заголовки проверяются
67
+
68
+ | Заголовок | Зачем |
69
+ |---|---|
70
+ | Strict-Transport-Security | Заставляет браузер использовать HTTPS |
71
+ | Content-Security-Policy | Защита от XSS и инъекций |
72
+ | X-Frame-Options | Защита от clickjacking |
73
+ | X-Content-Type-Options | Запрет MIME-sniffing |
74
+ | Referrer-Policy | Контроль утечки referrer |
75
+ | Permissions-Policy | Ограничение API браузера |
76
+
77
+ ## Обработка ошибок
78
+
79
+ import httpprobe_axx as h
80
+
81
+ try:
82
+ r = h.get("https://несуществующий-сайт.рф")
83
+ except h.ProbeError as e:
84
+ print("Не получилось:", e)
85
+
86
+ ## Лицензия
87
+
88
+ MIT — делай что хочешь, только укажи автора.
89
+
90
+ Автор: Богдан, 12 лет.
@@ -0,0 +1,73 @@
1
+ # httpprobe-axx
2
+
3
+ Учебный HTTP-клиент для white-hat: запросы и анализ заголовков безопасности.
4
+
5
+ ⚠️ **Только для своих сайтов или с разрешения владельца.**
6
+ Это образовательный проект, а не инструмент для атак.
7
+
8
+ ## Установка
9
+
10
+ pip install httpprobe-axx
11
+
12
+ ## Что умеет
13
+
14
+ - `get(url)` — GET-запрос
15
+ - `head(url)` — только заголовки
16
+ - `status(url)` — код ответа (200, 404, ...)
17
+ - `is_alive(url)` — отвечает ли сайт
18
+ - `security_headers(url)` — какие защитные заголовки есть
19
+ - `check_https(url)` — использует ли сайт HTTPS
20
+ - `report(url)` — красивый текстовый отчёт
21
+
22
+ ## Пример
23
+
24
+ import httpprobe_axx as h
25
+
26
+ print(h.is_alive("https://example.com")) # True
27
+ print(h.report("https://github.com"))
28
+
29
+ Пример вывода:
30
+
31
+ === Отчёт по https://github.com ===
32
+
33
+ HTTPS: ✅ да
34
+ Итоговый URL: https://github.com/
35
+ Статус: 200
36
+ Ответ за: 280 мс
37
+
38
+ Заголовки безопасности:
39
+ ✅ Strict-Transport-Security
40
+ ✅ Content-Security-Policy
41
+ ✅ X-Frame-Options
42
+ ✅ X-Content-Type-Options
43
+ ✅ Referrer-Policy
44
+ ❌ Permissions-Policy
45
+ → Ограничение API браузера
46
+
47
+ Итог: 5/6 защитных заголовков присутствуют
48
+
49
+ ## Какие заголовки проверяются
50
+
51
+ | Заголовок | Зачем |
52
+ |---|---|
53
+ | Strict-Transport-Security | Заставляет браузер использовать HTTPS |
54
+ | Content-Security-Policy | Защита от XSS и инъекций |
55
+ | X-Frame-Options | Защита от clickjacking |
56
+ | X-Content-Type-Options | Запрет MIME-sniffing |
57
+ | Referrer-Policy | Контроль утечки referrer |
58
+ | Permissions-Policy | Ограничение API браузера |
59
+
60
+ ## Обработка ошибок
61
+
62
+ import httpprobe_axx as h
63
+
64
+ try:
65
+ r = h.get("https://несуществующий-сайт.рф")
66
+ except h.ProbeError as e:
67
+ print("Не получилось:", e)
68
+
69
+ ## Лицензия
70
+
71
+ MIT — делай что хочешь, только укажи автора.
72
+
73
+ Автор: Богдан, 12 лет.
@@ -0,0 +1,9 @@
1
+ """httpprobe-axx — учебный HTTP-клиент для white-hat."""
2
+ from .client import get, head, status, is_alive, Response, ProbeError
3
+ from .analyze import security_headers, check_https, report
4
+
5
+ __version__ = "0.1.0"
6
+ __all__ = [
7
+ "get", "head", "status", "is_alive", "Response", "ProbeError",
8
+ "security_headers", "check_https", "report",
9
+ ]
@@ -0,0 +1,75 @@
1
+ """Анализ заголовков безопасности — фишка white-hat."""
2
+ from __future__ import annotations
3
+ from .client import head, ProbeError
4
+
5
+ SECURITY_HEADERS = {
6
+ "Strict-Transport-Security": "Заставляет браузер использовать HTTPS",
7
+ "Content-Security-Policy": "Защита от XSS и инъекций",
8
+ "X-Frame-Options": "Защита от clickjacking",
9
+ "X-Content-Type-Options": "Запрет MIME-sniffing",
10
+ "Referrer-Policy": "Контроль утечки referrer",
11
+ "Permissions-Policy": "Ограничение API браузера",
12
+ }
13
+
14
+
15
+ def security_headers(url: str) -> dict:
16
+ """Проверить, какие защитные заголовки есть, а каких нет."""
17
+ r = head(url)
18
+ return _analyze_headers(r.headers)
19
+
20
+
21
+ def _analyze_headers(headers: dict) -> dict:
22
+ result = {}
23
+ for name, purpose in SECURITY_HEADERS.items():
24
+ value = next((v for k, v in headers.items() if k.lower() == name.lower()), None)
25
+ result[name] = {"present": value is not None, "value": value, "purpose": purpose}
26
+ return result
27
+
28
+
29
+ def check_https(url: str) -> dict:
30
+ """Использует ли сайт HTTPS."""
31
+ if not url.startswith(("http://", "https://")):
32
+ url = "https://" + url
33
+ r = head(url)
34
+ return {
35
+ "requested": url,
36
+ "final_url": r.url,
37
+ "uses_https": r.url.startswith("https://"),
38
+ "status": r.status,
39
+ }
40
+
41
+
42
+ def report(url: str) -> str:
43
+ """Красивый текстовый отчёт. Делает ОДИН запрос."""
44
+ if not url.startswith(("http://", "https://")):
45
+ url = "https://" + url
46
+
47
+ lines = [f"=== Отчёт по {url} ===", ""]
48
+
49
+ try:
50
+ r = head(url)
51
+ except ProbeError as e:
52
+ lines.append(f"❌ Не удалось подключиться: {e}")
53
+ return "\n".join(lines)
54
+
55
+ uses_https = r.url.startswith("https://")
56
+ lines.append(f"HTTPS: {'✅ да' if uses_https else '❌ нет'}")
57
+ lines.append(f"Итоговый URL: {r.url}")
58
+ lines.append(f"Статус: {r.status}")
59
+ lines.append(f"Ответ за: {r.elapsed_ms:.0f} мс")
60
+ lines.append("")
61
+ lines.append("Заголовки безопасности:")
62
+
63
+ found = 0
64
+ total = len(SECURITY_HEADERS)
65
+ for name, data in _analyze_headers(r.headers).items():
66
+ mark = "✅" if data["present"] else "❌"
67
+ if data["present"]:
68
+ found += 1
69
+ lines.append(f" {mark} {name}")
70
+ if not data["present"]:
71
+ lines.append(f" → {data['purpose']}")
72
+
73
+ lines.append("")
74
+ lines.append(f"Итог: {found}/{total} защитных заголовков присутствуют")
75
+ return "\n".join(lines)
@@ -0,0 +1,68 @@
1
+ """Базовые HTTP-запросы для httpprobe-axx."""
2
+ from __future__ import annotations
3
+ from dataclasses import dataclass
4
+ import requests
5
+
6
+ USER_AGENT = "httpprobe-axx/0.1.0 (educational; +https://pypi.org/project/httpprobe-axx/)"
7
+ TIMEOUT = 10
8
+
9
+
10
+ class ProbeError(Exception):
11
+ """Ошибка при запросе (сеть, таймаут, DNS)."""
12
+
13
+
14
+ @dataclass
15
+ class Response:
16
+ url: str
17
+ status: int
18
+ headers: dict
19
+ text: str
20
+ elapsed_ms: float
21
+
22
+ def is_ok(self) -> bool:
23
+ return 200 <= self.status < 300
24
+
25
+
26
+ def _request(method: str, url: str, timeout: int) -> requests.Response:
27
+ if not url.startswith(("http://", "https://")):
28
+ url = "https://" + url
29
+ try:
30
+ return requests.request(
31
+ method, url,
32
+ headers={"User-Agent": USER_AGENT},
33
+ timeout=timeout,
34
+ allow_redirects=True,
35
+ )
36
+ except requests.Timeout as e:
37
+ raise ProbeError(f"Таймаут при подключении к {url}") from e
38
+ except requests.ConnectionError as e:
39
+ raise ProbeError(f"Не удалось подключиться к {url}") from e
40
+ except requests.RequestException as e:
41
+ raise ProbeError(f"Ошибка запроса: {e}") from e
42
+
43
+
44
+ def get(url: str, *, timeout: int = TIMEOUT) -> Response:
45
+ """Сделать GET-запрос. Только для своих сайтов или с разрешения."""
46
+ r = _request("GET", url, timeout)
47
+ return Response(r.url, r.status_code, dict(r.headers), r.text,
48
+ r.elapsed.total_seconds() * 1000)
49
+
50
+
51
+ def head(url: str, *, timeout: int = TIMEOUT) -> Response:
52
+ """HEAD-запрос: только заголовки, без тела."""
53
+ r = _request("HEAD", url, timeout)
54
+ return Response(r.url, r.status_code, dict(r.headers), "",
55
+ r.elapsed.total_seconds() * 1000)
56
+
57
+
58
+ def status(url: str, *, timeout: int = TIMEOUT) -> int:
59
+ """Только код ответа (200, 404, ...)."""
60
+ return head(url, timeout=timeout).status
61
+
62
+
63
+ def is_alive(url: str, *, timeout: int = TIMEOUT) -> bool:
64
+ """Отвечает ли сайт вообще."""
65
+ try:
66
+ return status(url, timeout=timeout) < 500
67
+ except ProbeError:
68
+ return False
@@ -0,0 +1,90 @@
1
+ Metadata-Version: 2.4
2
+ Name: httpprobe-axx
3
+ Version: 0.1.0
4
+ Summary: Учебный HTTP-клиент для white-hat: запросы и анализ заголовков безопасности
5
+ Author: Богдан
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://pypi.org/project/httpprobe-axx/
8
+ Keywords: http,security,whitehat,education
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Intended Audience :: Education
12
+ Requires-Python: >=3.9
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: requests>=2.31
16
+ Dynamic: license-file
17
+
18
+ # httpprobe-axx
19
+
20
+ Учебный HTTP-клиент для white-hat: запросы и анализ заголовков безопасности.
21
+
22
+ ⚠️ **Только для своих сайтов или с разрешения владельца.**
23
+ Это образовательный проект, а не инструмент для атак.
24
+
25
+ ## Установка
26
+
27
+ pip install httpprobe-axx
28
+
29
+ ## Что умеет
30
+
31
+ - `get(url)` — GET-запрос
32
+ - `head(url)` — только заголовки
33
+ - `status(url)` — код ответа (200, 404, ...)
34
+ - `is_alive(url)` — отвечает ли сайт
35
+ - `security_headers(url)` — какие защитные заголовки есть
36
+ - `check_https(url)` — использует ли сайт HTTPS
37
+ - `report(url)` — красивый текстовый отчёт
38
+
39
+ ## Пример
40
+
41
+ import httpprobe_axx as h
42
+
43
+ print(h.is_alive("https://example.com")) # True
44
+ print(h.report("https://github.com"))
45
+
46
+ Пример вывода:
47
+
48
+ === Отчёт по https://github.com ===
49
+
50
+ HTTPS: ✅ да
51
+ Итоговый URL: https://github.com/
52
+ Статус: 200
53
+ Ответ за: 280 мс
54
+
55
+ Заголовки безопасности:
56
+ ✅ Strict-Transport-Security
57
+ ✅ Content-Security-Policy
58
+ ✅ X-Frame-Options
59
+ ✅ X-Content-Type-Options
60
+ ✅ Referrer-Policy
61
+ ❌ Permissions-Policy
62
+ → Ограничение API браузера
63
+
64
+ Итог: 5/6 защитных заголовков присутствуют
65
+
66
+ ## Какие заголовки проверяются
67
+
68
+ | Заголовок | Зачем |
69
+ |---|---|
70
+ | Strict-Transport-Security | Заставляет браузер использовать HTTPS |
71
+ | Content-Security-Policy | Защита от XSS и инъекций |
72
+ | X-Frame-Options | Защита от clickjacking |
73
+ | X-Content-Type-Options | Запрет MIME-sniffing |
74
+ | Referrer-Policy | Контроль утечки referrer |
75
+ | Permissions-Policy | Ограничение API браузера |
76
+
77
+ ## Обработка ошибок
78
+
79
+ import httpprobe_axx as h
80
+
81
+ try:
82
+ r = h.get("https://несуществующий-сайт.рф")
83
+ except h.ProbeError as e:
84
+ print("Не получилось:", e)
85
+
86
+ ## Лицензия
87
+
88
+ MIT — делай что хочешь, только укажи автора.
89
+
90
+ Автор: Богдан, 12 лет.
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ httpprobe_axx/__init__.py
5
+ httpprobe_axx/analyze.py
6
+ httpprobe_axx/client.py
7
+ httpprobe_axx.egg-info/PKG-INFO
8
+ httpprobe_axx.egg-info/SOURCES.txt
9
+ httpprobe_axx.egg-info/dependency_links.txt
10
+ httpprobe_axx.egg-info/requires.txt
11
+ httpprobe_axx.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ requests>=2.31
@@ -0,0 +1 @@
1
+ httpprobe_axx
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "httpprobe-axx"
7
+ version = "0.1.0"
8
+ description = "Учебный HTTP-клиент для white-hat: запросы и анализ заголовков безопасности"
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Богдан" }]
14
+ keywords = ["http", "security", "whitehat", "education"]
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Operating System :: OS Independent",
18
+ "Intended Audience :: Education",
19
+ ]
20
+ dependencies = [
21
+ "requests>=2.31",
22
+ ]
23
+
24
+ [project.urls]
25
+ Homepage = "https://pypi.org/project/httpprobe-axx/"
26
+
27
+ [tool.setuptools.packages.find]
28
+ where = ["."]
29
+ include = ["httpprobe_axx*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+