build-approved-routers 673 B

12345678910111213141516171819202122
  1. #!/usr/bin/ruby
  2. require "yaml"
  3. require 'db'
  4. require 'db-config'
  5. verbose = ARGV.first == "-v"
  6. db = Db.new($CONFIG['database']['dbname'], $CONFIG['database']['user'], $CONFIG['database']['password'])
  7. db.transaction_begin
  8. named = db.query2("
  9. SELECT fingerprint, router_id, nickname_id, nick, first_seen, last_seen
  10. FROM router NATURAL JOIN router_claims_nickname NATURAL JOIN nickname
  11. WHERE named")
  12. while (n=named.next) do
  13. puts "# (r##{n['router_id']},n##{n['nickname_id']}); first_seen: #{n['first_seen']}, last_seen: #{n['last_seen']}"
  14. fpr = n['fingerprint'].split(/(....)/).delete_if{|x| x=="" }.join(' ')
  15. puts "#{n['nick']} #{fpr}}"
  16. end
  17. db.transaction_commit