Debian Codegraph @

examples/networking/tcp_mon_block/src/http_client.py

raw symbols SCIP
1 import requests
2
3
4 server_address = "192.168.1.42"
5 api_address = "https://api.ipify.org"
6
7 # https://api.ipify.org should be allowed on default
8 print(requests.get(f"http://{server_address}/public_ip", params={"api": api_address}).content.decode())
9
10 # Now let's use an address which isn't on the allow list. This is an MAC address to Vendor API.
11 # If tcp_mon_block is running and filtering the Flask's server PID, this request should fail! otherwise we should receive a response
12 api_address = "https://api.macvendors.com/00:0c:29:de:b1:fd"
13
14 print(requests.get(f"http://{server_address}/public_ip", params={"api": api_address}).content.decode())