[tor-commits] [depictor/master] Output files into an 'out' directory.

2014-12-07 Thread tom
commit 8164f7e0275886cbf5ecd89593a6317a88311139
Author: Tom Ritter 
Date:   Sun Dec 7 20:10:17 2014 -0500

Output files into an 'out' directory.

(And add a TODO.)
---
 .gitignore   |6 +++---
 favicon.ico  |  Bin 1150 -> 0 bytes
 out/favicon.ico  |  Bin 0 -> 1150 bytes
 website.py   |1 +
 write_website.py |6 +++---
 5 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/.gitignore b/.gitignore
index d6e7aaa..e54e242 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,6 @@
 *.p
 *.swp
 stem
-index.html
-consensus-health.html
-download-stats.csv
\ No newline at end of file
+out/index.html
+out/consensus-health.html
+out/download-stats.csv
\ No newline at end of file
diff --git a/favicon.ico b/favicon.ico
deleted file mode 100644
index 48060b1..000
Binary files a/favicon.ico and /dev/null differ
diff --git a/out/favicon.ico b/out/favicon.ico
new file mode 100644
index 000..48060b1
Binary files /dev/null and b/out/favicon.ico differ
diff --git a/website.py b/website.py
index f5f1869..812a07b 100755
--- a/website.py
+++ b/website.py
@@ -910,6 +910,7 @@ class WebsiteWriter:
Write the footer of the HTML page containing the blurb that is 
on
every page of the metrics website.
"""
+   #XXX Write the git version and steam version the page was 
generated with
self.site.write("\n"
+ "\n"
+ "\n"
diff --git a/write_website.py b/write_website.py
index e44ea58..6316c0c 100755
--- a/write_website.py
+++ b/write_website.py
@@ -53,7 +53,7 @@ def main():
   votes, vote_fetching_issues, vote_fetching_runtimes = get_votes()
 
   # updates the download statistics file
-  f = open('download-stats.csv', 'a')
+  f = open(os.path.join('out', 'download-stats.csv'), 'a')
   for ds in consensus_fetching_runtimes:
 f.write("%s,%i,%i\n" % (ds, time.time() * 1000, 
int(consensus_fetching_runtimes[ds] * 1000)))
   f.close()
@@ -64,8 +64,8 @@ def main():
   w.set_consensuses(consensuses)
   w.set_votes(votes)
   w.set_known_params(CONFIG['known_params'])
-  w.write_website(os.path.join(os.path.dirname(__file__), 
'consensus-health.html'), True)
-  w.write_website(os.path.join(os.path.dirname(__file__), 'index.html'), False)
+  w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)
+  w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
 
 
 def get_consensuses():

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Typo in last commit, this reads from the output directory also

2014-12-07 Thread tom
commit 7285622aede106c268159642efa4519bdc0b7107
Author: Tom Ritter 
Date:   Sun Dec 7 20:27:59 2014 -0500

Typo in last commit, this reads from the output directory also
---
 website.py |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/website.py b/website.py
index 812a07b..7b88fb8 100755
--- a/website.py
+++ b/website.py
@@ -6,6 +6,7 @@ Produces an HTML file for easily viewing voting and consensus 
differences
 Ported from Java version Doctor
 """
 
+import os
 import time
 import operator
 import datetime
@@ -580,7 +581,7 @@ class WebsiteWriter:
"""
Write some download statistics.
"""
-   f = open('download-stats.csv', 'r')
+   f = open(os.path.join('out', 'download-stats.csv'), 'r')
lines = f.readlines()
f.close()
 

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Move stylesheet to out directory also

2014-12-08 Thread tom
commit 9fa4ea27f765a45984a2e114a1b9e51315df5385
Author: Tom Ritter 
Date:   Mon Dec 8 08:25:16 2014 -0500

Move stylesheet to out directory also
---
 out/stylesheet-ltr.css |  161 
 stylesheet-ltr.css |  161 
 2 files changed, 161 insertions(+), 161 deletions(-)

diff --git a/out/stylesheet-ltr.css b/out/stylesheet-ltr.css
new file mode 100644
index 000..ce0c54e
--- /dev/null
+++ b/out/stylesheet-ltr.css
@@ -0,0 +1,161 @@
+body {
+background-color: white;
+margin-top: 0px;
+font-family: Arial, Helvetica, sans-serif;
+font-size: 1em;
+font-style: normal;
+color: #00;
+padding-top: 0px;
+}
+
+/* images */
+
+img {
+border: 0;
+}
+
+
+li {
+   margin: .2em .2em .2em 1em;
+}
+
+/* this centers the page */
+
+.center {
+text-align: center;
+background-color: white;
+margin: 0px auto 0 auto;
+width: 85%;
+}
+
+.center table {
+margin-left: auto;
+margin-right: auto;
+text-align: left;
+}
+
+div.bottom {
+font-size: 0.8em;
+margin-top: 0.5cm;
+margin-left: 1em;
+margin-right: 1em;
+text-align: center;
+}
+
+/* The main column (left text) */
+
+div.main-column {
+padding: 15px 0 10px 10px;
+text-indent: 0pt;
+font-size: 1em;
+direction: ltr;
+text-align: left;
+}
+
+/* formatting styles */
+
+h2 {
+font-size: 1.4em;
+margin-bottom: 0em;
+font-weight: bold;
+margin-top: 0;
+}
+
+h3 {
+font-size: 1.2em;
+margin-bottom: 0em;
+font-weight: bold;
+margin-top: 0;
+}
+
+p {
+margin-top: 0;
+margin-bottom: 1em;
+}
+
+a:link {
+color: blue;
+font-size: 1em;
+}
+
+a:visited {
+color: purple;
+font-size: 1em;
+}
+
+a.anchor {
+font-size: 1em;
+color: black;
+font-weight: bold;
+text-decoration: none;
+}
+
+td {
+vertical-align: top;
+}
+
+/* the banner */
+
+table.banner {
+width: 100%;
+height: 79px;
+margin-left: auto;
+margin-right: auto;
+}
+
+td.banner-left {
+   /* This is done with an  in the HTML so it can be clickable
+background-image: url("images/top-left.png");
+background-repeat: no-repeat; */
+width: 193px;
+}
+
+td.banner-middle {
+background-color: #00802B;
+background-image: url("/images/top-middle.png");
+background-repeat: repeat-x;
+vertical-align: bottom;
+padding-bottom: 10px;
+color: white;
+font-weight: bold;
+font-size: 1.2em;
+}
+
+td.banner-middle a, td.banner-middle a:visited {
+margin-right: 5px;
+color: white;
+font-weight: bold;
+font-size: 1em;
+}
+
+td.banner-middle a:hover {
+color: #FF7F00;
+font-weight: bold;
+font-size: 1em;
+}
+
+td.banner-right {
+background-image: url("/images/top-right.png");
+background-repeat: no-repeat;
+width: 15px;
+background-position: right;
+padding-top: 8px;
+}
+
+.banner-middle a.current {
+text-decoration: none;
+color: #FF7F00;
+font-weight: bold;
+font-size: 1em;
+width: auto;
+left: -50px;
+}
+
+hr {
+   background-color:#002200;
+   color:#66;
+   font-size:1px;
+   height:1px;
+   line-height:0;
+   margin:15px 0 5px;
+}
diff --git a/stylesheet-ltr.css b/stylesheet-ltr.css
deleted file mode 100644
index ce0c54e..000
--- a/stylesheet-ltr.css
+++ /dev/null
@@ -1,161 +0,0 @@
-body {
-background-color: white;
-margin-top: 0px;
-font-family: Arial, Helvetica, sans-serif;
-font-size: 1em;
-font-style: normal;
-color: #00;
-padding-top: 0px;
-}
-
-/* images */
-
-img {
-border: 0;
-}
-
-
-li {
-   margin: .2em .2em .2em 1em;
-}
-
-/* this centers the page */
-
-.center {
-text-align: center;
-background-color: white;
-margin: 0px auto 0 auto;
-width: 85%;
-}
-
-.center table {
-margin-left: auto;
-margin-right: auto;
-text-align: left;
-}
-
-div.bottom {
-font-size: 0.8em;
-margin-top: 0.5cm;
-margin-left: 1em;
-margin-right: 1em;
-text-align: center;
-}
-
-/* The main column (left text) */
-
-div.main-column {
-padding: 15px 0 10px 10px;
-text-indent: 0pt;
-font-size: 1em;
-direction: ltr;
-text-align: left;
-}
-
-/* formatting styles */
-
-h2 {
-font-size: 1.4em;
-margin-bottom: 0em;
-font-weight: bold;
-margin-top: 0;
-}
-
-h3 {
-font-size: 1.2em;
-margin-bottom: 0em;
-font-weight: bold;
-margin-top: 0;
-}
-
-p {
-margin-top: 0;
-margin-bottom: 1em;
-}
-
-a:link {
-color: blue;
-font-size: 1em;
-}
-
-a:visited {
-color: purple;
-font-size: 1em;
-}
-
-a.anchor {
-font-size: 1em;
-color: black;
-font-weight: bold;
-text-decoration: none;
-}
-
-td {
-vertical-align: top;
-}
-
-/* the banner */
-
-table.banner {
-width: 100%;
-height: 79px;
-margin-left: auto;
-margin-right: auto;
-}
-
-td

