Skip to content
KitploitKITPLOIT
StrumentiExploitsBlog
Log in
Invia
StrumentiExploitsBlog
Invia

Strumenti di Hacking, PenTest e Cybersecurity per il tuo Arsenale di Sicurezza!

Kitploit è una directory di strumenti di hacking, cybersecurity e pentesting. Scopri gli ultimi aggiornamenti dei progetti per trovare vulnerabilità, analizzare sistemi, automatizzare i test e rafforzare la tua sicurezza.

FeedContattoPrivacy© 2026 Kitploit

Directory degli strumenti

Categorie

Vedi tutte le categorie
Loading categories
selenium-wire — Estende i binding Python di Selenium per darti la possibilità di ispezionare le richieste fatte dal browser. | Kitploit
Strumenti/GitHubGitHub/wkeeling/selenium-wire
Proxy Web e IntercettazioneTest di Sicurezza delle APIRaccolta InformazioniSicurezza WebPenetration TestingArchived
GitHubwkeeling/selenium-wire

selenium-wire

Estende i binding Python di Selenium per darti la possibilità di ispezionare le richieste fatte dal browser.

Vedi Repository
2.0k280222 anni faRevisionato da Kitploit

Più Popolari

Vedi tutti →

Scopri gli strumenti più utilizzati dalla nostra community.

Esplora tutti gli strumenti

Sfoglia la nostra collezione di strumenti

Vedi tutti gli strumenti →
Condividi

Selenium Wire non è più mantenuto. Grazie per il tuo supporto e per tutti i tuoi contributi.

Selenium Wire

Selenium Wire estende i binding Python di Selenium <https://www.selenium.dev/documentation/en/>_ per darti accesso alle richieste sottostanti effettuate dal browser. Scrivi il tuo codice nello stesso modo in cui fai con Selenium, ma ottieni API aggiuntive per ispezionare richieste e risposte e per modificarle al volo.

.. image:: https://github.com/wkeeling/selenium-wire/workflows/build/badge.svg :target: https://github.com/wkeeling/selenium-wire/actions

.. image:: https://codecov.io/gh/wkeeling/selenium-wire/branch/master/graph/badge.svg :target: https://codecov.io/gh/wkeeling/selenium-wire

.. image:: https://img.shields.io/badge/python-3.7%2C%203.8%2C%203.9%2C%203.10-blue.svg :target: https://pypi.python.org/pypi/selenium-wire

.. image:: https://img.shields.io/pypi/v/selenium-wire.svg :target: https://pypi.python.org/pypi/selenium-wire

.. image:: https://img.shields.io/pypi/l/selenium-wire.svg :target: https://pypi.python.org/pypi/selenium-wire

.. image:: https://pepy.tech/badge/selenium-wire/month :target: https://pepy.tech/project/selenium-wire

Esempio Semplice~~~~~~~~~~~~~~

.. code:: python

from seleniumwire import webdriver  # Import from seleniumwire

# Create a new instance of the Chrome driver
driver = webdriver.Chrome()

# Go to the Google home page
driver.get('https://www.google.com')

# Access requests via the `requests` attribute
for request in driver.requests:
    if request.response:
        print(
            request.url,
            request.response.status_code,
            request.response.headers['Content-Type']
        )

Prints:

.. code:: bash

https://www.google.com/ 200 text/html; charset=UTF-8
https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_120x44dp.png 200 image/png
https://consent.google.com/status?continue=https://www.google.com&pc=s&timestamp=1531511954&gl=GB 204 text/html; charset=utf-8
https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png 200 image/png
https://ssl.gstatic.com/gb/images/i2_2ec824b0.png 200 image/png
https://www.google.com/gen_204?s=webaft&t=aft&atyp=csi&ei=kgRJW7DBONKTlwTK77wQ&rt=wsrt.366,aft.58,prt.58 204 text/html; charset=UTF-8
...

Features


* Pure Python, user-friendly API
* HTTP and HTTPS requests captured
* Intercept requests and responses
* Modify headers, parameters, body content on the fly
* Capture websocket messages
* HAR format supported
* Proxy server support

Compatibilty
  • Python 3.7+
  • Selenium 4.0.0+
  • Chrome, Firefox, Edge and Remote Webdriver supported

Table of Contents

- `Installazione`_

  * `Configurazione del browser`_

  * `OpenSSL`_

- `Creazione del Webdriver`_

- `Accesso alle richieste`_

- `Oggetti Richiesta`_

- `Oggetti Risposta`_

