Skip to content

Commit

Permalink
fix wp version detection when root.findtext returns None
Browse files Browse the repository at this point in the history
  • Loading branch information
devl00p committed Oct 8, 2023
1 parent 4928252 commit a465c99
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions wapitiCore/attack/mod_wp_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,19 @@ async def detect_version(self, url: str):

if root is None:
continue

try:
generator_text = root.findtext('./channel/generator')
except xml.etree.ElementTree.ParseError:
continue

if not generator_text:
continue

version: Match = re.search(r"\Ahttps?:\/\/wordpress\.(?:[a-z]+)\/\?v=(.*)\Z", generator_text)
if version is None:
continue

detected_version = version.group(1)
break

Expand Down Expand Up @@ -171,6 +177,7 @@ async def detect_theme(self, url):

request = Request(f'{url}/wp-content/themes/{theme}/readme.txt', 'GET')
response = await self.crawler.async_send(request)

if response.is_success:
version = re.search(r'tag:\s*([\d.]+)', response.content)
# This check was added to detect invalid format of "Readme.txt" who can cause a crashe
Expand Down

0 comments on commit a465c99

Please sign in to comment.