ronin-web 0.1.0 → 0.1.1

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.
data/History.txt CHANGED
@@ -1,3 +1,16 @@
1
+ === 0.1.1 / 2009-02-23
2
+
3
+ * Added a git style sub-command (<tt>ronin-web</tt>) which starts the Ronin
4
+ console with <tt>ronin/web</tt> preloaded.
5
+ * Require Nokogiri >= 1.2.0.
6
+ * Require Ronin >= 0.2.1.
7
+ * Updated Ronin::Web::Server:
8
+ * Properly catch load errors when attempting to load Mongrel.
9
+ * Renamed Server#mount to Server#directory.
10
+ * Removed the last reference to Hpricot.
11
+ * Fixed a bug when loading the Nokogiri extensions with Nokogiri >= 1.2.0.
12
+ * Updated README.txt.
13
+
1
14
  === 0.1.0 / 2009-01-22
2
15
 
3
16
  * Initial release.
data/Manifest.txt CHANGED
@@ -2,6 +2,7 @@ History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
+ bin/ronin-web
5
6
  lib/ronin/sessions/web.rb
6
7
  lib/ronin/web.rb
7
8
  lib/ronin/web/extensions.rb
data/README.txt CHANGED
@@ -39,24 +39,34 @@ of Ronin.
39
39
 
40
40
  == FEATURES/PROBLEMS:
41
41
 
42
- * Web access (utilizing Mechanize and Hpricot).
42
+ * Web access (utilizing Mechanize and Nokogiri).
43
43
  * Integrates Spidr into Ronin::Web::Spider.
44
- * Provides a custom Rack web-server based on Rack::Builder.
44
+ * Provides Ronin::Web::Server, a customizable Rack web server that supports
45
+ path and host-name routing.
45
46
 
46
47
  == REQUIREMENTS:
47
48
 