- `Intercettare richieste e risposte`_

  * `Esempio: aggiungere un header della richiesta`_
  * `Esempio: sostituire un header della richiesta esistente`_
  * `Esempio: aggiungere un header della risposta`_
  * `Esempio: aggiungere un parametro della richiesta`_
  * `Esempio: aggiornare JSON nel corpo di una richiesta POST`_
  * `Esempio: autenticazione di base`_
  * `Esempio: bloccare una richiesta`_
  * `Esempio: simulare una risposta`_
  * `Rimuovere un interceptor`_

- `Limitare la cattura delle richieste`_

- `Archiviazione delle richieste`_

  * `Archiviazione in memoria`_

- `Proxy`_

  * `SOCKS`_

  * `Cambiare dinamicamente`_

- `Rilevamento bot`_

- `Certificati`_

  * `Utilizzare il proprio certificato`_

- `Tutte le opzioni`_

- `Licenza`_

Installazione~~~~~~~~~~~~

Install using pip:

.. code:: bash

    pip install selenium-wire

If you get an error about not being able to build cryptography you may be running an old version of pip. Try upgrading pip with ``python -m pip install --upgrade pip`` and then re-run the above command.

Browser Setup
-------------

No specific configuration should be necessary except to ensure that you have downloaded the relevent webdriver executable for your browser and placed it somewhere on your system PATH.

- `Download <https://sites.google.com/chromium.org/driver/>`__ webdriver for Chrome
- `Download <https://github.com/mozilla/geckodriver/>`__ webdriver for Firefox
- `Download <https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/>`__ webdriver for Edge

OpenSSL
-------

Selenium Wire requires OpenSSL for decrypting HTTPS requests. This is probably already installed on your system (you can check by running ``openssl version`` on the command line). If it's not installed you can install it with:

**Linux**

.. code:: bash

    # For apt based Linux systems
    sudo apt install openssl

    # For RPM based Linux systems
    sudo yum install openssl

    # For Linux alpine
    sudo apk add openssl

**MacOS**

.. code:: bash

    brew install openssl

**Windows**

No installation is required.

Creating the Webdriver

Assicurati di importare webdriver dal pacchetto seleniumwire:

.. code:: python

from seleniumwire import webdriver

Quindi istanzia il webdriver come faresti se stessi usando Selenium direttamente. Puoi passare qualsiasi capability desiderata o opzioni specifiche del browser - come il percorso dell'eseguibile, la modalità headless, ecc. Selenium Wire ha anche le proprie opzioni_ che possono essere passate nell'attributo seleniumwire_options.

.. code:: python

# Create the driver with no options (use defaults)
driver = webdriver.Chrome()

# Or create using browser specific options and/or seleniumwire_options options
driver = webdriver.Chrome(
    options = webdriver.ChromeOptions(...),
    seleniumwire_options={...}
)

.. _proprie opzioni: #all-options

Nota che per i sottopacchetti di webdriver, devi continuare a importarli direttamente da selenium. Ad esempio, per importare WebDriverWait:

.. code:: python

# Sub-packages of webdriver must still be imported from `selenium` itself
from selenium.webdriver.support.ui import WebDriverWait

Webdriver remoto

Selenium Wire ha un supporto limitato per l'utilizzo del client webdriver remoto. Quando crei un'istanza del webdriver remoto, devi specificare il nome host o l'indirizzo IP della macchina (o del container) su cui è in esecuzione Selenium Wire. Ciò consente all'istanza remota di comunicare a Selenium Wire le proprie richieste e risposte.

.. code:: python

options = {
    'addr': 'hostname_or_ip'  # Address of the machine running Selenium Wire. Explicitly use 127.0.0.1 rather than localhost if remote session is running locally.
}
driver = webdriver.Remote(
    command_executor='http://www.example.com',
    seleniumwire_options=options
)

Se la macchina che esegue il browser deve utilizzare un indirizzo diverso per comunicare con la macchina su cui è in esecuzione Selenium Wire, devi configurare il browser manualmente. Questo problema <https://github.com/wkeeling/selenium-wire/issues/220>_ entra più nel dettaglio.

Accesso alle richieste~~~~~~~~~~~~~~~~~~

Selenium Wire captures all HTTP/HTTPS traffic made by the browser [1]_. The following attributes provide access to requests and responses.

driver.requests The list of captured requests in chronological order.

driver.last_request Convenience attribute for retrieving the most recently captured request. This is more efficient than using driver.requests[-1].

Scarica lo strumento