Skip to content

Commit

Permalink
handle WAF block
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoglom committed Sep 8, 2024
1 parent 492963e commit c60b19d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tconnectsync/api/controliq.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ def _build_login_data(self, email, password, soup):
contents = "%s[SNIP]%s" % (contents[:500], contents[-500:])
logger.info("BeautifulSoup parsed contents: %s" % contents)
pass
if not soup.select_one("#__VIEWSTATE"):
enc_contents = soup.encode_contents()
if "Web Page Blocked!" in enc_contents or "Attack ID:" in enc_contents:
logger.warn("Being ratelimited/blocked by web application firewall. Sleeping for 30 minutes before retrying.")
logger.info("BeautifulSoup parsed contents: %s" % enc_contents)
time.sleep(1800)
exit(1)
return {
"__LASTFOCUS": "",
"__EVENTTARGET": "ctl00$ContentBody$LoginControl$linkLogin",
Expand Down

0 comments on commit c60b19d

Please sign in to comment.