[tor-commits] [depictor/master] Note some TODOs

2014-12-08 Thread tom
commit 2739306ffd41feb0a273a4fc76d6b5b65a7cb7b6
Author: Tom Ritter 
Date:   Mon Dec 8 07:42:34 2014 -0600

Note some TODOs
---
 website.py |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/website.py b/website.py
index 7b88fb8..78fbd2a 100755
--- a/website.py
+++ b/website.py
@@ -43,6 +43,7 @@ class WebsiteWriter:
def set_consensuses(self, c):
self.consensuses = c
self.consensus = max(c.itervalues(), 
key=operator.attrgetter('valid_after'))
+# XXX - Change this to be a list of known dir auths, don't 
calculate it off the consensus because sometimes they're missing entirely
self.known_authorities = set([r.nickname for r in 
self.consensus.routers.values() if 'Authority' in r.flags and r.nickname != 
"Tonga"])
self.known_authorities.update([r.nickname for r in 
self.consensus.directory_authorities])
def set_votes(self, v):
@@ -911,7 +912,7 @@ class WebsiteWriter:
Write the footer of the HTML page containing the blurb that is 
on
every page of the metrics website.
"""
-   #XXX Write the git version and steam version the page was 
generated with
+   #XXX Write the git version and stem version the page was 
generated with
self.site.write("\n"
+ "\n"
+ "\n"

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Include full path for the download-stats file

2015-03-23 Thread tom
commit 892710c61039b3f2730997b562accf9bdaf62c12
Author: Tom Ritter 
Date:   Tue Dec 16 23:46:56 2014 -0500

Include full path for the download-stats file
---
 website.py   |2 +-
 write_website.py |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/website.py b/website.py
index 4b20837..4279651 100755
--- a/website.py
+++ b/website.py
@@ -584,7 +584,7 @@ class WebsiteWriter:
"""
Write some download statistics.
"""
-   f = open(os.path.join('out', 'download-stats.csv'), 'r')
+   f = open(os.path.join(os.path.dirname(__file__), 'out', 
'download-stats.csv'), 'r')
lines = f.readlines()
f.close()
 
diff --git a/write_website.py b/write_website.py
index 6316c0c..f445a8e 100755
--- a/write_website.py
+++ b/write_website.py
@@ -53,7 +53,7 @@ def main():
   votes, vote_fetching_issues, vote_fetching_runtimes = get_votes()
 
   # updates the download statistics file
-  f = open(os.path.join('out', 'download-stats.csv'), 'a')
+  f = open(os.path.join(os.path.dirname(__file__), 'out', 
'download-stats.csv'), 'a')
   for ds in consensus_fetching_runtimes:
 f.write("%s,%i,%i\n" % (ds, time.time() * 1000, 
int(consensus_fetching_runtimes[ds] * 1000)))
   f.close()



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] New TODO

2015-03-23 Thread tom
commit 9183914bae69ee4758c1022d49db2a0269dcb7af
Author: Tom Ritter 
Date:   Tue Dec 16 23:20:15 2014 -0500

New TODO
---
 website.py |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/website.py b/website.py
index 30c0da2..4b20837 100755
--- a/website.py
+++ b/website.py
@@ -147,7 +147,8 @@ class WebsiteWriter:
+ "\n"
+ "  \n")

-   # XXX Should also write the keyszie here
+   # XXX Should also write the keysize here
+   # XXX Should also write if the displayed consensus is out of 
date
signingFPs = {sig.identity:sig.method for sig in 
self.consensus.signatures}
for dirauth_nickname in self.known_authorities: 
self.site.write("  \n" 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Add a TODO for myself

2015-03-23 Thread tom
commit e00f25504ea5bf77daa1bda3e2dc15ff227d4fde
Author: Tom Ritter 
Date:   Wed Dec 10 13:27:42 2014 -0600

Add a TODO for myself
---
 website.py |1 +
 1 file changed, 1 insertion(+)

diff --git a/website.py b/website.py
index 78fbd2a..30c0da2 100755
--- a/website.py
+++ b/website.py
@@ -147,6 +147,7 @@ class WebsiteWriter:
+ "\n"
+ "  \n")

+   # XXX Should also write the keyszie here
signingFPs = {sig.identity:sig.method for sig in 
self.consensus.signatures}
for dirauth_nickname in self.known_authorities: 
self.site.write("  \n" 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Add the full fingerprint (in tiny text) to the big table.

2015-03-23 Thread tom
commit 5dc8eba37cbebe3787094fa8b272a48eb8939f8b
Author: Tom Ritter 
Date:   Wed Mar 4 15:20:52 2015 +0100

Add the full fingerprint (in tiny text) to the big table.
---
 out/stylesheet-ltr.css |4 
 website.py |   15 ---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/out/stylesheet-ltr.css b/out/stylesheet-ltr.css
index ce0c54e..77bd55f 100644
--- a/out/stylesheet-ltr.css
+++ b/out/stylesheet-ltr.css
@@ -94,6 +94,10 @@ td {
 vertical-align: top;
 }
 
+.tiny {
+  font-size: 3px;
+}
+
 /* the banner */
 
 table.banner {
diff --git a/website.py b/website.py
index 4279651..b5db508 100755
--- a/website.py
+++ b/website.py
@@ -854,10 +854,19 @@ class WebsiteWriter:
if relay_fp in self.consensus.routers and \
"Named" in self.consensus.routers[relay_fp].flags and \
 relay_nickname[0].isdigit():
-   self.site.write(""
-   + relay_fp.substring(0, 8) + "\n")
+   self.site.write("" \
+   + relay_fp.substring(0, 8) \
+   + "" \
+   + relay_fp \
+   + "\n")
else:
-   self.site.write("" + relay_fp[0:8] + "\n")
+   self.site.write("" \
+   + relay_fp[0:8]
+   + "" \
+   + relay_fp
+   + "\n")
 
self.site.write("" + relay_nickname + "\n")
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Print Identity and Signing Key Lengths

2015-03-23 Thread tom
commit cbd243e81813ad4f7df94191b7abc28ddabdd31e
Author: Tom Ritter 
Date:   Sun Mar 8 13:43:35 2015 -0500

Print Identity and Signing Key Lengths
---
 website.py |   48 ++--
 1 file changed, 34 insertions(+), 14 deletions(-)

diff --git a/website.py b/website.py
index 3b95a57..d33d3fc 100755
--- a/website.py
+++ b/website.py
@@ -10,6 +10,8 @@ import os
 import time
 import operator
 import datetime
+from base64 import b64decode
+from Crypto.PublicKey import RSA
 
 class WebsiteWriter:
consensus = None
@@ -43,7 +45,7 @@ class WebsiteWriter:
def set_consensuses(self, c):
self.consensuses = c
self.consensus = max(c.itervalues(), 
key=operator.attrgetter('valid_after'))
-# XXX - Change this to be a list of known dir auths, don't 
calculate it off the consensus because sometimes they're missing entirely
+   # XXX - Change this to be a list of known dir auths, don't 
calculate it off the consensus because sometimes they're missing entirely
self.known_authorities = set([r.nickname for r in 
self.consensus.routers.values() if 'Authority' in r.flags and r.nickname != 
"Tonga"])
self.known_authorities.update([r.nickname for r in 
self.consensus.directory_authorities])
def set_votes(self, v):
@@ -150,7 +152,6 @@ class WebsiteWriter:
+ "\n"
+ "  \n")

-   # XXX Should also write the keysize here
# XXX Should also write if the displayed consensus is out of 
date
signingFPs = {sig.identity:sig.method for sig in 
self.consensus.signatures}
for dirauth_nickname in self.known_authorities: 
@@ -468,6 +469,14 @@ class WebsiteWriter:
+ "\n")
 

#-
+   def getKeySize(self, key):
+   key = key.replace("-BEGIN RSA PUBLIC KEY-", "")
+   key = key.replace("-END RSA PUBLIC KEY-", "")
+   key = key.replace("\n", "")
+   keyDER = b64decode(key)
+   keyPub = RSA.importKey(keyDER)
+   return str(keyPub.size() + 1)
+
def _write_authority_keys(self):
"""
Write authority keys and their expiration dates.
@@ -481,8 +490,17 @@ class WebsiteWriter:
+ "\n"
+ "  \n"
+ "\n"
-   + "\n"
-   + "  \n")
+   + "\n"
+   + "\n"
+   + "\n"
+   + "  \n"
+   + "  \n"
+   + "Name"
+   + "Expirey"
+   + "Identity Key Len."
+   + "Signing Key Len."
+   + "  \n")
+
if not self.votes:
self.site.write("  (No 
votes.)\n")
else:
@@ -493,25 +511,27 @@ class WebsiteWriter:
voteDirKeyExpires = 
vote.directory_authorities[0].key_certificate.expires
if voteDirKeyExpires - 
self.directory_key_warning_time < datetime.datetime.now():
self.site.write("  \n"
-   +  "" + dirauth_nickname + "\n"
-   +  "dir-key-expires "
-   + 
voteDirKeyExpires.isoformat().replace("T", " ") + "\n"
-   + "  \n");
+   + "" + dirauth_nickname + "\n"
+   + ""
+   + 
voteDirKeyExpires.isoformat().replace("T", " ") + "\n")
else:
self.site.write("  \n"
-   +  "" + 
dirauth_nickname + "\n"
-   +  "dir-key-expires "  
-   + 
voteDirKeyExpires.isoformat().replace("T", " ") + "\n"
-   + "  \n");
+   + "" + dirauth_nicknam

