Esempio n. 1
0
def record_login(address, timestamp=None):
    if not timestamp:
        timestamp = datetime.utcnow()
    if last_login():
        uci.set(previous_login_ip, uci.get(last_login_ip))
        uci.set(previous_login_timestamp, uci.get(last_login_timestamp))
    uci.set(last_login_timestamp, timestamp.strftime('%Y-%m-%dT%H:%M:%S'))
    uci.set(last_login_ip, address)

    uci.commit("openwireless")
Esempio n. 2
0
def record_login(address, timestamp = None):
    if not timestamp:
        timestamp = datetime.utcnow()
    if last_login():
        uci.set(previous_login_ip, uci.get(last_login_ip))
        uci.set(previous_login_timestamp, uci.get(last_login_timestamp))
    uci.set(last_login_timestamp, timestamp.strftime('%Y-%m-%dT%H:%M:%S'))
    uci.set(last_login_ip, address)

    uci.commit("openwireless")
Esempio n. 3
0
def enabled(index):
    return uci.get("wireless.@wifi-iface[%d].disabled" % index) != "1"
Esempio n. 4
0
def _get_date(key):
    date_string = uci.get(key)
    return date_string and datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S')
Esempio n. 5
0
def previous_login():
    address = uci.get(previous_login_ip)
    timestamp = _get_date(previous_login_timestamp)
    return _build_login(address, timestamp)
Esempio n. 6
0
def last_login():
    address = uci.get(last_login_ip)
    timestamp = _get_date(last_login_timestamp)
    return _build_login(address, timestamp)
Esempio n. 7
0
def _get_date(key):
    date_string = uci.get(key)
    return date_string and datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S')
Esempio n. 8
0
def previous_login():
    address = uci.get(previous_login_ip)
    timestamp = _get_date(previous_login_timestamp)
    return _build_login(address, timestamp)
Esempio n. 9
0
def last_login():
    address = uci.get(last_login_ip)
    timestamp = _get_date(last_login_timestamp)
    return _build_login(address, timestamp)
def enabled(index):
    return uci.get("wireless.@wifi-iface[%d].disabled" % index) != "1"