wmap 2.6.9 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/wadds +32 -20
  3. data/version.txt +2 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1fcf909fd9549bdc0c1339d986ec7812563474ef4c9e6b1aa76ca3790b038a5
4
- data.tar.gz: 2098e60fc667bf8ba02fa852242ffb2a515ebe04374177f4bf1a50bdb69a05ef
3
+ metadata.gz: 0306e6992ff754b34724ecd2c7e538531d747a8a0a7b75f6eabe12698f161ddd
4
+ data.tar.gz: 3282d7c8a30e6526c201dcb8c3270554b2079bb675d50b16e3753c55f144881c
5
5
  SHA512:
6
- metadata.gz: ea7e49f2b0913ad1159226268355ea9e339468929b614fff99e24b4e1b43fc4225560466930023f2691deb5b3547eaf9a41ada8cdc9128401389e96a5ef2865a
7
- data.tar.gz: ba6d2efe7f4ebf1b9bd761b5d4235744ddbdde8a398cefc07af7465a2c5c974e0f6c91c3dbf573659a6de2eca1b01af8434439e63c3a1b125de7b241e7d0feab
6
+ metadata.gz: 50a6e01ed24576c33592a1564116ee709ec8f9eaca5122fbe04408e546d4ea5799321dbf5f23ea4b8e3b2e90da0cdb9772733f295d28629cb05be9115c62da89
7
+ data.tar.gz: 38931b0d2de732debd9e4c09fca532b8f192067e3058ceb86a1db61a86a80bffa9a43b334c79a87e0e6887da83b21af2076044ca45b2bc43bf4b5845fafb1dfb
data/bin/wadds CHANGED
@@ -1,40 +1,52 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Executable to bulk add sites into the tracking data repository
3
3
  require "wmap"
4
+ require "optparse"
4
5
 
5
- def print_usage
6
- puts "Program to add sites from a file into local data repository. Usage: wadds [file_sites]"
6
+ # program command line options
7
+ options = {:data_dir => nil, :target => nil, :verbose => false}
8
+ parser = OptionParser.new do|opts|
9
+ opts.banner = Wmap.banner
10
+ opts.on('-d', '--data_dir data_dir', 'Web Mapper local cache data directory') do |data_dir|
11
+ options[:data_dir] = data_dir;
12
+ end
13
+ opts.on('-t', '--target target', 'Web Mapper target') do |target|
14
+ options[:target] = target;
15
+ end
16
+ opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
17
+ options[:verbose] = v;
18
+ end
19
+ opts.on('-h', '--help', 'Displays Help') do
20
+ puts opts
21
+ exit 0
22
+ end
7
23
  end
8
-
24
+ parser.parse!
9
25
  puts Wmap.banner
10
- print_usage
11
- abort "Incorrect program argument!" unless File.exist?(ARGV[0])
12
26
 
13
- if ARGV.length == 1
27
+ if options[:data_dir]
14
28
  # Log the command entry
15
- Log_dir = File.dirname(__FILE__)+'/../logs/'
16
- elsif ARGV.length == 2
17
- # Log to the instance running directory
18
- Log_dir = File.dirname(__FILE__)+'/../logs/' + ARGV[1]
29
+ Log_dir = Pathname.new(options[:data_dir]).join('logs')
30
+ else
31
+ Log_dir=Pathname.new(Gem.loaded_specs['wmap'].full_gem_path).join('logs')
19
32
  end
20
33
  Dir.mkdir(Log_dir) unless Dir.exist?(Log_dir)
21
- Wmap.wlog("Execute the command: wadds #{ARGV[0]}","wadds",Log_dir+"wmap.log")
22
34
 
23
- if ARGV.length == 1
24
- puts puts "Invoke the SiteTracker."
25
- st=Wmap::SiteTracker.instance
26
- st.verbose=false
27
- elsif ARGV.length == 2
35
+ Wmap.wlog("Execute the command: wadds #{options[:target]}","wadds",Log_dir+"wmap.log")
36
+
37
+ if File.exist?(options[:target]) && options[:data_dir]
28
38
  puts puts "Invoke the SiteTracker."
29
39
  st=Wmap::SiteTracker.instance
30
- st.verbose=false
31
- st.data_dir=ARGV[1]
40
+ st.verbose=options[:verbose]
41
+ st.data_dir = options[:data_dir]
42
+ st.sites_file = st.data_dir + "/" + "sites"
43
+ st.load_site_stores_from_file(st.sites_file)
32
44
  else
33
45
  aborts "Error firing up SiteTracker instance!"
34
46
  end
35
47
 
36
48
  # Evaluate the argument and update the data store accordingly
37
- sites=st.file_2_list(ARGV[0]).map { |x| st.url_2_site(x) }
49
+ sites=st.file_2_list(options[:target]).map { |x| st.url_2_site(x) }
38
50
  if sites.length > 0
39
51
  news=st.adds(sites)
40
52
  puts news
@@ -42,5 +54,5 @@ if sites.length > 0
42
54
  st=nil
43
55
  else
44
56
  st=nil
45
- abort "No site entry found in file: #{ARGV[0]}. Please check your file format to ensure one site per line."
57
+ abort "No site entry found in file: #{options[:target]}. Please check your file format to ensure one site per line."
46
58
  end
@@ -3,8 +3,8 @@
3
3
  ###############################################################################
4
4
  package = wmap
5
5
  # wmap version 2.0 == web_discovery version 1.5.3
6
- version = 2.6.9
7
- date = 2019-12-02
6
+ version = 2.7.0
7
+ date = 2020-03-09
8
8
 
9
9
  author = Sam (Yang) Li
10
10
  email = yang.li@owasp.org
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wmap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.9
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam (Yang) Li
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-02 00:00:00.000000000 Z
11
+ date: 2020-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dnsruby