Added cookie functionality
This commit is contained in:
parent
982aa31d9a
commit
e434f5e704
3 changed files with 17 additions and 4 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -162,3 +162,5 @@ cython_debug/
|
|||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
.vscode/
|
||||
cookies.yaml
|
||||
1
example_cookies.yaml
Normal file
1
example_cookies.yaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
COOKIE: VALUE
|
||||
18
main.py
18
main.py
|
|
@ -5,6 +5,7 @@ import sys
|
|||
from console import console
|
||||
from rich.panel import Panel
|
||||
from rich.layout import Layout
|
||||
import yaml
|
||||
|
||||
|
||||
layout = Layout()
|
||||
|
|
@ -27,16 +28,25 @@ wanted_headers = [
|
|||
|
||||
s = requests.Session()
|
||||
|
||||
cookies = {}
|
||||
|
||||
with open('cookies.yaml') as cookie_stream:
|
||||
cookies = yaml.safe_load(cookie_stream)
|
||||
|
||||
|
||||
with console.status("Making request..."):
|
||||
base_session = s.get(target)
|
||||
base_session = s.get(target, cookies=cookies)
|
||||
|
||||
soup = BeautifulSoup(base_session.text, "html.parser")
|
||||
|
||||
redirect_string = ""
|
||||
redirect_amount = 1
|
||||
if len(base_session.history) > 0:
|
||||
for history_item in base_session.history:
|
||||
redirect_string += f" -> {history_item.url} ({history_item.status_code})"
|
||||
redirect_string += f" -> {base_session.url} ({base_session.status_code})"
|
||||
redirect_string += f"{redirect_amount}> {history_item.url} ({history_item.status_code})\n"
|
||||
redirect_amount += 1
|
||||
|
||||
redirect_string += f"{redirect_amount}> {base_session.url} ({base_session.status_code})"
|
||||
|
||||
layout["target"].split(
|
||||
Panel(target, title="Target"),
|
||||
|
|
@ -91,4 +101,4 @@ layout['scripts'].split(
|
|||
)
|
||||
|
||||
|
||||
console.print(layout)
|
||||
console.print(layout, overflow="ellipsis")
|
||||
Loading…
Reference in a new issue