-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathns_lookup.py
More file actions
43 lines (31 loc) · 961 Bytes
/
ns_lookup.py
File metadata and controls
43 lines (31 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from anyone_protocol_sdk import Config, Process, Control, Socks, EventType, AddrMap
import time
# Create a configuration
config = Config(
auto_terms_agreement=True,
display_log=True,
)
anon = Process.launch_anon(anonrc_path=config.to_file())
print("Anon is running...")
control = Control.from_port()
socks = Socks()
def print_addr(event: AddrMap):
print(f"Address: {event.hostname}")
print(f"IP: {event.destination}")
print(f"Expires: {event.expiry}")
print(f"Error: {event.error}")
print(f"UTC Expiry: {event.utc_expiry}")
print(f"Cached: {event.cached}")
print()
try:
control.authenticate()
control.add_event_listener(print_addr, EventType.ADDRMAP)
control.resolve("google.com")
control.resolve("web3yurii.com")
time.sleep(3)
except Exception as e:
print(f"Anon failed to start: {e}")
finally:
control.remove_event_listener(print_addr)
anon.stop()
print("Anon has stopped.")