Esempio n. 1
0
def quota():
    q = ''
    if not hl_utils.is_cip():
        return ''
    else:
        with open(hl_utils.hlpath("quota.cip")) as f:
            return f.read()
Esempio n. 2
0
def quota():
    if True:
        return
    if hl_utils.is_cip():
        q = hl_utils.shexec("cip-quota")
        ciptmp = "WTF"
        home = "WTF"
        test = []
        print(q)
        for l in q:
            test += [l]

        try:
            #if l.endswith("ciptmp\n"):
            ciptmp = test[2].split("(")[1].split(")")[0]
            #elif l.endswith("ik15ydit\n"):
            home = test[1].split("(")[1].split(")")[0]
            #break
        except Exception:
            return

        tmp = "Quota: " + home + "/" + ciptmp
        with open(hl_utils.hlpath("quota.cip"), "w") as f:
            print(tmp)
            f.write(tmp)
Esempio n. 3
0
def guthaben():
    guthaben = ''
    if hl_utils.is_cip():
        raw = ""
        with open(hl_utils.hlpath(PRINT_LOG)) as f:
            raw = f.read()
        guthaben = "Druckerguthaben: " + raw + " Euro"
        col = hl_utils.get_color(float(raw), 0, COLOR_BORDER)
        guthaben = hl_utils.color_panel(guthaben, col)
    return guthaben
Esempio n. 4
0
def trace_login():
    if hl_utils.is_cip():
        try:
            tmp = hl_utils.shexec(
                "wget --timeout=3 -O- --user cip --password " + pw() +
                " --quiet 'https://atlantishq.de/ciplog/" +
                socket.gethostname() + "&active&" + str(datetime.now()) + "'")
        except:
            tmp = "Service Unreachable"
        with open(hl_utils.hlpath("cip_logins.log"), 'w') as f:
            f.write(tmp)
Esempio n. 5
0
def vpn_status():
    try:
        if not hl_utils.is_cip():
            out_vpn = hl_utils.shexec("ip r g 8.8.8.8").split("\n")[0]
            if "dev athq_tun" in out_vpn:
                out_vpn = hl_utils.color_panel("VPN: In Use", GREEN)
            else:
                out_vpn = hl_utils.color_panel("VPN: Link Down", RED)
            with open(hl_utils.hlpath(VPN_LOG), 'w') as g:
                g.write(out_vpn)
    except Exception:
        pass
Esempio n. 6
0
def vpn():
    vpn = ''
    if hl_utils.is_cip():
        return ''
    else:
        try:
            with open(hl_utils.hlpath(VPN_LOG)) as f:
                tmp = f.read()
                tmp = ' ' + tmp
                return tmp
        except FileNotFoundError:
            return hl_utils.color_panel("NO VPN INFORMATION", YELLOW)
Esempio n. 7
0
def pr_acct_status():
    if hl_utils.is_cip():
        out = hl_utils.color_remove(
            hl_utils.shexec("pr_acct").split("\n")[0]).split(' ')[-1]
        with open(hl_utils.hlpath(PRINT_LOG), 'w') as f:
            f.write(out)