Changeset 5283
- Timestamp:
- 01/07/08 01:00:42 (8 months ago)
- Files:
-
- framework3/trunk/lib/msf/core/exploit/capture.rb (modified) (7 diffs)
- framework3/trunk/lib/msf/core/module_manager.rb (modified) (2 diffs)
- framework3/trunk/lib/msf/ui/gtk2/app.rb (modified) (1 diff)
- framework3/trunk/lib/msf/ui/gtk2/window.rb (modified) (1 diff)
- framework3/trunk/lib/msf/ui/gtk2/window/consoles.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
framework3/trunk/lib/msf/core/exploit/capture.rb
r4393 r5283 4 4 # 5 5 # This module provides methods for receiving raw packets. 6 # Please see the ruby-pcapxdocumentation for more information.6 # Please see the pcaprub documentation for more information. 7 7 # 8 8 ### … … 21 21 OptString.new('INTERFACE', [false, 'The name of the interface']), 22 22 OptString.new('FILTER', [false, 'The filter string for capturing traffic']), 23 OptInt.new('SNAPLEN', [true, 'The number of bytes to capture', 65535]) 23 OptInt.new('SNAPLEN', [true, 'The number of bytes to capture', 65535]), 24 OptInt.new('TIMEOUT', [true, 'The number of seconds to wait for new data', 1]) 24 25 25 26 ], Msf::Exploit::Capture … … 28 29 29 30 begin 30 require 'Pcap X'31 @pcap x_loaded = true31 require 'Pcaprub' 32 @pcaprub_loaded = true 32 33 rescue ::Exception => e 33 @pcap x_loaded = false34 @pcap x_error = e34 @pcaprub_loaded = false 35 @pcaprub_error = e 35 36 end 36 37 38 begin 39 require 'scruby' 40 @scruby_loaded = true 41 rescue ::Exception => e 42 @scruby_loaded = false 43 @scruby_error = e 44 end 45 37 46 end 38 47 39 48 def stats_recv 40 49 return(0) if not self.capture 41 self.capture.stats .recv50 self.capture.stats['recv'] 42 51 end 43 52 44 53 def stats_drop 45 54 return(0) if not self.capture 46 self.capture.stats .drop55 self.capture.stats['drop'] 47 56 end 48 57 58 def stats_ifdrop 59 return(0) if not self.capture 60 self.capture.stats['ifdrop'] 61 end 62 49 63 # 50 64 # Opens a handle to the specified device … … 52 66 def open_pcap 53 67 54 if (not @pcap x_loaded)55 print_status("The Pcap X module is not available: #{@pcapx_error.to_s}")56 raise RuntimeError, "Pcap Xnot available"68 if (not @pcaprub_loaded) 69 print_status("The Pcaprub module is not available: #{@pcaprub_error.to_s}") 70 raise RuntimeError, "Pcaprub not available" 57 71 end 58 72 … … 61 75 62 76 # Capture device 63 dev = datastore['INTERFACE'] || ::PcapX.lookupdev 64 len = datastore['SNAPLEN'] || 65535 77 dev = datastore['INTERFACE'] || ::Pcap.lookupdev 78 len = (datastore['SNAPLEN'] || 65535).to_i 79 tim = (datastore['TIMEOUT'] || 0).to_i 65 80 fil = datastore['FILTER'] 66 67 self.capture = ::Pcap X::Capture.open_live(dev, len, true)81 82 self.capture = ::Pcap.open_live(dev, len, true, tim) 68 83 69 84 if (not self.capture) 70 raise RuntimeError, "Could not open the wirelessdevice interface"85 raise RuntimeError, "Could not open the device interface" 71 86 end 72 87 … … 80 95 end 81 96 97 # Extend this to support a wider range of link layer types 82 98 def capture_find_linklayer(pkt) 83 99 return if not pkt … … 110 126 return set 111 127 end 128 129 def each_packet 130 131 end 112 132 113 133 attr_accessor :capture framework3/trunk/lib/msf/core/module_manager.rb
r5274 r5283 794 794 load_module_from_file(path, file, loaded, recalc, counts, demand) 795 795 rescue NameError 796 797 # As of Jan-06-2007 this code isn't hit with the official module tree 798 796 799 # If we get a name error, it's possible that this module depends 797 800 # on another one that we haven't loaded yet. Let's postpone … … 808 811 809 812 delay.each_key { |file| 813 810 814 begin 811 815 # Load the module from the file... framework3/trunk/lib/msf/ui/gtk2/app.rb
r5260 r5283 264 264 def on_logs_activate 265 265 MsfWindow::Logs.new 266 end 267 268 # 269 # Action for "Window/Console" menu 270 # 271 def on_consoles_activate 272 MsfWindow::Consoles.new 266 273 end 267 274 framework3/trunk/lib/msf/ui/gtk2/window.rb
r4972 r5283 1 1 require 'msf/ui/gtk2/window/logs' 2 2 require 'msf/ui/gtk2/window/auxiliary' 3 require 'msf/ui/gtk2/window/consoles' 3 4 4 5
