4
4
# Mandos Monitor - Control and monitor the Mandos server
6
# Copyright © 2008-2011 Teddy Hogeborn
7
# Copyright © 2008-2011 Björn Påhlsson
6
# Copyright © 2008-2012 Teddy Hogeborn
7
# Copyright © 2008-2012 Björn Påhlsson
9
9
# This program is free software: you can redistribute it and/or modify
10
10
# it under the terms of the GNU General Public License as published by
93
93
>>> string_to_delta("5m 30s")
94
94
datetime.timedelta(0, 330)
96
timevalue = datetime.timedelta(0)
97
regexp = re.compile("\d+[dsmhw]")
96
value = datetime.timedelta(0)
97
regexp = re.compile("(\d+)([dsmhw]?)")
99
for s in regexp.findall(interval):
101
suffix = unicode(s[-1])
104
delta = datetime.timedelta(value)
106
delta = datetime.timedelta(0, value)
108
delta = datetime.timedelta(0, 0, 0, 0, value)
110
delta = datetime.timedelta(0, 0, 0, 0, 0, value)
112
delta = datetime.timedelta(0, 0, 0, 0, 0, 0, value)
115
except (ValueError, IndexError):
99
for num, suffix in regexp.findall(interval):
101
value += datetime.timedelta(int(num))
103
value += datetime.timedelta(0, int(num))
105
value += datetime.timedelta(0, 0, 0, 0, int(num))
107
value += datetime.timedelta(0, 0, 0, 0, 0, int(num))
109
value += datetime.timedelta(0, 0, 0, 0, 0, 0, int(num))
111
value += datetime.timedelta(0, 0, 0, int(num))
120
114
def print_clients(clients, keywords):
121
115
def valuetostring(value, keyword):
243
237
os.dup2(stderrcopy, sys.stderr.fileno())
244
238
os.close(stderrcopy)
245
except dbus.exceptions.DBusException, e:
239
except dbus.exceptions.DBusException:
246
240
print("Access denied: Accessing mandos server through dbus.",