48
- * nokogiri >= 1.1.0
49
- * mechanize >= 0.9.0
50
- * spidr >= 0.1.3
51
- * rack >= 0.9.1
52
- * ronin >= 0.1.4
49
+ * {nokogiri}[http://nokogiri.rubyforge.org/] >= 1.1.0
50
+ * {mechanize}[http://mechanize.rubyforge.org/] >= 0.9.0
51
+ * {spidr}[http://spidr.rubyforge.org/] >= 0.1.3
52
+ * {rack}[http://rack.rubyforge.org/] >= 0.9.1
53
+ * {ronin}[http://ronin.rubyforge.org/] >= 0.1.4
53
54
 
54
55
  == INSTALL:
55
56
 
56
57
  $ sudo gem install ronin-web
57
58
 
59
+ == SYNOPSIS:
60
+
61
+ * Start the Ronin console with Ronin Web preloaded:
62
+
63
+ $ ronin-web
64
+
58
65
  == LICENSE:
59
66
 
67
+ Ronin Web - A Ruby library for Ronin that provides support for web
68
+ scraping and spidering functionality.
69
+
60
70
  Copyright (c) 2006-2009 Hal Brodigan (postmodern.mod3 at gmail.com)
61
71
 
62
72
  This program is free software; you can redistribute it and/or modify
data/Rakefile CHANGED
@@ -10,11 +10,11 @@ Hoe.new('ronin-web', Ronin::Web::VERSION) do |p|
10
10
  p.developer('Postmodern', 'postmodern.mod3@gmail.com')
11
11
  p.remote_rdoc_dir = 'docs/ronin-web'
12
12
  p.extra_deps = [
13
- ['nokogiri', '>=1.1.0'],
13
+ ['nokogiri', '>=1.2.0'],
14
14
  ['mechanize', '>=0.9.0'],
15
15
  ['spidr', '>=0.1.3'],
16
16
  ['rack', '>=0.9.1'],
17
- ['ronin', '>=0.1.4']
17
+ ['ronin', '>=0.2.1']
18
18
  ]
19
19
  end
20
20
 
data/bin/ronin-web ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+
5
+ require 'ronin/ui/command_line/commands/console'
6
+ require 'ronin/ui/console'
7
+
8
+ Ronin::UI::Console.auto_load << 'ronin/web'
9
+ Ronin::UI::CommandLine::Commands::Console.run(*ARGV)
data/lib/ronin/web.rb CHANGED
@@ -23,3 +23,5 @@
23
23
 
24
24
  require 'ronin/web/extensions'
25
25
  require 'ronin/web/web'
26
+ require 'ronin/web/spider'
27
+ require 'ronin/web/server'
@@ -1,4 +1,4 @@
1
- require 'nokogiri/xml/attr'
1
+ require 'nokogiri'
2
2
 
3
3
  module Nokogiri
4
4
  module XML
@@ -1,4 +1,4 @@
1
- require 'nokogiri/xml/document'
1
+ require 'nokogiri'
2
2
 
3
3
  module Nokogiri
4
4
  module XML
@@ -1,4 +1,4 @@
1
- require 'nokogiri/xml/element'
1
+ require 'nokogiri'
2
2
 
3
3
  module Nokogiri
4
4
  module XML
@@ -1,4 +1,4 @@
1
- require 'nokogiri/xml/node'
1
+ require 'nokogiri'
2
2
 
3
3
  module Nokogiri
4
4
  module XML
@@ -1,4 +1,4 @@
1
- require 'nokogiri/xml/text'
1
+ require 'nokogiri'
2
2
 
3
3
  module Nokogiri
4
4
  module XML
@@ -26,7 +26,7 @@ require 'cgi'
26
26
 
27
27
  begin
28
28
  require 'mongrel'
29
- rescue
29
+ rescue LoadError
30
30
  require 'webrick'
31
31
  end
32
32
 
@@ -266,27 +266,6 @@ module Ronin
266
266
  return Rack::Response.new(body,status,headers,&block)
267
267
  end
268
268
 
269
- #
270
- # Use the specified _block_ as the default route for all other
271
- # requests.
272
- #
273
- # default do |env|
274
- # [200, {'Content-Type' => 'text/html'}, 'lol train']
275
- # end
276
- #
277
- def default(&block)
278
- @default = block
279
- return self
280
- end
281
-
282
- #
283
- # Connects the specified _server_ as a virtual host representing the
284
- # specified host _name_.
285
- #
286
- def connect(name,server)
287
- @virtual_hosts[name.to_s] = server
288
- end
289
-
290
269
  #
291
270
  # Returns the server that handles requests for the specified host
292
271
  # _name_.
@@ -306,7 +285,20 @@ module Ronin
306
285
  end
307
286
 
308
287
  #
309
- # Registers the specified _block_ to be called when receiving
288
+ # Use the given _server_ or _block_ as the default route for all
289
+ # other requests.
290
+ #
291
+ # default do |env|
292
+ # [200, {'Content-Type' => 'text/html'}, 'lol train']
293
+ # end
294
+ #
295
+ def default(server=nil,&block)
296
+ @default = (server || block)
297
+ return self
298
+ end
299
+
300
+ #
301
+ # Registers the given _server_ or _block_ to be called when receiving
310
302
  # requests to host names which match the specified _pattern_.
311
303
  #
312
304
  # hosts_like(/^a[0-9]\./) do
@@ -315,20 +307,20 @@ module Ronin
315
307
  # end
316
308
  # end
317
309
  #
318
- def hosts_like(pattern,&block)
319
- @virtual_host_patterns[pattern] = self.class.new(&block)
310
+ def hosts_like(pattern,server=nil,&block)
311
+ @virtual_host_patterns[pattern] = (server || self.class.new(&block))
320
312
  end
321
313
 
322
314
  #
323
- # Registers the specified _block_ to be called when receiving
315
+ # Registers the given _server_ or _block_ to be called when receiving
324
316
  # requests for paths which match the specified _pattern_.
325
317
  #
326
318
  # paths_like(/\.xml$/) do |env|
327
319
  # ...
328
320
  # end
329
321
  #
330
- def paths_like(pattern,&block)
331
- @path_patterns[pattern] = block
322
+ def paths_like(pattern,server=nil,&block)
323
+ @path_patterns[pattern] = (server || block)
332
324
  return self
333
325
  end
334
326
 
@@ -341,24 +333,25 @@ module Ronin
341
333
  # ...
342
334
  # end
343
335
  #
344
- def host(name,&block)
345
- connect(name,self.class.new(&block))
336
+ def host(name,server=nil,&block)
337
+ @virtual_hosts[name.to_s] = (server || self.class.new(&block))
346
338
  end
347
339
 
348
340
  #
349
- # Binds the specified URL _path_ to the given _block_.
341
+ # Binds the specified URL _path_ to the given _server_ or _block_.
350
342
  #
351
343
  # bind '/secrets.xml' do |env|
352
344
  # [200, {'Content-Type' => 'text/xml'}, "Made you look."]
353
345
  # end
354
346
  #
355
- def bind(path,&block)
356
- @paths[path] = block
347
+ def bind(path,server=nil,&block)
348
+ @paths[path] = (server || block)
357
349
  return self
358
350
  end
359
351
 
360
352
  #
361
- # Binds the specified URL directory _path_ to the given _block_.
353
+ # Binds the specified URL directory _path_ to the given
354
+ # _server_ or _block_.
362
355
  #
363
356
  # map '/downloads' do |env|
364
357
  # response(
@@ -367,8 +360,8 @@ module Ronin
367
360
  # )
368
361
  # end
369
362
  #
370
- def map(path,&block)
371
- @directories[path] = block
363
+ def map(path,server=nil,&block)
364
+ @directories[path] = (server || block)
372
365
  return self
373
366
  end
374
367
 
@@ -392,12 +385,12 @@ module Ronin
392
385
  end
393
386
 
394
387
  #
395
- # Mounts the contents of the specified _directory_ to the given
388
+ # Binds the contents of the specified _directory_ to the given
396
389
  # prefix _path_.
397
390
  #
398
- # mount '/download/', '/tmp/files/'
391
+ # directory '/download/', '/tmp/files/'
399
392
  #
400
- def mount(path,directory)
393
+ def directory(path,directory)
401
394
  sub_dirs = path.split('/')
402
395
  directory = File.expand_path(directory)
403
396
 
@@ -24,6 +24,6 @@
24
24
  module Ronin
25
25
  module Web
26
26
  # Ronin Web Version
27
- VERSION = '0.1.0'
27
+ VERSION = '0.1.1'
28
28
  end
29
29
  end
@@ -24,7 +24,7 @@ describe Web::Server do
24
24
 
25
25
  file('/test/file.txt',File.join(WEB_SERVER_ROOT,'test.txt'))
26
26
 
27
- mount('/test/mount/',WEB_SERVER_ROOT)
27
+ directory('/test/directory/',WEB_SERVER_ROOT)
28
28
  end
29
29
 
30
30
  @virtual_host = Web::Server.new do
@@ -102,14 +102,14 @@ describe Web::Server do
102
102
  @server.route_path(path).body.should == ["This is a test.\n"]
103
103
  end
104
104
 
105
- it "should return files from mounted directories" do
106
- path = '/test/mount/test.txt'
105
+ it "should return files from bound directories" do
106
+ path = '/test/directory/test.txt'
107
107
 
108
108
  @server.route_path(path).body.should == ["This is a test.\n"]
109
109
  end
110
110
 
111
- it "should return the index file for a mounted directory" do
112
- path = '/test/mount/'
111
+ it "should return the index file for a bound directory" do
112
+ path = '/test/directory/'
113
113
 
114
114
  @server.route_path(path).body.should == ["Index of files.\n"]
115
115
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ronin-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-22 00:00:00 -08:00
12
+ date: 2009-02-23 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 1.1.0
23
+ version: 1.2.0
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mechanize
@@ -60,7 +60,7 @@ dependencies:
60
60
  requirements:
61
61
  - - ">="
62
62
  - !ruby/object:Gem::Version
63
- version: 0.1.4
63
+ version: 0.2.1
64
64
  version:
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: hoe
@@ -75,8 +75,8 @@ dependencies:
75
75
  description: Ronin Web is a Ruby library for Ronin that provides support for web scraping and spidering functionality. Ronin is a Ruby platform designed for information security and data exploration tasks. Ronin allows for the rapid development and distribution of code over many of the common Source-Code-Management (SCM) systems.
76
76
  email:
77
77
  - postmodern.mod3@gmail.com
78
- executables: []
79
-
78
+ executables:
79
+ - ronin-web
80
80
  extensions: []
81
81
 
82
82
  extra_rdoc_files:
@@ -89,6 +89,7 @@ files:
89
89
  - Manifest.txt
90
90
  - README.txt
91
91
  - Rakefile
92
+ - bin/ronin-web
92
93
  - lib/ronin/sessions/web.rb
93
94
  - lib/ronin/web.rb
94
95
  - lib/ronin/web/extensions.rb