Skip to content

Instantly share code, notes, and snippets.

@bernstein7
Last active March 31, 2022 07:28
Show Gist options
  • Save bernstein7/2bb4a09ed4d754dd712be9ddd9208b55 to your computer and use it in GitHub Desktop.
Save bernstein7/2bb4a09ed4d754dd712be9ddd9208b55 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'net/http'
require 'json'
require 'csv'
uri = URI('https://raw.githubusercontent.com/db1000n-coordinators/LoadTestConfig/main/config.v0.7.json')
response = Net::HTTP.get(uri)
data = JSON.parse(response)
CSV.open('targets.csv', 'w') do |csv|
data['jobs'].map do |row|
if row['type'] == 'http'
csv << [row.dig('args', 'request', 'path')]
elsif row['type'] == 'tcp'
csv << ["tcp://#{row.dig('args', 'address')}"]
end
end
end
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
http://gosuslugi.ru
https://gosuslugi.ru
http://smev03.gosuslugi.ru
https://smev03.gosuslugi.ru
http://smev3.gosuslugi.ru
https://smev3.gosuslugi.ru
tcp://109.207.1.90:25
tcp://109.207.2.218:53
tcp://213.59.255.175:53
http://41.gosuslugi.ru
https://41.gosuslugi.ru
http://72.gosuslugi.ru
https://72.gosuslugi.ru
http://44.gosuslugi.ru
https://44.gosuslugi.ru
http://83.gosuslugi.ru
https://83.gosuslugi.ru
tcp://213.59.254.2:25
tcp://213.59.254.2:587
tcp://213.59.254.2:993
tcp://212.58.160.101:10180
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment