fluidattacks-core 2.2.0__tar.gz → 2.2.2__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.
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/PKG-INFO +1 -1
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/warp.py +46 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/http/client.py +4 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/pyproject.toml +1 -1
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/README.md +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/__init__.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/authz/__init__.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/authz/py.typed +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/authz/types.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/__init__.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/classes.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/clone.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/codecommit_utils.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/delete_files.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/download_file.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/download_repo.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/https_utils.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/py.typed +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/remote.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/ssh_utils.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/utils.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/http/__init__.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/http/validations.py +0 -0
- {fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/py.typed +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import aiohttp
|
|
1
2
|
import asyncio
|
|
2
3
|
import logging
|
|
3
4
|
import re
|
|
@@ -12,6 +13,51 @@ class WarpError(Exception):
|
|
|
12
13
|
pass
|
|
13
14
|
|
|
14
15
|
|
|
16
|
+
async def _public_ip_test(expected_ip: str) -> bool:
|
|
17
|
+
ip_service_url = "https://api.ipify.org?format=text"
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
async with aiohttp.ClientSession() as session:
|
|
21
|
+
async with session.get(ip_service_url) as response:
|
|
22
|
+
if response.status == 200:
|
|
23
|
+
public_ip = await response.text()
|
|
24
|
+
LOGGER.info("Current public IP: %s", public_ip)
|
|
25
|
+
return public_ip.strip() == expected_ip
|
|
26
|
+
|
|
27
|
+
LOGGER.error(
|
|
28
|
+
"Failed to fetch public IP. Status code: %s",
|
|
29
|
+
response.status,
|
|
30
|
+
)
|
|
31
|
+
return False
|
|
32
|
+
except aiohttp.ClientError as error:
|
|
33
|
+
LOGGER.error("Error while fetching public IP: %s", error)
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
async def public_ip_ready(
|
|
38
|
+
expected_ip: str, *, attempts: int, seconds_per_attempt: int
|
|
39
|
+
) -> bool:
|
|
40
|
+
for attempt_number in range(1, attempts + 1):
|
|
41
|
+
LOGGER.info(
|
|
42
|
+
"Checking public IP... Attempt %s/%s",
|
|
43
|
+
attempt_number,
|
|
44
|
+
attempts,
|
|
45
|
+
)
|
|
46
|
+
if await _public_ip_test(expected_ip):
|
|
47
|
+
LOGGER.info(
|
|
48
|
+
"Public IP test successful after %s attempts",
|
|
49
|
+
attempt_number,
|
|
50
|
+
)
|
|
51
|
+
return True
|
|
52
|
+
LOGGER.info(
|
|
53
|
+
"Public IP test failed. Retrying in %s seconds",
|
|
54
|
+
seconds_per_attempt,
|
|
55
|
+
)
|
|
56
|
+
await asyncio.sleep(seconds_per_attempt)
|
|
57
|
+
LOGGER.error("Public IP test failed after %s attempts", attempts)
|
|
58
|
+
return False
|
|
59
|
+
|
|
60
|
+
|
|
15
61
|
async def _dns_test() -> bool:
|
|
16
62
|
domain = "notify.bugsnag.com" # Using a domain that used to fail
|
|
17
63
|
|
|
@@ -7,6 +7,7 @@ import certifi
|
|
|
7
7
|
import ipaddress
|
|
8
8
|
import ssl
|
|
9
9
|
from typing import (
|
|
10
|
+
Any,
|
|
10
11
|
Literal,
|
|
11
12
|
Sequence,
|
|
12
13
|
)
|
|
@@ -47,10 +48,12 @@ async def request(
|
|
|
47
48
|
dns_rebind_protection: bool = True,
|
|
48
49
|
enforce_sanitization: bool = False,
|
|
49
50
|
headers: dict[str, str] | None = None,
|
|
51
|
+
json: Any | None = None,
|
|
50
52
|
ports: list[int] | None = None,
|
|
51
53
|
schemes: list[str] | None = None,
|
|
52
54
|
timeout: int = 10,
|
|
53
55
|
) -> aiohttp.ClientResponse:
|
|
56
|
+
# pylint: disable=too-many-locals
|
|
54
57
|
validate_url(
|
|
55
58
|
url,
|
|
56
59
|
ascii_only=ascii_only,
|
|
@@ -75,6 +78,7 @@ async def request(
|
|
|
75
78
|
method,
|
|
76
79
|
url,
|
|
77
80
|
allow_redirects=not dns_rebind_protection,
|
|
81
|
+
json=json,
|
|
78
82
|
timeout=aiohttp.ClientTimeout(total=timeout),
|
|
79
83
|
) as response:
|
|
80
84
|
await response.read()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fluidattacks_core-2.2.0 → fluidattacks_core-2.2.2}/fluidattacks_core/git/codecommit_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|