%# 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! % from tob.log import sanitize_for_html <% tor = get('tor') if tor is None else tor oo_details = get('oo_details') if oo_details is None else oo_details oo_bw = get('oo_bw') # oo_show = get('oo_show', False) fp = get('family_fp', None) %> {{!header_row('Tor', 'Network Status', 'network')}} % if fp is None or len(fp) < 1:
This node is a Tor client. No network status available.
% else: % if oo_details.is_relay() and oo_details.is_bridge():
According to Onionoo the node with fingerprint '{{oo_details('fingerprint')}}' is a Relay and a Bridge. This shall not happen!
<% end if oo_details.is_relay() : publ = oo_details.published() if publ is not None: %> {{!standard_row('Status Time', publ)}} % end
Fingerprint
% fp = oo_details('fingerprint') {{fp}}
{{!standard_row('Type', 'Relay')}} {{!standard_row('Nickname', oo_details('nickname'))}} {{!standard_row('Platform', oo_details('platform'))}} {{!standard_row('Contact Info', oo_details('contact'))}} {{!standard_row('OR Addresses', ' | '.join(oo_details('or_addresses')))}} {{!standard_row('First Seen', oo_details('first_seen'))}} {{!standard_row('Last Seen', oo_details('last_seen'))}} % if oo_details('last_restarted'): {{!standard_row('Latest Restart', oo_details('last_restarted'))}} % end {{!standard_row('Latest Address Change', oo_details('last_changed_address_or_port'))}} % if oo_details('exit_addresses'): {{!standard_row('Exit Addresses', ' | '.join(oo_details('exit_addresses')))}} % end % if oo_details('dir_address'): {{!standard_row('DIR Address', oo_details('dir_address'))}} % end {{!standard_row('Running', oo_details('running'))}} % if oo_details('hibernating'): {{!standard_row('Hibernating', oo_details('hibernating'))}} % end % if oo_details('flags'): {{!standard_row('Flags', ' | '.join(oo_details('flags')))}} % end <% def location_row(datum='', value=''): # If value holds unicode characters, standard processing generates an exception! out = "" # Python2 try: out = unicode("""
{}
{}
""").format(datum, value) except: # Python3 try: out = """
{}
{}
""".format(datum, value) except: pass end end return out end geoip = get('geoip') if len(oo_details('or_addresses')) > 0: ip = oo_details('or_addresses')[0] %> {{!group_row('Location')}}
{{!location_row('Country', geoip.country(ip, oo_details('country')))}} {{!location_row('Country Name', geoip.country_name(ip, oo_details('country_name')))}} % if geoip.region_name(ip, oo_details('region_name')) is not None: {{!location_row('Region Name', geoip.region_name(ip, oo_details('region_name')))}} % end % if geoip.city_name(ip, oo_details('city_name')) is not None: {{!location_row('City Name', geoip.city_name(ip, oo_details('city_name')))}} % end % geoip_lat = geoip.latitude(ip, oo_details('latitude')) % geoip_long = geoip.longitude(ip, oo_details('longitude')) {{!location_row('Latitude', geoip_lat)}} {{!location_row('Longitude', geoip_long)}}
% if geoip_lat and geoip_long: % end
% end <% ep = oo_details('exit_policy') eps = oo_details('exit_policy_summary') ep6s = oo_details('exit_policy_v6_summary') if ep or eps or ep6s: %> {{!group_row('Exit Policies')}} % if ep is not None:
Policy Lines
% for item in ep: {{item}}
% end
% end % if eps is not None: % if 'accept' in eps: % ar = 'Accept' % epdata = eps['accept'] % else: % ar = 'Reject' % epdata = eps['reject'] % end
{{'{} Summary IPv4'.format(ar)}}
% for item in epdata: {{item}}
% end
% end % if ep6s is not None: % if 'accept' in ep6s: % ar = 'Accept' % epdata = ep6s['accept'] % else: % ar = 'Reject' % epdata = ep6s['reject'] % end
{{'{} Summary IPv6'.format(ar)}}
% for item in epdata: {{item}}
% end
% else: %# From Onionoo: %# "Missing if the relay rejects all connections to IPv6 addresses." {{!standard_row('Reject Summary IPv6', '1-65535')}} % end %end {{!group_row('Autonomous System')}} {{!standard_row('Host', oo_details('host_name'))}} {{!standard_row('Name', oo_details('as_name'))}} {{!standard_row('Number', oo_details('as_number'))}} % # 20190825: Family Members processing was removed here! % #TODO: Processing for a bridge % end