File: read-database.py

package info (click to toggle)
libloc 0.9.18-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 42,824 kB
  • sloc: ansic: 7,602; python: 2,893; makefile: 511; sh: 39; perl: 13
file content (22 lines) | stat: -rw-r--r-- 378 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python3

import location

# Open the database
d = location.Database("test.db")
print(d)

# Try to get information about AS123
a = d.get_as(123)
print(a)

# Try to get information about AS204867
a = d.get_as(204867)
print(a)

# Search for an IP address in the database
n = d.lookup("8.8.8.8")
print(n)

n = d.lookup("2a07:1c44:5800:1234:1234:1234:1234:1234")
print(n)