<% # Note that this file is not a valid *.html file! # It is intended to be a bottlepy - style template # used for the scripting part of TheOnionBox! VERSION_STATUS_COLORS = {"new": "blue", "new in series": "blue", "obsolete": "red", "recommended": "green", "old": "red", "unrecommended": "red", "unknown": "cyan"} tor = get('tor') # This is Copy/Paste from ARM! # see dir-spec.txt for description of FLAGS FLAG_LABELS = {"Authority": "default", "BadExit": "danger", "BadDirectory": "danger", "Exit": "warning", "Fast": "primary", "Guard": "primary", "HSDir": "info", "Named": "primary", "Stable": "primary", "Running": "success", "Unnamed": "warning", "Valid": "success", "V2Dir": "default", "V3Dir": "default"} FLAG_COLORS = {"Authority": "black", "BadExit": "red", "BadDirectory": "red", "Exit": "orange", "Fast": "blue", "Guard": "blue", "HSDir": "deepskyblue", "Named": "blue", "Stable": "blue", "Running": "green", "Unnamed": "red", "Valid": "green", "V2Dir": "black", "V3Dir": "black", "Tor Communication Error": "red", 'none': 'cyan', "unknown": "black"} def flags(is_bridge = False): flags = ['unknown'] try: if is_bridge is True: oo_details = get('oo_details', None) if oo_details is not None: # get_flags() only works for relays, not for bridges flags = oo_details('flags') or ['unknown'] end else: flags = tor.get_flags() or ['unknown'] end except Exception as exc: pass end fs = '' for flag in flags: if fs is not '': fs += ' ' end fs += '' + flag + '' end if (len(flags) == 1) and (flags[0] == 'none'): a_o = get('accounting_on') if a_o == True: a_s = get('accounting_stats') if a_s.status != 'awake': fs += ' | could be due to ' fs += 'Hibernation Status' fs += ' ' + a_s.status + '' end end end return fs end %> <% bv = get('boxVersion') tvt = bv.Tor tvs = tor.get_version_short() %> {{!header_row('Tor', 'Local Status', 'stats')}}

Version

{{tor.get_version()}} % tvc = tor.get_version_current() % if tvc in VERSION_STATUS_COLORS:
{{tvc}} % else:
{{tvc}} % end % if tvt.is_latest_stable(tvs) is True: latest stable % end

% if tvt.is_latest_stable(tvs) is False:

Latest Stable Version

{{tvt.stable}}

<% end if tvt.is_latest_unstable(tvs) is False: %>

Latest Unstable Version

{{tvt.unstable}}

% end {{!standard_row('PID', tor.get_pid())}} {{!standard_row('User', tor.get_user())}} <% node_mode = 'Client' if tor.get_conf('BridgeRelay', None) == '1': node_mode = 'Bridge' elif tor.get_conf('ORPort', None): node_mode = 'Relay' end %> {{!standard_row('Mode', node_mode)}} % if node_mode != 'Client':

Fingerprint

<% _fngrprnt = 'failed' try: _fngrprnt = tor.get_fingerprint() except: pass end %> % if _fngrprnt is None or len(_fngrprnt) < 1:

Tor in client mode: No fingerprint.

% else:

%# {{!_fngrprnt}} %#

% end
{{!standard_row('Flags', flags(node_mode == 'Bridge'))}} % end