-
Notifications
You must be signed in to change notification settings - Fork 94
/
auto_archive.rb
34 lines (30 loc) · 939 Bytes
/
auto_archive.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# frozen_string_literal: true
require 'csv'
require 'fileutils'
require 'time'
puts '[-] Download index data..'
system 'curl --silent "https://gitlab.com/exploit-database/exploitdb/-/raw/main/files_exploits.csv" > files_exploits.csv'
puts '[+] Download Complate!'
puts '[-] Loading index data..'
tpath = './archive/'
target = CSV.read('files_exploits.csv')
puts '[+] Loaded'
puts '[-] Check and Download Exploit codes..'
i = 0
target.each do |row|
if row[2]['(Metasploit)']
# puts row[2]
if File.file?(tpath + row[1])
else
FileUtils.mkpath(File.dirname(tpath + row[1]) + '/')
rbfile = 'https://raw.githubusercontent.com/offensive-security/exploit-database/master/' + row[1]
puts rbfile + ' ==> ' + tpath + row[1]
system 'curl --silent ' + rbfile + ' > ' + tpath + row[1]
end
end
i += 1
end
f = File.new('last_change','w')
f.write(Time.now.to_s)
f.close
puts '[+] Finish auto-archive!'