mirror of
https://github.com/hahwul/WebHackersWeapons.git
synced 2024-12-19 04:34:34 -05:00
y
This commit is contained in:
parent
25591fad6d
commit
71c13bf8a3
@ -1,20 +1,42 @@
|
|||||||
require 'json'
|
require 'json'
|
||||||
|
require 'yaml'
|
||||||
|
|
||||||
|
def get_os install
|
||||||
|
lst = []
|
||||||
|
if install['Linux'].length > 1
|
||||||
|
lst.push 'linux'
|
||||||
|
end
|
||||||
|
if install['MacOS'].length > 1
|
||||||
|
lst.push 'macos'
|
||||||
|
end
|
||||||
|
if install['Windows'].length > 1
|
||||||
|
lst.push 'windows'
|
||||||
|
end
|
||||||
|
return lst
|
||||||
|
end
|
||||||
|
|
||||||
file = File.read('./data.json')
|
file = File.read('./data.json')
|
||||||
data_hash = JSON.parse(file)
|
data_hash = JSON.parse(file)
|
||||||
|
|
||||||
data_hash.each do | name, obj |
|
data_hash.each do | name, obj |
|
||||||
puts "filename: "+name+".yaml"
|
filename = name.gsub(' ','_')+".yaml"
|
||||||
|
|
||||||
# Make object
|
# Make object
|
||||||
obj = {}
|
new_obj = {}
|
||||||
obj['name'] = name
|
new_obj['name'] = name
|
||||||
obj['description'] = obj['Description']
|
new_obj['description'] = obj['Description']
|
||||||
obj['url'] = '' # parse DATA
|
new_obj['url'] = '' # parse DATA
|
||||||
obj['category'] = 'tool'
|
new_obj['category'] = 'tool'
|
||||||
obj['types'] = []
|
new_obj['types'] = []
|
||||||
obj['lang'] = [] # parse DATA
|
if obj['Install'] != nil
|
||||||
obj['tags'] = []
|
new_obj['os'] = get_os(obj['Install'])
|
||||||
|
end
|
||||||
|
new_obj['lang'] = [] # parse DATA
|
||||||
|
new_obj['tags'] = []
|
||||||
|
|
||||||
# Save file
|
# Convert to YAML
|
||||||
|
yaml_data = YAML.dump(new_obj)
|
||||||
|
|
||||||
|
# Save yaml file
|
||||||
|
puts filename
|
||||||
|
#File.write("./data/#{filename}", yaml_data)
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user