2022-08-18 08:55:54 -06:00
|
|
|
# https://api.github.com/repos/hahwul/dalfox/languages
|
|
|
|
#
|
|
|
|
#
|
|
|
|
require 'yaml'
|
|
|
|
|
|
|
|
langs = []
|
|
|
|
Dir.entries("./weapons").each do | name |
|
|
|
|
if name.strip != "." || name != ".."
|
|
|
|
begin
|
|
|
|
data = YAML.load(File.open("./weapons/#{name}"))
|
|
|
|
if data['url'].include? "//github.com"
|
|
|
|
t = data['url'].split("/")
|
|
|
|
lang = `curl -s https://api.github.com/repos/#{t[3]}/#{t[4]}/languages | jq 'to_entries | max_by(.value) | .key'`
|
|
|
|
lang_str = lang.gsub("\"","").gsub("\n","")
|
|
|
|
if lang_str != "documentation_url"
|
2022-08-18 18:07:59 -06:00
|
|
|
puts "hit #{filename}"
|
2022-08-18 08:55:54 -06:00
|
|
|
data['lang'] = lang_str
|
|
|
|
yaml_data = YAML.dump(data)
|
|
|
|
File.write("./weapons/#{filename}", yaml_data)
|
|
|
|
langs.push lang_str
|
|
|
|
else
|
2022-08-18 18:07:59 -06:00
|
|
|
puts "denied #{filename}"
|
2022-08-18 08:55:54 -06:00
|
|
|
end
|
2022-08-18 18:07:59 -06:00
|
|
|
sleep(90)
|
2022-08-18 08:55:54 -06:00
|
|
|
end
|
|
|
|
rescue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
puts langs.uniq
|