=== Authorities.aspx === <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Authorities.aspx.cs" Inherits="Authorities" %> Authorities

List of authorities

This is a list of tor authorities from the official source code (here)

Cache age: <%=Minutes %> Minutes
<%=Server.HtmlEncode(string.Join("\n",AuthList))%>
This page has been created because of repeated trouble with Advanced Onion Router. Replace the authorities list if you can no longer connect to the TOR network using that client.
View Source of this
Raw output
Copyright © 2016 Kevin Gut
=== Authorities.aspx.cs === using System; using System.Collections.Generic; using System.Net; using System.IO; /// /// Shows TOR Authorities /// public partial class Authorities : System.Web.UI.Page { /// /// This is the source file for the authorities /// public const string SOURCE = "https://gitweb.torproject.org/tor.git/plain/src/app/config/auth_dirs.inc"; /// /// This will contain all the authorities /// protected string[] AuthList = null; protected int Minutes = 0; /// /// Chars to replace with "nothing" in source /// private readonly string[] Repl = new string[] {"\"","\r","\n" }; /// /// Called when the site loads /// protected void Page_Load(object sender, EventArgs e) { //We allow source printing if (Request["Source"] == "1") { Source(); } else { //We implement some sort of basic cache here to not tank the source file server if (Session["AUTHLIST"] == null || Session["CACHEAGE"]==null || !string.IsNullOrEmpty(Request.Form["refresh"])) { Session["AUTHLIST"] = AuthList = getAuth(); Minutes = 0; Session["CACHEAGE"] = DateTime.Now; } else { AuthList = (string[])Session["AUTHLIST"]; Minutes = (int)Math.Round(DateTime.Now.Subtract((DateTime)Session["CACHEAGE"]).TotalMinutes); } if (AuthList == null) { AuthList = new string[] { "Error reading source file. Please try again later." }; } if (Request["raw"] == "1") { Response.Clear(); Response.ContentType = "text/plain"; Response.Write(string.Join("\r\n", AuthList)); Response.End(); } } } /// /// Gets the authorities list from the source file /// /// List of authorities private string[] getAuth() { string Lines = string.Empty; using (WebClient wc = new WebClient()) { try { //Download the source file Lines = wc.DownloadString(SOURCE).Trim(); } catch { return null; } } while (Lines.Contains("/*")) { Lines = Lines.Substring(0, Lines.IndexOf("/*")) + Lines.Substring(Lines.IndexOf("*/", Lines.IndexOf("/*")) + 2); } //create parts string[] Parts = Lines.Split(','); for (int i = 0; i < Parts.Length; i++) { //remove unneeded chars foreach(string s in Repl) { Parts[i] = Parts[i].Replace(s, ""); } //remove unneeded whitespace while (Parts[i].Contains(" ")) { Parts[i] = Parts[i].Replace(" ", " "); } //remove more whitespace Parts[i] = Parts[i].Trim(); } return Parts; } /// /// Displays the source code of the current file /// private void Source() { string Answer = string.Format("=== {0} ===\r\n{1}\r\n=== {2} ===\r\n{3}", Path.GetFileName(Request.PhysicalPath), File.ReadAllText(Request.PhysicalPath), Path.GetFileName(Request.PhysicalPath + ".cs"), File.ReadAllText(Request.PhysicalPath + ".cs")); Response.Clear(); Response.ContentType="text/plain"; Response.Write(Answer); Response.End(); } }