ronin-scanners 0.1.4 → 1.0.0.pre1

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 (63) hide show
  1. data/.document +4 -0
  2. data/.gemtest +0 -0
  3. data/.gitignore +11 -0
  4. data/.rspec +1 -0
  5. data/.yardopts +2 -0
  6. data/COPYING.txt +339 -0
  7. data/{History.txt → ChangeLog.md} +7 -7
  8. data/Gemfile +45 -0
  9. data/README.md +125 -0
  10. data/Rakefile +39 -14
  11. data/bin/ronin-scan-dork +20 -0
  12. data/bin/ronin-scan-nmap +20 -0
  13. data/bin/ronin-scan-proxies +20 -0
  14. data/bin/ronin-scan-spider +20 -0
  15. data/bin/ronin-scanner +20 -0
  16. data/bin/ronin-scanners +13 -5
  17. data/gemspec.yml +31 -0
  18. data/lib/ronin/database/migrations/scanners.rb +25 -0
  19. data/lib/ronin/database/migrations/scanners/1.0.0.rb +51 -0
  20. data/lib/ronin/scanners.rb +7 -5
  21. data/lib/ronin/scanners/dork.rb +173 -0
  22. data/lib/ronin/scanners/host_name_scanner.rb +67 -0
  23. data/lib/ronin/scanners/http_scanner.rb +195 -0
  24. data/lib/ronin/scanners/ip_scanner.rb +75 -0
  25. data/lib/ronin/scanners/nmap.rb +303 -5
  26. data/lib/ronin/scanners/{nikto/nikto.rb → proxies.rb} +11 -26
  27. data/lib/ronin/scanners/resolv_scanner.rb +73 -0
  28. data/lib/ronin/scanners/reverse_lookup_scanner.rb +76 -0
  29. data/lib/ronin/scanners/scanner.rb +371 -0
  30. data/lib/ronin/scanners/{nikto.rb → scanners.rb} +8 -5
  31. data/lib/ronin/scanners/site_map.rb +62 -0
  32. data/lib/ronin/scanners/spider.rb +117 -0
  33. data/lib/ronin/scanners/tcp_port_scanner.rb +72 -0
  34. data/lib/ronin/scanners/udp_port_scanner.rb +72 -0
  35. data/lib/ronin/scanners/url_scanner.rb +79 -0
  36. data/lib/ronin/scanners/version.rb +3 -4
  37. data/lib/ronin/ui/cli/commands/scan/dork.rb +39 -0
  38. data/lib/ronin/ui/cli/commands/scan/nmap.rb +105 -0
  39. data/lib/ronin/ui/cli/commands/scan/proxies.rb +82 -0
  40. data/lib/ronin/ui/cli/commands/scan/spider.rb +71 -0
  41. data/lib/ronin/ui/cli/commands/scanner.rb +43 -0
  42. data/lib/ronin/ui/cli/scanner_command.rb +118 -0
  43. data/ronin-scanners.gemspec +60 -0
  44. data/spec/scanners/host_name_scanner_spec.rb +24 -0
  45. data/spec/scanners/ip_scanner_spec.rb +24 -0
  46. data/spec/scanners/resolv_scanner_spec.rb +26 -0
  47. data/spec/scanners/reverse_lookup_scanner_spec.rb +26 -0
  48. data/spec/scanners/scanner_spec.rb +89 -0
  49. data/spec/scanners/scanners_spec.rb +9 -0
  50. data/spec/scanners/tcp_port_scanner_spec.rb +27 -0
  51. data/spec/scanners/udp_port_scanner_spec.rb +27 -0
  52. data/spec/scanners/url_scanner_spec.rb +37 -0
  53. data/spec/spec_helper.rb +4 -3
  54. metadata +261 -116
  55. data.tar.gz.sig +0 -1
  56. data/Manifest.txt +0 -16
  57. data/README.txt +0 -106
  58. data/lib/ronin/scanners/nikto/nikto_task.rb +0 -183
  59. data/lib/ronin/scanners/nmap/nmap.rb +0 -74
  60. data/lib/ronin/scanners/nmap/nmap_task.rb +0 -290
  61. data/spec/scanners_spec.rb +0 -11
  62. data/tasks/spec.rb +0 -9
  63. metadata.gz.sig +0 -0
@@ -1,9 +1,8 @@
1
1
  #
2
- #--
3
2
  # Ronin Scanners - A Ruby library for Ronin that provides Ruby interfaces to
4
3
  # various third-party security scanners.
5
4
  #
6
- # Copyright (c) 2008-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2008-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
7
6
  #
8
7
  # This program is free software; you can redistribute it and/or modify
9
8
  # it under the terms of the GNU General Public License as published by
@@ -18,8 +17,12 @@
18
17
  # You should have received a copy of the GNU General Public License
19
18
  # along with this program; if not, write to the Free Software
20
19
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
- #++
22
20
  #
23
21
 
24
- require 'ronin/scanners/nikto/nikto_task'
25
- require 'ronin/scanners/nikto/nikto'
22
+ require 'ronin/auto_load'
23
+
24
+ module Ronin
25
+ module Scanners
26
+ include AutoLoad
27
+ end
28
+ end
@@ -0,0 +1,62 @@
1
+ #
2
+ # Ronin Scanners - A Ruby library for Ronin that provides Ruby interfaces to
3
+ # various third-party security scanners.
4
+ #
5
+ # Copyright (c) 2008-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # This program is free software; you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation; either version 2 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program; if not, write to the Free Software
19
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/scanners/url_scanner'
23
+ require 'ronin/network/mixins/http'
24
+
25
+ require 'nokogiri'
26
+
27
+ module Ronin
28
+ module Scanners
29
+ #
30
+ # The {SiteMap} scans the URLs listed in a websites `sitemap.xml` file.
31
+ #
32
+ class SiteMap < URLScanner
33
+
34
+ include Network::Mixins::HTTP
35
+
36
+ # The path to the sitemap
37
+ SITEMAP_PATH = '/sitemap.xml'
38
+
39
+ protected
40
+
41
+ #
42
+ # Requests `sitemap.xml` from a host and parses the URLs.
43
+ #
44
+ # @yield [url]
45
+ # The given block will be passed every URL within the sitemap.
46
+ #
47
+ # @yieldparam [String] url
48
+ # One of the URLs from the sitemap.
49
+ #
50
+ # @since 1.0.0
51
+ #
52
+ def scan(&block)
53
+ sitemap = Nokogiri::XML(http_get_body(:path => SITEMAP_PATH))
54
+
55
+ sitemap.search('/urlset/url/loc/.').each do |url|
56
+ yield url
57
+ end
58
+ end
59
+
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,117 @@
1
+ #
2
+ # Ronin Scanners - A Ruby library for Ronin that provides Ruby interfaces to
3
+ # various third-party security scanners.
4
+ #
5
+ # Copyright (c) 2006-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # This program is free software; you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation; either version 2 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program; if not, write to the Free Software
19
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/scanners/url_scanner'
23
+ require 'ronin/network/http'
24
+
25
+ require 'spidr/agent'
26
+
27
+ module Ronin
28
+ module Scanners
29
+ #
30
+ # The {Spider} class represents a scanner that spider web pages,
31
+ # yielding `Spidr::Page` results and `URL` resources.
32
+ #
33
+ class Spider < URLScanner
34
+
35
+ # The URL to start spidering at.
36
+ parameter :start_at, :description => 'The URI to start scanning at'
37
+
38
+ # The hosts to spider.
39
+ parameter :hosts, :default => Set[],
40
+ :description => 'The hosts to scan'
41
+
42
+ #
43
+ # Creates a new web spider agent.
44
+ #
45
+ # @yield [agent]
46
+ # The given block will be passed the newly created web spider
47
+ # agent.
48
+ #
49
+ # @yieldparam [Spidr::Agent] agent
50
+ # The newly created web spider agent to configure.
51
+ #
52
+ # @return [Spidr::Agent]
53
+ # The newly created web spider agent.
54
+ #
55
+ # @since 1.0.0
56
+ #
57
+ def agent(&block)
58
+ options = {
59
+ :proxy => Network::HTTP.proxy,
60
+ :user_agent => Network::HTTP.user_agent
61
+ }
62
+
63
+ return Spidr::Agent.new(options,&block)
64
+ end
65
+
66
+ protected
67
+
68
+ #
69
+ # Begins spidering web pages.
70
+ #
71
+ # @yield [page]
72
+ # The given block will be passed each spidered web page.
73
+ #
74
+ # @yieldparam [Spidr::Page] page
75
+ # A page visited by the web spider.
76
+ #
77
+ # @since 1.0.0
78
+ #
79
+ def scan(&block)
80
+ spider = agent()
81
+
82
+ spider.start_at(self.start_at,&block)
83
+ end
84
+
85
+ #
86
+ # Normalizes a visited web page.
87
+ #
88
+ # @param [Spidr::Page] page
89
+ # A visited web page.
90
+ #
91
+ # @return [Spidr::Page]
92
+ # The visited web page.
93
+ #
94
+ # @since 1.0.0
95
+ #
96
+ def normalize_result(page)
97
+ page
98
+ end
99
+
100
+ #
101
+ # Converts a visited web page into a URL resource.
102
+ #
103
+ # @param [Spidr::Page] page
104
+ # A visited web page.
105
+ #
106
+ # @return [URL]
107
+ # The URL resource for the web page.
108
+ #
109
+ # @since 1.0.0
110
+ #
111
+ def new_resource(page)
112
+ super(page.uri)
113
+ end
114
+
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,72 @@
1
+ #
2
+ # Ronin Scanners - A Ruby library for Ronin that provides Ruby interfaces to
3
+ # various third-party security scanners.
4
+ #
5
+ # Copyright (c) 2008-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # This program is free software; you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation; either version 2 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program; if not, write to the Free Software
19
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/scanners/scanner'
23
+ require 'ronin/open_port'
24
+
25
+ module Ronin
26
+ module Scanners
27
+ #
28
+ # The {TCPPortScanner} class represents scanners that yield TCP port
29
+ # number results and `OpenPort` resources.
30
+ #
31
+ class TCPPortScanner < Scanner
32
+
33
+ protected
34
+
35
+ #
36
+ # Normalizes the port number.
37
+ #
38
+ # @param [String, Integer] result
39
+ # The incoming port number.
40
+ #
41
+ # @return [Integer]
42
+ # The normalized port number.
43
+ #
44
+ # @since 1.0.0
45
+ #
46
+ def normalize_result(result)
47
+ result.to_i
48
+ end
49
+
50
+ #
51
+ # Queries or creates a new open-port resource for the given result.
52
+ #
53
+ # @param [Integer] result
54
+ # The port number.
55
+ #
56
+ # @return [OpenPort]
57
+ # The open port resource from the Database.
58
+ #
59
+ # @since 1.0.0
60
+ #
61
+ def new_resource(result)
62
+ OpenPort.first_or_new(
63
+ :port => Port.first_or_new(
64
+ :protocol => 'tcp',
65
+ :number => result
66
+ )
67
+ )
68
+ end
69
+
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,72 @@
1
+ #
2
+ # Ronin Scanners - A Ruby library for Ronin that provides Ruby interfaces to
3
+ # various third-party security scanners.
4
+ #
5
+ # Copyright (c) 2008-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # This program is free software; you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation; either version 2 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program; if not, write to the Free Software
19
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/scanners/scanner'
23
+ require 'ronin/open_port'
24
+
25
+ module Ronin
26
+ module Scanners
27
+ #
28
+ # The {UDPPortScanner} class represents scanners that yield UDP port
29
+ # number results and `OpenPort` resources.
30
+ #
31
+ class UDPPortScanner < Scanner
32
+
33
+ protected
34
+
35
+ #
36
+ # Normalizes the port number.
37
+ #
38
+ # @param [String, Integer] result
39
+ # The incoming port number.
40
+ #
41
+ # @return [Integer]
42
+ # The normalized port number.
43
+ #
44
+ # @since 0.2.0
45
+ #
46
+ def normalize_result(result)
47
+ result.to_i
48
+ end
49
+
50
+ #
51
+ # Queries or creates a new open-port resource for the given result.
52
+ #
53
+ # @param [Integer] result
54
+ # The port number.
55
+ #
56
+ # @return [OpenPort]
57
+ # The open port resource from the Database.
58
+ #
59
+ # @since 0.2.0
60
+ #
61
+ def new_resource(result)
62
+ OpenPort.first_or_new(
63
+ :port => Port.first_or_new(
64
+ :protocol => 'udp',
65
+ :number => result
66
+ )
67
+ )
68
+ end
69
+
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,79 @@
1
+ #
2
+ # Ronin Scanners - A Ruby library for Ronin that provides Ruby interfaces to
3
+ # various third-party security scanners.
4
+ #
5
+ # Copyright (c) 2008-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
6
+ #
7
+ # This program is free software; you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation; either version 2 of the License, or
10
+ # (at your option) any later version.
11
+ #
12
+ # This program is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+ #
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with this program; if not, write to the Free Software
19
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ #
21
+
22
+ require 'ronin/scanners/scanner'
23
+ require 'ronin/url'
24
+
25
+ require 'uri'
26
+
27
+ module Ronin
28
+ module Scanners
29
+ #
30
+ # The {URLScanner} class represents scanners that yield `URI` results
31
+ # and `URL` resources.
32
+ #
33
+ class URLScanner < Scanner
34
+
35
+ protected
36
+
37
+ #
38
+ # Normalizes the URL.
39
+ #
40
+ # @param [String, URI::Generic] result
41
+ # The incoming URL.
42
+ #
43
+ # @return [URI::Generic]
44
+ # The normalized URI.
45
+ #
46
+ # @since 1.0.0
47
+ #
48
+ def normalize_result(result)
49
+ unless result.kind_of?(::URI::Generic)
50
+ begin
51
+ URI.parse(result.to_s)
52
+ rescue URI::InvalidURIError, URI::InvalidComponentError
53
+ end
54
+ else
55
+ result
56
+ end
57
+ end
58
+
59
+ #
60
+ # Queries or creates a new Url resource for the given result.
61
+ #
62
+ # @param [URI::Generic] result
63
+ # The URL.
64
+ #
65
+ # @return [Url]
66
+ # The Url resource from the Database.
67
+ #
68
+ # @since 1.0.0
69
+ #
70
+ def new_resource(result)
71
+ new_url = URL.from(result)
72
+
73
+ new_url.last_scanned_at = Time.now
74
+ return new_url
75
+ end
76
+
77
+ end
78
+ end
79
+ end
@@ -1,9 +1,8 @@
1
1
  #
2
- #--
3
2
  # Ronin Scanners - A Ruby library for Ronin that provides Ruby interfaces to
4
3
  # various third-party security scanners.
5
4
  #
6
- # Copyright (c) 2008-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
5
+ # Copyright (c) 2008-2012 Hal Brodigan (postmodern.mod3 at gmail.com)
7
6
  #
8
7
  # This program is free software; you can redistribute it and/or modify
9
8
  # it under the terms of the GNU General Public License as published by
@@ -18,11 +17,11 @@
18
17
  # You should have received a copy of the GNU General Public License
19
18
  # along with this program; if not, write to the Free Software
20
19
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
- #++
22
20
  #
23
21
 
24
22
  module Ronin
25
23
  module Scanners
26
- VERSION = '0.1.4'
24
+ # ronin-scanners version
25
+ VERSION = '1.0.0.pre1'
27
26
  end
28
27
  end