[tor-commits] [depictor/master] Add links to Atlas and Globe

2015-03-23 Thread tom
commit 8dddb1dd4d645bc0a52c7d195f881571d7c3eea5
Author: Tom Ritter 
Date:   Wed Mar 4 15:34:05 2015 +0100

Add links to Atlas and Globe
---
 out/stylesheet-ltr.css |4 
 website.py |8 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/out/stylesheet-ltr.css b/out/stylesheet-ltr.css
index 77bd55f..8ace3a9 100644
--- a/out/stylesheet-ltr.css
+++ b/out/stylesheet-ltr.css
@@ -98,6 +98,10 @@ td {
   font-size: 3px;
 }
 
+.agt {
+ font-size: .8em;
+}
+
 /* the banner */
 
 table.banner {
diff --git a/website.py b/website.py
index b5db508..baca4e7 100755
--- a/website.py
+++ b/website.py
@@ -868,7 +868,13 @@ class WebsiteWriter:
+ relay_fp
+ "\n")
 
-   self.site.write("" + relay_nickname + "\n")
+   self.site.write("" \
+   + relay_nickname \
+   + " https://atlas.torproject.org/#details/"; \
+   + relay_fp + "\">Atlas | " \
+   + "https://globe.torproject.org/#/relay/"; + relay_fp \
+   + "\">Globe" \
+   + "\n")
 
relevantFlags = set()
for dirauth_nickname in self.votes:



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Link each relay to itself in the previous

