forked from bortzmeyer/check_expire
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
ff901cfc06 | ||
|
014fe9fec5 | ||
|
60a6410941 | ||
|
4e17d48adb | ||
|
f7e355702f | ||
|
6d6f054a26 | ||
|
30d4678e03 | ||
|
9dc05e9c7b | ||
3af8b31034 |
@ -45,6 +45,9 @@ warning_t = datetime.timedelta(days=7)
|
||||
unixtime = False
|
||||
timeout = 20 # Seconds
|
||||
|
||||
# Cannot be changed on the command-line (yet)
|
||||
server = None
|
||||
|
||||
def usage(msg=None):
|
||||
print("Usage: %s -H domain-name [-c critical -w warning -u -t timeout]" % sys.argv[0], end="")
|
||||
if msg is not None and msg != "":
|
||||
@ -103,7 +106,7 @@ try:
|
||||
elif option == "--hostname" or option == "-H":
|
||||
domain = value
|
||||
elif option == "--timeout" or option == "-t":
|
||||
timeout = int(value)
|
||||
timeout = float(value)
|
||||
elif option == "--unixtime" or option == "-u":
|
||||
unixtime = True
|
||||
elif option == "--verbose" or option == "-v":
|
||||
@ -144,6 +147,7 @@ for server in servers:
|
||||
response = requests.get("%s/domain/%s" % (server, domain), timeout=timeout)
|
||||
except requests.exceptions.Timeout:
|
||||
unknowns += "Timeout when trying to reach %s " % server
|
||||
continue
|
||||
if response.status_code != 200:
|
||||
errors += "Invalid RDAP return code at %s: %s " % \
|
||||
(server, response.status_code)
|
||||
|
26
tests.yaml
26
tests.yaml
@ -28,11 +28,11 @@ tests:
|
||||
retcode: 1
|
||||
partstderr: 'ValueError'
|
||||
|
||||
# 2021-07-05: no RDAP server for this TLD
|
||||
# No RDAP server for this TLD
|
||||
- exe: './check_expire'
|
||||
args:
|
||||
- '-H'
|
||||
- 'bie.re'
|
||||
- 'welcome.this-is-not-a-tld'
|
||||
retcode: 3
|
||||
partstdout: 'No RDAP server'
|
||||
|
||||
@ -45,13 +45,13 @@ tests:
|
||||
retcode: 2
|
||||
partstdout: 'No expiration found'
|
||||
|
||||
# Far away and slow, timeout is expected
|
||||
# With a timeout of 1µs, a timeout is expected
|
||||
- exe: './check_expire'
|
||||
args:
|
||||
- '-t'
|
||||
- '1'
|
||||
- '0.000001'
|
||||
- '-H'
|
||||
- 'nic.ar'
|
||||
- 'bortzmeyer.org'
|
||||
retcode: 3
|
||||
partstdout: 'Timeout'
|
||||
|
||||
@ -143,14 +143,14 @@ tests:
|
||||
retcode: 0
|
||||
stderr: ''
|
||||
|
||||
# Iran, expiration date in the past
|
||||
- exe: './check_expire'
|
||||
args:
|
||||
- '-H'
|
||||
- 'nic.pars'
|
||||
retcode: 2
|
||||
partstdout: "already expired"
|
||||
stderr: ''
|
||||
# Iran, expiration date in the past. But down (2024-06-16)
|
||||
#- exe: './check_expire'
|
||||
# args:
|
||||
# - '-H'
|
||||
# - 'nic.pars'
|
||||
# retcode: 2
|
||||
# partstdout: "already expired"
|
||||
# stderr: ''
|
||||
|
||||
# Brazil
|
||||
- exe: './check_expire'
|
||||
|
Loading…
Reference in New Issue
Block a user