Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions bbot/core/event/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,22 @@ def sanitize_data(self, data):
def pretty_string(self):
return self.url

def _data_human(self):
parts = []
status = self.http_status
if status:
parts.append(f"[{status}]")
parts.append(self.url)
if status and str(status).startswith("3"):
location = self.data.get("redirect_location", "")
if location:
parts.append(f"-> {location}")
else:
title = self.http_title
if title:
parts.append(f"- [{title}]")
return " ".join(parts)

def add_tag(self, tag):
self_url = getattr(self, "parsed_url", "")
self_host = getattr(self, "host", "")
Expand Down Expand Up @@ -1427,6 +1443,14 @@ def http_title(self):
def http_title(self, value):
self.data["http_title"] = value

@property
def redirect_location(self):
return self.data.get("redirect_location", "")

@redirect_location.setter
def redirect_location(self, value):
self.data["redirect_location"] = value


class URL(URL_UNVERIFIED):
def __init__(self, *args, **kwargs):
Expand Down
3 changes: 3 additions & 0 deletions bbot/modules/httpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ async def handle_batch(self, *events):
title = j.get("title", "")
if title:
url_event.http_title = title
location = j.get("header", {}).get("location", "")
if location:
url_event.redirect_location = location
if url_event != parent_event:
await self.emit_event(url_event)
# HTTP response
Expand Down
Loading