2015-03-23 Thread tom
commit 93b83263743555f5b1f20df803288e54ac0a8f50
Author: Tom Ritter 
Date:   Thu Mar 5 00:46:07 2015 +0100

Link each relay to itself in the previous
---
 website.py |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/website.py b/website.py
index 2f8c45c..3b95a57 100755
--- a/website.py
+++ b/website.py
@@ -865,15 +865,13 @@ class WebsiteWriter:
if relay_fp in self.consensus.routers and \
"Named" in self.consensus.routers[relay_fp].flags and \
 relay_nickname[0].isdigit():
-   self.site.write("" \
+   self.site.write("" \
+ relay_fp.substring(0, 8) \
+ "" \
+ relay_fp \
+ "\n")
else:
-   self.site.write("" \
+   self.site.write("" \
+ relay_fp[0:8]
+ "" \
+ relay_fp
@@ -884,7 +882,9 @@ class WebsiteWriter:
+ " https://atlas.torproject.org/#details/"; \
+ relay_fp + "\">Atlas | " \
+ "https://globe.torproject.org/#/relay/"; + relay_fp \
-   + "\">Globe" \
+   + "\">Globe | ⇜" \
+ "\n")
 
relevantFlags = set()



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Update the debugging pattern and method

2015-03-23 Thread tom
commit bf3715500c98241fc955bd874d1a9416d6f1b111
Author: Tom Ritter 
Date:   Wed Mar 4 17:54:19 2015 +0100

Update the debugging pattern and method
---
 website.py |   23 +++
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/website.py b/website.py
index 2de8cc2..8c4fd0d 100755
--- a/website.py
+++ b/website.py
@@ -947,18 +947,33 @@ class WebsiteWriter:
 if __name__ == '__main__':
"""
I found that the most effective way to test this independently was to 
pickle the 
-   downloaded conensuses in ./consensus_health_checker.py like this:
+   downloaded conensuses in ./write_website.py like this:
 
import pickle
pickle.dump(consensuses, open('consensus.p', 'wb'))
pickle.dump(votes, open('votes.p', 'wb'))
 
-   Then I can run ./website.pt and pdb.set_trace() where needed to debug
+   Then I can run ./website.py and pdb.set_trace() where needed to debug
"""
+   import stem
import pickle
w = WebsiteWriter()
+
c = pickle.load(open('consensus.p', 'rb'))
-   w.set_consensus(c.values()[0])#Just take one of them
+   w.set_consensuses(c)
v = pickle.load(open('votes.p', 'rb'))
w.set_votes(v)
-   w.write_website('consensus-health-test.html')
+
+   CONFIG = stem.util.conf.config_dict('consensus', {
+'ignored_authorities': [],
+'bandwidth_authorities': [],
+'known_params': [],
+})
+   config = stem.util.conf.get_config("consensus")
+   config.load(os.path.join(os.path.dirname(__file__), 'data', 
'consensus.cfg'))
+   w.set_known_params(CONFIG['known_params'])
+
+   w.write_website(os.path.join(os.path.dirname(__file__), 'out', \
+   'consensus-health-' + 
w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html'), True)
+   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)
+   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
\ No newline at end of file



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] gzip the archival version of consensus-health.html

2015-03-23 Thread tom
commit 932b67dfde560fcc1739fe200040c39a5368b986
Author: Tom Ritter 
Date:   Sun Mar 8 11:46:24 2015 -0500

gzip the archival version of consensus-health.html
---
 write_website.py |8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/write_website.py b/write_website.py
index 99e18c5..c0deac6 100755
--- a/write_website.py
+++ b/write_website.py
@@ -12,6 +12,7 @@ import time
 import datetime
 import operator
 import traceback
+import subprocess
 
 import stem.descriptor
 import stem.descriptor.remote
@@ -64,11 +65,14 @@ def main():
   w.set_consensuses(consensuses)
   w.set_votes(votes)
   w.set_config(CONFIG)
-  w.write_website(os.path.join(os.path.dirname(__file__), 'out', \
-'consensus-health-' + w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + 
'.html'), True)
   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)
   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
 
+  archived = os.path.join(os.path.dirname(__file__), 'out', \
+ 'consensus-health-' + 
w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html')
+  subprocess.call(["cp", os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), archived])
+  subprocess.call(["gzip", "-9", archived])
+
 
 def get_consensuses():
   """



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Attempt to reduce memorysize before forking a bunch of times...

2015-03-23 Thread tom
commit 487b01f79309521ea15f3781ce0fcd0482152c10
Author: Tom Ritter 
Date:   Sun Mar 8 14:29:37 2015 -0500

Attempt to reduce memorysize before forking a bunch of times...
---
 write_website.py |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/write_website.py b/write_website.py
index f761643..6fe9089 100755
--- a/write_website.py
+++ b/write_website.py
@@ -71,9 +71,14 @@ def main():
w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)
w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
 
+   # delete giant data structures for subprocess forking by piling hacks 
on top of each other
consensus_time = w.get_consensus_time()
+   import gc
+   del w, consensuses, votes
+   gc.collect()
+   time.sleep(1)
archived = os.path.join(os.path.dirname(__file__), 'out', \
-   'consensus-health-' + 
consensus_time.strftime("%Y-%m-%d-%H-%M") + '.html')
+   'consensus-health-' + 
consensus_time.strftime("%Y-%m-%d-%H-%M") + '.html')
subprocess.call(["cp", os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), archived])
subprocess.call(["gzip", "-9", archived])
subprocess.call(["ln", "-s", archived + ".gz", archived])
@@ -82,11 +87,9 @@ def main():
weeks_to_keep = 3
files = [f for f in os.listdir(os.path.join(os.path.dirname(__file__), 
'out'))]
for f in files:
-   print f
if f.startswith("consensus-health-"):
-   f = f.replace("consensus-health-", "").replace(".html", 
"")
+   f = f.replace("consensus-health-", "").replace(".html", 
"").replace(".gz", "")
f_time = datetime.datetime.strptime(f, "%Y-%m-%d-%H-%M")
-   print "\t", f_time
if (consensus_time - f_time).days > weeks_to_keep * 7:
os.remove(f)
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Add commented debugging to write_website.py

2015-03-23 Thread tom
commit b0f88d0eab7dc04bb5eac7fa3ca12e204feb2b2d
Author: Tom Ritter 
Date:   Sun Mar 8 12:58:27 2015 -0500

Add commented debugging to write_website.py
---
 write_website.py |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/write_website.py b/write_website.py
index c0deac6..415c7ea 100755
--- a/write_website.py
+++ b/write_website.py
@@ -59,8 +59,12 @@ def main():
 f.write("%s,%i,%i\n" % (ds, time.time() * 1000, 
int(consensus_fetching_runtimes[ds] * 1000)))
   f.close()
   
-  # produces the website
+  # great for debugging
+  #import pickle
+  #pickle.dump(consensuses, open('consensus.p', 'wb'))
+  #pickle.dump(votes, open('votes.p', 'wb'))
 
+  # produces the website
   w = WebsiteWriter()
   w.set_consensuses(consensuses)
   w.set_votes(votes)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] print a 'missing' line if a BWAuth is missing.

2015-03-23 Thread tom
commit c206e542d28ec5748915a17efc3f13be3c377a47
Author: Tom Ritter 
Date:   Wed Mar 4 20:01:19 2015 +0100

print a 'missing' line if a BWAuth is missing.
---
 website.py   |   15 +++
 write_website.py |2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/website.py b/website.py
index 8c4fd0d..2f8c45c 100755
--- a/website.py
+++ b/website.py
@@ -52,8 +52,9 @@ class WebsiteWriter:
self.consensus_expirey = timedelta
def set_directory_key_warning_time(self, timedelta):
self.directory_key_warning_time = timedelta
-   def set_known_params(self, kp):
-   self.known_params = kp
+   def set_config(self, config):
+   self.known_params = config['known_params']
+   self.bandwidth_authorities = config['bandwidth_authorities']
def get_consensus_time(self):
return self.consensus.valid_after
 
@@ -533,7 +534,6 @@ class WebsiteWriter:
if not self.votes:
self.site.write("  (No 
votes.)\n")
else:
-   #XXX - loop over all bwauths, and print if vote is not 
present
for dirauth_nickname in self.votes:
vote = self.votes[dirauth_nickname]

@@ -548,6 +548,13 @@ class WebsiteWriter:
+ "" + str(bandwidthWeights)
+ " Measured values in w lines\n"
+ "  \n")
+   for dirauth_nickname in self.bandwidth_authorities:
+   if dirauth_nickname not in self.votes:
+   self.site.write("  \n"
+   + "" + dirauth_nickname + 
"\n"
+   + "Missing 
vote\n"
+   + "  \n")
+
self.site.write("\n")
 

#-
@@ -971,7 +978,7 @@ if __name__ == '__main__':
 })
config = stem.util.conf.get_config("consensus")
config.load(os.path.join(os.path.dirname(__file__), 'data', 
'consensus.cfg'))
-   w.set_known_params(CONFIG['known_params'])
+   w.set_config(CONFIG)
 
w.write_website(os.path.join(os.path.dirname(__file__), 'out', \
'consensus-health-' + 
w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html'), True)
diff --git a/write_website.py b/write_website.py
index 3e6a500..99e18c5 100755
--- a/write_website.py
+++ b/write_website.py
@@ -63,7 +63,7 @@ def main():
   w = WebsiteWriter()
   w.set_consensuses(consensuses)
   w.set_votes(votes)
-  w.set_known_params(CONFIG['known_params'])
+  w.set_config(CONFIG)
   w.write_website(os.path.join(os.path.dirname(__file__), 'out', \
 'consensus-health-' + w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + 
'.html'), True)
   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Unify files on tabs, not spaces

2015-03-23 Thread tom
commit d53048d3d5cc26cda821acbd366903e90e7ce25f
Author: Tom Ritter 
Date:   Sun Mar 8 13:46:51 2015 -0500

Unify files on tabs, not spaces
---
 write_website.py |  161 +++---
 1 file changed, 80 insertions(+), 81 deletions(-)

diff --git a/write_website.py b/write_website.py
index 415c7ea..9c5463e 100755
--- a/write_website.py
+++ b/write_website.py
@@ -27,120 +27,119 @@ from website import WebsiteWriter
 DIRECTORY_AUTHORITIES = stem.descriptor.remote.get_authorities()
 
 CONFIG = stem.util.conf.config_dict('consensus', {
-  'ignored_authorities': [],
-  'bandwidth_authorities': [],
-  'known_params': [],
+   'ignored_authorities': [],
+   'bandwidth_authorities': [],
+   'known_params': [],
 })
 
 downloader = stem.descriptor.remote.DescriptorDownloader(
-  timeout = 60,
-  fall_back_to_authority = False,
-  document_handler = stem.descriptor.DocumentHandler.DOCUMENT,
+   timeout = 60,
+   fall_back_to_authority = False,
+   document_handler = stem.descriptor.DocumentHandler.DOCUMENT,
 )
 
 
 @lru_cache()
 def directory_authorities():
-  return dict((k, v) for (k, v) in DIRECTORY_AUTHORITIES.items() if k not in 
CONFIG['ignored_authorities'])
+   return dict((k, v) for (k, v) in DIRECTORY_AUTHORITIES.items() if k not 
in CONFIG['ignored_authorities'])
 
 
 def main():
-  # loads configuration data
-
-  config = stem.util.conf.get_config("consensus")
-  config.load(os.path.join(os.path.dirname(__file__), 'data', 'consensus.cfg'))
-
-  consensuses, consensus_fetching_issues, consensus_fetching_runtimes = 
get_consensuses()
-  votes, vote_fetching_issues, vote_fetching_runtimes = get_votes()
-
-  # updates the download statistics file
-  f = open(os.path.join(os.path.dirname(__file__), 'out', 
'download-stats.csv'), 'a')
-  for ds in consensus_fetching_runtimes:
-f.write("%s,%i,%i\n" % (ds, time.time() * 1000, 
int(consensus_fetching_runtimes[ds] * 1000)))
-  f.close()
-  
-  # great for debugging
-  #import pickle
-  #pickle.dump(consensuses, open('consensus.p', 'wb'))
-  #pickle.dump(votes, open('votes.p', 'wb'))
-
-  # produces the website
-  w = WebsiteWriter()
-  w.set_consensuses(consensuses)
-  w.set_votes(votes)
-  w.set_config(CONFIG)
-  w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)
-  w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
-
-  archived = os.path.join(os.path.dirname(__file__), 'out', \
- 'consensus-health-' + 
w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html')
-  subprocess.call(["cp", os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), archived])
-  subprocess.call(["gzip", "-9", archived])
+   # loads configuration data
+   config = stem.util.conf.get_config("consensus")
+   config.load(os.path.join(os.path.dirname(__file__), 'data', 
'consensus.cfg'))
+
+   consensuses, consensus_fetching_issues, consensus_fetching_runtimes = 
get_consensuses()
+   votes, vote_fetching_issues, vote_fetching_runtimes = get_votes()
+
+   # updates the download statistics file
+   f = open(os.path.join(os.path.dirname(__file__), 'out', 
'download-stats.csv'), 'a')
+   for ds in consensus_fetching_runtimes:
+   f.write("%s,%i,%i\n" % (ds, time.time() * 1000, 
int(consensus_fetching_runtimes[ds] * 1000)))
+   f.close()
+
+   # great for debugging
+   #import pickle
+   #pickle.dump(consensuses, open('consensus.p', 'wb'))
+   #pickle.dump(votes, open('votes.p', 'wb'))
+
+   # produces the website
+   w = WebsiteWriter()
+   w.set_consensuses(consensuses)
+   w.set_votes(votes)
+   w.set_config(CONFIG)
+   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)
+   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
+
+   archived = os.path.join(os.path.dirname(__file__), 'out', \
+   'consensus-health-' + 
w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html')
+   subprocess.call(["cp", os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), archived])
+   subprocess.call(["gzip", "-9", archived])
 
 
 def get_consensuses():
-  """

[tor-commits] [depictor/master] Update the License with my name and new years.

2015-03-23 Thread tom
commit 1743b81b4c2425e5a88bf03d2f82ed9ec3e408ed
Author: Tom Ritter 
Date:   Tue Mar 3 14:11:12 2015 +0100

Update the License with my name and new years.
---
 LICENSE |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/LICENSE b/LICENSE
index 338d619..c38a97d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2013, Damian Johnson and The Tor Project
+Copyright (c) 2013,14,15 Damian Johnson, Tom Ritter, and The Tor Project
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Highlight only the non-matching parameter

2015-03-23 Thread tom
commit f04375a1a7afc822bd6593539808dc71155a6dc7
Author: Tom Ritter 
Date:   Wed Mar 4 17:36:26 2015 +0100

Highlight only the non-matching parameter
---
 website.py |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/website.py b/website.py
index baca4e7..fbdf4ee 100755
--- a/website.py
+++ b/website.py
@@ -421,23 +421,25 @@ class WebsiteWriter:
for dirauth_nickname in self.known_authorities:
if dirauth_nickname in self.votes:
vote = self.votes[dirauth_nickname]
-   #XXX - Only Write invalid/odd parameter 
in red
-   conflictOrInvalid = False
+   conflictOrInvalid = []
if vote.params:
for p in vote.params:
if (p not in 
self.known_params and not p.startswith('bwauth')) or \
   p not in 
self.consensus.params or \
   
self.consensus.params[p] != vote.params[p]:
-   
conflictOrInvalid = True
+   
conflictOrInvalid.append(p)
break

if conflictOrInvalid:
self.site.write("  \n"
+ "" + dirauth_nickname + "\n"
-   + "params")
+   + "params")
for p in vote.params:
-   self.site.write(" " + p 
+ "=" + str(vote.params[p]))
-   self.site.write("\n"
+   if p in 
conflictOrInvalid:
+   
self.site.write(" " + p + "=" + str(vote.params[p]) + 
"")
+   else:
+   
self.site.write(" " + p + "=" + str(vote.params[p]))
+   self.site.write("\n"
+ "  \n")
else:
self.site.write("  \n"



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Write a historical version

2015-03-23 Thread tom
commit 4ef382841c2e2fe1057f36cbb4beab2559c74f5f
Author: Tom Ritter 
Date:   Wed Mar 4 17:53:12 2015 +0100

Write a historical version
---
 .gitignore   |2 +-
 website.py   |2 ++
 write_website.py |2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index e54e242..ad4f990 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,5 +3,5 @@
 *.swp
 stem
 out/index.html
-out/consensus-health.html
+out/consensus-health*
 out/download-stats.csv
\ No newline at end of file
diff --git a/website.py b/website.py
index fbdf4ee..2de8cc2 100755
--- a/website.py
+++ b/website.py
@@ -54,6 +54,8 @@ class WebsiteWriter:
self.directory_key_warning_time = timedelta
def set_known_params(self, kp):
self.known_params = kp
+   def get_consensus_time(self):
+   return self.consensus.valid_after
 

#-
def _write_page_header(self, include_relay_flags):
diff --git a/write_website.py b/write_website.py
index f445a8e..3e6a500 100755
--- a/write_website.py
+++ b/write_website.py
@@ -64,6 +64,8 @@ def main():
   w.set_consensuses(consensuses)
   w.set_votes(votes)
   w.set_known_params(CONFIG['known_params'])
+  w.write_website(os.path.join(os.path.dirname(__file__), 'out', \
+'consensus-health-' + w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + 
'.html'), True)
   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)
   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Create symlink for .html file, necessary for serving gzips

2015-03-23 Thread tom
commit 9e3fb71a4589341caea3393db4d5e5b34179daa3
Author: Tom Ritter 
Date:   Sun Mar 8 13:47:26 2015 -0500

Create symlink for .html file, necessary for serving gzips
---
 write_website.py |1 +
 1 file changed, 1 insertion(+)

diff --git a/write_website.py b/write_website.py
index 9c5463e..06fe35f 100755
--- a/write_website.py
+++ b/write_website.py
@@ -75,6 +75,7 @@ def main():
'consensus-health-' + 
w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html')
subprocess.call(["cp", os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), archived])
subprocess.call(["gzip", "-9", archived])
+   subprocess.call(["ln", "-s", archived + ".gz", archived])
 
 
 def get_consensuses():



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Better recommended versions display

