Skip to content

Commit

Permalink
catch asyncio.TimeoutError due to arsenic issue
Browse files Browse the repository at this point in the history
  • Loading branch information
devl00p committed Sep 20, 2022
1 parent 180601f commit a0b7c43
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion wapitiCore/attack/mod_wapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ async def _detect_applications_headless(self, url: str) -> dict:
logging.exception(exception)
continue

except (ArsenicError, FileNotFoundError):
except (ArsenicError, FileNotFoundError, asyncio.TimeoutError):
# Geckodriver may be missing, etc
pass

Expand Down
2 changes: 1 addition & 1 deletion wapitiCore/net/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ async def _async_try_login_post(
await asyncio.sleep(.1)
page_source = await headless_client.get_page_source()
crawler_configuration.cookies = headless_cookies_to_cookiejar(await headless_client.get_all_cookies())
except ArsenicError as exception:
except (ArsenicError, asyncio.TimeoutError) as exception:
logging.error(_("[!] {} with URL {}").format(exception.__class__.__name__, auth_url))
return False, {}, []
else:
Expand Down
8 changes: 5 additions & 3 deletions wapitiCore/net/intercepting_explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import asyncio
import re
import sys
from traceback import print_tb
from typing import Tuple, List, AsyncIterator, Dict, Optional, Deque
from logging import getLogger, WARNING, CRITICAL
from http.cookiejar import CookieJar
Expand Down Expand Up @@ -322,7 +324,7 @@ async def launch_headless_explorer(

page_source = await headless_client.get_page_source()
await click_in_webpage(headless_client, request, wait_time)
except ArsenicError as exception:
except (ArsenicError, asyncio.TimeoutError) as exception:
logging.error(f"{request} generated an exception: {exception.__class__.__name__}")
continue
else:
Expand Down Expand Up @@ -350,8 +352,8 @@ async def launch_headless_explorer(
to_explore.append(next_request)

except Exception as exception: # pylint: disable=broad-except
# exception_traceback = sys.exc_info()[2]
# print_tb(exception_traceback)
exception_traceback = sys.exc_info()[2]
print_tb(exception_traceback)
frm = inspect.trace()[-1]
mod = inspect.getmodule(frm[0])
logging.error(
Expand Down

0 comments on commit a0b7c43

Please sign in to comment.