Skip to content

Commit

Permalink
Merge branch 'main' into fix-for-python39
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanlatr committed Jan 29, 2024
2 parents a943d82 + 255ae2a commit 3594c3b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion burpa/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__author__ = 'Adel "0x4d31" Karimi, and other contributors'
__version__ = '0.3.10'
__version__ = '0.3.11'
4 changes: 2 additions & 2 deletions burpa/_burp_rest_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def proxy_uri(self) -> str:
return f"{self.proxy_url}:{self.api_port}"

@property
def rest_api_version(self) -> Tuple[int,int,int]:
def rest_api_version(self) -> Tuple[int,...]:
"""The version of the burp-rest-api Extension"""
try:
r = self.request('versions')
Expand All @@ -144,7 +144,7 @@ def rest_api_version(self) -> Tuple[int,int,int]:
return get_version(r.json()['extensionVersion'])

@property
def burp_version(self) -> Tuple[int,int,int]:
def burp_version(self) -> Tuple[int,...]:
"""The version of Burp"""
try:
r = self.request('versions')
Expand Down
15 changes: 8 additions & 7 deletions burpa/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def is_timenow_between(begin_time: time, end_time: time) -> bool:
else: # When the time crosses midnight
return check_time >= begin_time or check_time <= end_time

def get_version(s:str) -> Tuple[int, int, int]:
def get_version(s:str) -> Tuple[int, ...]:
"""
Parse a version string like <major>.<minor>.<micro> into a tuple of ints.
"""
Expand All @@ -135,18 +135,18 @@ def get_version(s:str) -> Tuple[int, int, int]:
try:
v = int(p)
except:
v = 0
if intparts:
v = 0
else:
continue
intparts.append(v)


if 3-len(intparts)>0:
for _ in range(3-len(intparts)):
intparts.append(0)
elif len(intparts)>3:
for _ in range(len(intparts)-3):
intparts.pop(0)

assert len(intparts)==3

return tuple(intparts) # type: ignore

_tag = re.compile('<[^<]+?>')
Expand Down Expand Up @@ -185,5 +185,6 @@ def read_text(
assert get_version("2.2.0") == (2,2,0)
assert get_version("2") == (2,0,0)
assert get_version("Burp Suite Professional.2022.6.1") == (2022,6,1)
assert get_version("Burp Suite Professional.2022.6.1.1") == (2022,6,1,1)
assert get_version("Burp Suite Professional.2022.thing.1") == (2022,0,1)
assert get_version("0.2022.6.1") == (2022,6,1)
assert get_version("0.2022.6.1") == (0, 2022,6,1)

0 comments on commit 3594c3b

Please sign in to comment.