2015-03-23 Thread tom
commit abb8dff5d3f196e824351b1805d322af351f806a
Author: Tom Ritter 
Date:   Wed Mar 18 11:01:57 2015 -0700

Better recommended versions display

This will highlight the individual versions that are different between an 
authority and the consensus.
---
 website.py |   46 ++
 1 file changed, 18 insertions(+), 28 deletions(-)

diff --git a/website.py b/website.py
index d33d3fc..e75eca0 100755
--- a/website.py
+++ b/website.py
@@ -355,35 +355,25 @@ class WebsiteWriter:
vote = self.votes[dirauth_nickname]

if vote.client_versions:
-   if 
self.consensus.client_versions == vote.client_versions:
-   self.site.write("  
\n"
-   + "  " + 
dirauth_nickname + "\n"
-   + "
client-versions ")
-   self.site.write(", 
".join([str(v) for v in vote.client_versions]))
-   self.site.write(  
"\n"
-   + "  \n");
-   else:
-   self.site.write("  
\n"
-   + "" + dirauth_nickname + "\n"
-   + "client-versions ")
-   self.site.write(", 
".join([str(v) for v in vote.client_versions]))
-   
self.site.write("\n"
-   + "  \n")
+   self.site.write("  \n"
+   + "" + dirauth_nickname 
+ "\n"
+   + "client-versions ")
+   self.site.write(", 
".join([(str(v) if v in self.consensus.client_versions else "" + str(v) + "")
+   for v in 
vote.client_versions]))
+   self.site.write("".join([(", 
" + str(v) + "")
+   for v in 
self.consensus.client_versions if v not in vote.client_versions]))
+   self.site.write("\n"
+   + "  \n")
if vote.server_versions:
-   if 
self.consensus.server_versions == vote.server_versions:
-   self.site.write("  
\n"
-   + " \n"
-   + "
server-versions ")
-   self.site.write(", 
".join([str(v) for v in vote.server_versions]))
-   
self.site.write("\n"
-   + "  \n");
-   else:
-   self.site.write("  
\n"
-   + "" + dirauth_nickname + "\n"
-   + "server-versions ");
-   self.site.write(", 
".join([str(v) for v in vote.server_versions]))
-   
self.site.write("\n"
-   + "  \n")
+   self.site.write("  \n"
+   + "" + dirauth_nickname 
+ "\n"
+   + "server-versions ")
+   self.site.write(", 
".join([(str(v) if v in self.consensus.server_versions else "" + str(v) + "")
+   for v in 
vote.server_versions]))
+   self.site.write("

[tor-commits] [depictor/master] Remove old archival files after 3 weeks

2015-03-23 Thread tom
commit 1bb85aa4be437c54ee687ed67bc0f553140e180b
Author: Tom Ritter 
Date:   Sun Mar 8 14:11:01 2015 -0500

Remove old archival files after 3 weeks
---
 write_website.py |   15 ++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/write_website.py b/write_website.py
index 06fe35f..f761643 100755
--- a/write_website.py
+++ b/write_website.py
@@ -71,12 +71,25 @@ def main():
w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)
w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
 
+   consensus_time = w.get_consensus_time()
archived = os.path.join(os.path.dirname(__file__), 'out', \
-   'consensus-health-' + 
w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html')
+   'consensus-health-' + 
consensus_time.strftime("%Y-%m-%d-%H-%M") + '.html')
subprocess.call(["cp", os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), archived])
subprocess.call(["gzip", "-9", archived])
subprocess.call(["ln", "-s", archived + ".gz", archived])
 
+   # remove old files
+   weeks_to_keep = 3
+   files = [f for f in os.listdir(os.path.join(os.path.dirname(__file__), 
'out'))]
+   for f in files:
+   print f
+   if f.startswith("consensus-health-"):
+   f = f.replace("consensus-health-", "").replace(".html", 
"")
+   f_time = datetime.datetime.strptime(f, "%Y-%m-%d-%H-%M")
+   print "\t", f_time
+   if (consensus_time - f_time).days > weeks_to_keep * 7:
+   os.remove(f)
+
 
 def get_consensuses():
"""



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Fix bug so we list all the DirAuths even if they are not listed in the consensus.

2015-04-02 Thread tom
commit 86b5181cc11ab0bcfeb8ef0fc0ff7216c6dd
Author: Tom Ritter 
Date:   Thu Apr 2 17:57:09 2015 -0400

Fix bug so we list all the DirAuths even if they are not listed in the 
consensus.
---
 data/consensus.cfg |2 +-
 website.py |5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/data/consensus.cfg b/data/consensus.cfg
index f8394b2..c57144a 100644
--- a/data/consensus.cfg
+++ b/data/consensus.cfg
@@ -6,8 +6,8 @@ ignored_authorities turtles
 
 bandwidth_authorities moria1
 bandwidth_authorities gabelmoo
-bandwidth_authorities maatuska
 bandwidth_authorities tor26
+bandwidth_authorities longclaw
 
 # recognized tor consensus parameters
 
diff --git a/website.py b/website.py
index e75eca0..fa7bb8e 100755
--- a/website.py
+++ b/website.py
@@ -10,6 +10,7 @@ import os
 import time
 import operator
 import datetime
+import stem.descriptor.remote
 from base64 import b64decode
 from Crypto.PublicKey import RSA
 
@@ -45,9 +46,9 @@ class WebsiteWriter:
def set_consensuses(self, c):
self.consensuses = c
self.consensus = max(c.itervalues(), 
key=operator.attrgetter('valid_after'))
-   # XXX - Change this to be a list of known dir auths, don't 
calculate it off the consensus because sometimes they're missing entirely
self.known_authorities = set([r.nickname for r in 
self.consensus.routers.values() if 'Authority' in r.flags and r.nickname != 
"Tonga"])
self.known_authorities.update([r.nickname for r in 
self.consensus.directory_authorities])
+   self.known_authorities.update([r for r in 
stem.descriptor.remote.get_authorities().keys() if r != "Tonga"])
def set_votes(self, v):
self.votes = v
def set_consensus_expirey(self, timedelta):
@@ -185,8 +186,6 @@ class WebsiteWriter:
else:
self.site.write("Missing Signature, and "
+ authority.nickname + " does not have 
a consensus available\n")
-   else:
-   self.site.write("Authority not listed as a dir-source\n")
self.site.write("  \n")
self.site.write("\n")
 



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Correctly remove files older than the given time period

2015-04-02 Thread tom
commit 5f704b845654cb883bdb05460bafa9543d9c4846
Author: Tom Ritter 
Date:   Thu Apr 2 17:57:43 2015 -0400

Correctly remove files older than the given time period
---
 website.py   |2 +-
 write_website.py |6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/website.py b/website.py
index fa7bb8e..668f6eb 100755
--- a/website.py
+++ b/website.py
@@ -992,4 +992,4 @@ if __name__ == '__main__':
w.write_website(os.path.join(os.path.dirname(__file__), 'out', \
'consensus-health-' + 
w.get_consensus_time().strftime("%Y-%m-%d-%H-%M") + '.html'), True)
w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), True)
-   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
\ No newline at end of file
+   w.write_website(os.path.join(os.path.dirname(__file__), 'out', 
'index.html'), False)
diff --git a/write_website.py b/write_website.py
index 6fe9089..9346d3e 100755
--- a/write_website.py
+++ b/write_website.py
@@ -88,10 +88,10 @@ def main():
files = [f for f in os.listdir(os.path.join(os.path.dirname(__file__), 
'out'))]
for f in files:
if f.startswith("consensus-health-"):
-   f = f.replace("consensus-health-", "").replace(".html", 
"").replace(".gz", "")
-   f_time = datetime.datetime.strptime(f, "%Y-%m-%d-%H-%M")
+   f_time = f.replace("consensus-health-", 
"").replace(".html", "").replace(".gz", "")
+   f_time = datetime.datetime.strptime(f_time, 
"%Y-%m-%d-%H-%M")
if (consensus_time - f_time).days > weeks_to_keep * 7:
-   os.remove(f)
+   
os.remove(os.path.join(os.path.dirname(__file__), 'out', f))
 
 
 def get_consensuses():

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Download from authorities in serial

2015-11-05 Thread tom
commit 53739518034d04b271fc810fd7d5f862e909f0b4
Author: Tom Ritter 
Date:   Thu Nov 5 16:25:41 2015 -0600

Download from authorities in serial

This mirrors doctor's patch here: 
https://gitweb.torproject.org/doctor.git/commit/?id=b2772926bbf9b5f1565b07be96faf053f64bda71
Downloading from authorities in parallell is throwing off the download 
times.  It will take a week to get correct times into the page though...
---
 write_website.py |   15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/write_website.py b/write_website.py
index 9346d3e..a160e54 100755
--- a/write_website.py
+++ b/write_website.py
@@ -115,28 +115,27 @@ def get_votes():
 
 
 def _get_documents(label, resource):
-   queries, documents, issues, runtimes = {}, {}, [], {}
+   documents, issues, runtimes = {}, [], {}
 
for authority in directory_authorities().values():
if authority.v3ident is None:
continue# not a voting authority
 
-   queries[authority.nickname] = downloader.query(
+   query = downloader.query(
resource,
endpoints = [(authority.address, authority.dir_port)],
default_params = False,
)
 
-   for authority, query in queries.items():
try:
-   result = query.run()
-   documents[authority] = result[0]
-   runtimes[authority] = query.runtime
+   start_time = time.time()
+   documents[authority.nickname] = query.run()[0]
+   runtimes[authority.nickname] = time.time() - start_time
except Exception, exc:
if label == 'vote':
# try to download the vote via the other 
authorities
 
-   v3ident = 
directory_authorities()[authority].v3ident
+   v3ident = 
directory_authorities()[authority.nickname].v3ident
 
query = downloader.query(
'/tor/status-vote/current/%s' % v3ident,
@@ -146,7 +145,7 @@ def _get_documents(label, resource):
query.run(True)
 
if not query.error:
-   documents[authority] = list(query)[0]
+   documents[authority.nickname] = 
list(query)[0]
continue
 
issues.append(('AUTHORITY_UNAVAILABLE', label, 
authority, query.download_url, exc))

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Sort flags in the big relay table #18712

2016-04-06 Thread tom
commit bbc61f0a16692bc66cfc0da6aa15239609a0fa39
Author: Tom Ritter 
Date:   Wed Apr 6 08:58:29 2016 -0500

Sort flags in the big relay table #18712
---
 website.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/website.py b/website.py
index 668f6eb..84d7d98 100755
--- a/website.py
+++ b/website.py
@@ -906,6 +906,7 @@ class WebsiteWriter:
consensusFlags = self.consensus.routers[relay_fp].flags
relevantFlags.update(consensusFlags)
 
+   relevantFlags = sorted(list(relevantFlags))
for dirauth_nickname in self.votes:
vote = self.votes[dirauth_nickname]
if relay_fp in vote.routers:

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Do not gzip the historical output pages of consensus-health.

2016-02-28 Thread tom
commit 7ee901afc20da1e1d5216fb84f37ad837d4a069e
Author: Tom Ritter 
Date:   Sun Feb 28 18:09:26 2016 -0600

Do not gzip the historical output pages of consensus-health.

We never configured Apache to handle this, and this will just use more disk 
space but make the pages accessible.
---
 write_website.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/write_website.py b/write_website.py
index a160e54..d998be1 100755
--- a/write_website.py
+++ b/write_website.py
@@ -80,8 +80,9 @@ def main():
archived = os.path.join(os.path.dirname(__file__), 'out', \
'consensus-health-' + 
consensus_time.strftime("%Y-%m-%d-%H-%M") + '.html')
subprocess.call(["cp", os.path.join(os.path.dirname(__file__), 'out', 
'consensus-health.html'), archived])
-   subprocess.call(["gzip", "-9", archived])
-   subprocess.call(["ln", "-s", archived + ".gz", archived])
+   #Do not gzip anymore, as Apache is not configured for it.
+   #subprocess.call(["gzip", "-9", archived])
+   #subprocess.call(["ln", "-s", archived + ".gz", archived])
 
# remove old files
weeks_to_keep = 3

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [depictor/master] Better Authority Tracking

2014-11-19 Thread tom
commit 47bfb4ce2c0d48ddbf2b01d0b9ff98264caabe36
Author: Tom Ritter 
Date:   Wed Nov 19 13:00:16 2014 -0500

Better Authority Tracking

If an authority has been down for an extended period of time, such that 
it's not in the router list, we would omit it from the tables.
---
 website.py |   26 ++
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/website.py b/website.py
index 76014ac..f5f1869 100755
--- a/website.py
+++ b/website.py
@@ -42,7 +42,8 @@ class WebsiteWriter:
def set_consensuses(self, c):
self.consensuses = c
self.consensus = max(c.itervalues(), 
key=operator.attrgetter('valid_after'))
-   self.known_authorities = [r.nickname for r in 
self.consensus.routers.values() if 'Authority' in r.flags and r.nickname != 
"Tonga"]
+   self.known_authorities = set([r.nickname for r in 
self.consensus.routers.values() if 'Authority' in r.flags and r.nickname != 
"Tonga"])
+   self.known_authorities.update([r.nickname for r in 
self.consensus.directory_authorities])
def set_votes(self, v):
self.votes = v
def set_consensus_expirey(self, timedelta):
@@ -148,11 +149,20 @@ class WebsiteWriter:
for dirauth_nickname in self.known_authorities: 
self.site.write("  \n" 
+ "" + dirauth_nickname + "\n")
-   authority = [r for r in self.consensus.routers.values() 
if r.nickname == dirauth_nickname and 'Authority' in r.flags][0]
-   self.site.write("http://"; + 
authority.address + ":" + str(authority.dir_port)
-   + "/tor/status-vote/current/consensus\">consensus 
http://";
-   + authority.address + ":" + str(authority.dir_port)
-   + 
"/tor/status-vote/current/authority\">vote\n")
+   
+   #Try and find a structure that has it's IP & Port
+   authority = [r for r in self.consensus.routers.values() 
if r.nickname == dirauth_nickname and 'Authority' in r.flags]
+   if not authority:
+   authority = [d for d in 
self.consensus.directory_authorities if d.nickname == dirauth_nickname]
+   if authority:
+   authority = authority[0]
+   self.site.write("http://"; + 
authority.address + ":" + str(authority.dir_port)
+   + 
"/tor/status-vote/current/consensus\">consensus http://";
+   + authority.address + ":" + 
str(authority.dir_port)
+   + 
"/tor/status-vote/current/authority\">vote\n")
+   else:
+   self.site.write("Missing entirely from consensus\n")
+   
if dirauth_nickname in [d.nickname for d in 
self.consensus.directory_authorities]:
#The above structure is sufficient for getting 
the address & port
# but we need this structure for the 
authority's fingerprint
@@ -165,10 +175,10 @@ class WebsiteWriter:
+ 
self.consensuses[authority.nickname].valid_after.isoformat().replace("T", " ")
+ "\n")
else:
-   self.site.write("Missing Signature! "
+   self.site.write("Missing Signature, and "
+ authority.nickname + " does not have 
a consensus available\n")
else:
-   self.site.write("Missing 
From Consensus\n")
+   self.site.write("Authority not listed as a dir-source\n")
self.site.write("  \n")
self.site.write("\n")
 

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits