您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

fetch_ssllabs_useragents 659B

12345678910111213141516171819
  1. #!/usr/bin/env ruby
  2. require 'open-uri'
  3. require 'json'
  4. PROTOCOLS = {
  5. 768 => 'SSL 3',
  6. 769 => 'TLS 1.0',
  7. 770 => 'TLS 1.1',
  8. 771 => 'TLS 1.2'
  9. }
  10. uas = JSON.load open 'https://api.dev.ssllabs.com/api/v3/getClients'
  11. uas = uas.collect do |ua|
  12. name = [ua['name'], ua['version'], ua['platform']].compact.join ' '
  13. protocols = ua['lowestProtocol'].upto(ua['highestProtocol']).collect { |n| PROTOCOLS[n] }
  14. ciphers = ua['suiteIds'].zip(ua['suiteNames']).collect { |i, n| ["0x#{i.to_s(16).upcase.rjust(2, '0')}", n]}.to_h
  15. [name, { protocols: protocols, ciphers: ciphers }]
  16. end
  17. File.write 'config/user-agents-ciphers.json', JSON.pretty_generate(uas, {indent: "\t"})