Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

website / browser extension loader #19

Closed
evilsocket opened this issue Jan 17, 2025 · 1 comment · Fixed by #28
Closed

website / browser extension loader #19

evilsocket opened this issue Jan 17, 2025 · 1 comment · Fixed by #28
Assignees
Labels
enhancement New feature or request

Comments

@evilsocket
Copy link
Collaborator

Implement a selenium based loader to profile websites and possibly browser extensions. Something like:

Dockerfile

FROM python:3.10-alpine

# install chromedriver
RUN apk update
RUN apk add chromium chromium-chromedriver

ENV PYTHONUNBUFFERED 1
RUN pip install --upgrade pip
RUN pip install selenium

WORKDIR /app
COPY dyana.py .
COPY main.py .

ENV DISPLAY=:99

ENTRYPOINT ["python3", "-W", "ignore", "main.py"]

settings.yml

description: Opens a website in an headless browser.
network: true

args:
  - name: url
    description: URL to open.
    required: true

main.py

import argparse
import json
import shutil
import time

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

from dyana import Profiler  # type: ignore[attr-defined]

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Run an Python file")
    parser.add_argument("--url", help="URL to open", required=True)
    args = parser.parse_args()
    profiler: Profiler = Profiler()

    try:
        chrome_options = webdriver.ChromeOptions()
        chrome_options.add_argument("--no-sandbox")
        chrome_options.add_argument("--headless")
        chrome_options.add_argument("--disable-dev-shm-usage")
        chrome_options.add_argument("--window-size=1920,1080")

        driver = webdriver.Chrome(options=chrome_options, service=Service(shutil.which("chromedriver")))
        driver.implicitly_wait(10)

        profiler.track_memory("after_load")

        driver.get(args.url)

        time.sleep(10)
        # el = self.driver.find_element(By.CLASS_NAME, 'header__logo')
        # el.click()
        profiler.track_memory("after_request")

        # driver.quit()

        # profiler.track_memory("after_driver_quit")

    except Exception as e:
        profiler.track_error("chrome", str(e))

    print(json.dumps(profiler.as_dict()))
@evilsocket evilsocket added the enhancement New feature or request label Jan 17, 2025
@GangGreenTemperTatum
Copy link
Contributor

quick update: debugging DNS behavior as i have a working PoC and doing some follow-up evaluation and testing at the moment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants