2022-08-18 10:55:54 -04: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-19 01:33:52 -04:00
|
|
|
puts "hit #{name}"
|
2022-08-18 10:55:54 -04:00
|
|
|
data['lang'] = lang_str
|
|
|
|
yaml_data = YAML.dump(data)
|
2022-08-19 01:33:52 -04:00
|
|
|
File.write("./weapons/#{name}", yaml_data)
|
2022-08-18 10:55:54 -04:00
|
|
|
langs.push lang_str
|
|
|
|
else
|
2022-08-19 01:33:52 -04:00
|
|
|
puts "denied #{name}"
|
2022-08-18 10:55:54 -04:00
|
|
|
end
|
2022-08-18 20:07:59 -04:00
|
|
|
sleep(90)
|
2022-08-18 10:55:54 -04:00
|
|
|
end
|
2022-08-19 01:33:52 -04:00
|
|
|
rescue => e
|
|
|
|
puts e
|
2022-08-18 10:55:54 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
puts langs.uniq
|