# Python

### Basic Usage

```python
name = "John"
print("Hello, " + name + "!")
```

## How to extract files using Python

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2F8a4IXBwJNjN5JhTxziSx%2Fimage.png?alt=media&#x26;token=07285805-76a7-4f11-bdc0-51b4b3086125" alt=""><figcaption><p>Generate a private key with openssl</p></figcaption></figure>

```python
import http.server
import ssl

port = 8443

httpd = http.server.HTTPServer(('0.0.0.0', port), http.server.SimpleHTTPRequestHandler)

httpd.socket = ssl.wrap_socket(httpd.socket, 
                               certfile='/opt/cert.pem', 
                               keyfile='/opt/key.pem', 
                               server_side=True)

print(f"Serving on https://0.0.0.0:{port}")
httpd.serve_forever()
```

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FKkdiIv8VzPH2J5ltlsT1%2Fimage.png?alt=media&#x26;token=13de70af-d111-4d99-b090-8a6c5a0464cf" alt=""><figcaption><p>Execute the script</p></figcaption></figure>

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FMy9vUroidHYEwKAJZa2v%2Fimage.png?alt=media&#x26;token=3b56c458-d839-4f54-8b86-cf1832abd4cf" alt=""><figcaption><p>Download the file with wget</p></figcaption></figure>

<figure><img src="https://3593245608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkPEBr0Ohu5Y49JHmv4La%2Fuploads%2FJga1BJjn3SjMlgwRVRlr%2Fimage.png?alt=media&#x26;token=da0bb9fa-bd57-4f8d-a4e4-e075236abfc2" alt=""><figcaption><p>Wireshark Results</p></figcaption></figure>
