Skip to content

Commit

Permalink
style: Automatic code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 7, 2024
1 parent 2f66c52 commit bd0bd90
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions utils/download_yara.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import glob
import json
import os
import re
import json

import requests
from bs4 import BeautifulSoup
from bs2json import BS2Json
from bs4 import BeautifulSoup

ROOT = "/opt/CAPEv2"

Expand Down Expand Up @@ -42,11 +43,13 @@
elif resp.headers["content-type"].strip().startswith("text/html"):
bs2json = BS2Json(resp.text)
json_obj = bs2json.convert()
payload_text = json_obj["html"]["body"]["div"][0]["div"][3]["div"]["main"]["turbo-frame"]["div"]["react-app"]["script"]["text"]
payload_text = json_obj["html"]["body"]["div"][0]["div"][3]["div"]["main"]["turbo-frame"]["div"]["react-app"]["script"][
"text"
]
json_payload = json.loads(payload_text)
page_content = json_payload.get("payload", {}).get("tree", {}).get("items", [])
else:
dataform = str(resp.content).strip("'<>() ").replace('\'', '\"')
dataform = str(resp.content).strip("'<>() ").replace("'", '"')
page_content = json.loads(dataform).get("payload", {}).get("tree", {}).get("items", [])
for line in page_content:
if not line:
Expand Down Expand Up @@ -86,11 +89,13 @@
elif resp.headers["content-type"].strip().startswith("text/html"):
bs2json = BS2Json(resp.text)
json_obj = bs2json.convert()
payload_text = json_obj["html"]["body"]["div"][0]["div"][3]["div"]["main"]["turbo-frame"]["div"]["react-app"]["script"]["text"]
payload_text = json_obj["html"]["body"]["div"][0]["div"][3]["div"]["main"]["turbo-frame"]["div"]["react-app"][
"script"
]["text"]
json_payload = json.loads(payload_text)
page_content = json_payload.get("payload", {}).get("tree", {}).get("items", [])
else:
dataform = str(resp.content).strip("'<>() ").replace('\'', '\"')
dataform = str(resp.content).strip("'<>() ").replace("'", '"')
page_content = json.loads(dataform).get("payload", {}).get("tree", {}).get("items", [])
for line in page_content:
if not line:
Expand Down

0 comments on commit bd0bd90

Please sign in to comment.