librex 0.0.1 → 0.0.3

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 (53) hide show
  1. data/README +4 -0
  2. data/lib/rex/exploitation/cmdstager.rb +9 -133
  3. data/lib/rex/exploitation/cmdstager/base.rb +170 -0
  4. data/lib/rex/exploitation/cmdstager/debug_asm.rb +142 -0
  5. data/lib/rex/exploitation/cmdstager/debug_write.rb +136 -0
  6. data/lib/rex/exploitation/cmdstager/tftp.rb +63 -0
  7. data/lib/rex/exploitation/cmdstager/vbs.rb +128 -0
  8. data/lib/rex/io/stream.rb +2 -2
  9. data/lib/rex/io/stream_server.rb +1 -1
  10. data/lib/rex/job_container.rb +7 -6
  11. data/lib/rex/mime/header.rb +12 -10
  12. data/lib/rex/mime/message.rb +57 -26
  13. data/lib/rex/ole/directory.rb +5 -4
  14. data/lib/rex/ole/samples/create_ole.rb +0 -0
  15. data/lib/rex/ole/samples/dir.rb +0 -0
  16. data/lib/rex/ole/samples/dump_stream.rb +1 -1
  17. data/lib/rex/ole/samples/ole_info.rb +0 -0
  18. data/lib/rex/parser/nexpose_xml.rb +131 -0
  19. data/lib/rex/parser/nmap_xml.rb +1 -0
  20. data/lib/rex/peparsey/pe.rb +21 -3
  21. data/lib/rex/post/meterpreter/client.rb +6 -1
  22. data/lib/rex/post/meterpreter/client_core.rb +2 -2
  23. data/lib/rex/post/meterpreter/extensions/priv/priv.rb +19 -18
  24. data/lib/rex/post/meterpreter/packet.rb +68 -0
  25. data/lib/rex/post/meterpreter/packet_dispatcher.rb +2 -2
  26. data/lib/rex/post/meterpreter/packet_response_waiter.rb +5 -5
  27. data/lib/rex/post/meterpreter/ui/console.rb +2 -0
  28. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb +5 -2
  29. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb +2 -2
  30. data/lib/rex/proto/dcerpc/client.rb.ut.rb +0 -0
  31. data/lib/rex/proto/http/client.rb +8 -3
  32. data/lib/rex/proto/http/packet.rb +11 -1
  33. data/lib/rex/proto/smb/client.rb +1 -1
  34. data/lib/rex/proto/smb/utils.rb +72 -24
  35. data/lib/rex/proto/tftp.rb +3 -0
  36. data/lib/rex/proto/tftp/constants.rb +37 -0
  37. data/lib/rex/proto/tftp/server.rb +249 -0
  38. data/lib/rex/proto/tftp/server.rb.ut.rb +28 -0
  39. data/lib/rex/script/meterpreter.rb +6 -0
  40. data/lib/rex/services/local_relay.rb +2 -2
  41. data/lib/rex/socket/ip.rb +9 -8
  42. data/lib/rex/socket/range_walker.rb +43 -5
  43. data/lib/rex/socket/udp.rb +11 -4
  44. data/lib/rex/text.rb +42 -19
  45. data/lib/rex/ui/interactive.rb +24 -22
  46. data/lib/rex/ui/text/irb_shell.rb +4 -2
  47. data/lib/rex/ui/text/output/file.rb +6 -0
  48. data/lib/rex/ui/text/shell.rb +14 -18
  49. data/lib/rex/zip/samples/comment.rb +0 -0
  50. data/lib/rex/zip/samples/mkwar.rb +0 -0
  51. data/lib/rex/zip/samples/mkzip.rb +0 -0
  52. data/lib/rex/zip/samples/recursive.rb +0 -0
  53. metadata +20 -5
@@ -39,7 +39,7 @@ class IrbShell
39
39
  IRB.conf[:MAIN_CONTEXT] = irb.context
40
40
 
41
41
  # Trap interrupt
42
- trap("SIGINT") do
42
+ old_sigint = trap("SIGINT") do
43
43
  irb.signal_handle
44
44
  end
45
45
 
@@ -47,9 +47,11 @@ class IrbShell
47
47
  catch(:IRB_EXIT) do
48
48
  irb.eval_input
49
49
  end
50
+
51
+ trap("SIGINT", old_sigint)
50
52
  end
51
53
 
52
54
  end
53
55
  end
54
56
  end
55
- end
57
+ end
@@ -25,10 +25,16 @@ class Output::File < Rex::Ui::Text::Output
25
25
  # Prints the supplied message to file output.
26
26
  #
27
27
  def print_raw(msg = '')
28
+ return if not self.fd
28
29
  self.fd.write(msg)
29
30
  self.fd.flush
30
31
  msg
31
32
  end
33
+
34
+ def close
35
+ self.fd.close if self.fd
36
+ self.fd = nil
37
+ end
32
38
  end
33
39
 
34
40
  end
@@ -37,10 +37,6 @@ module Shell
37
37
  # Initializes a shell that has a prompt and can be interacted with.
38
38
  #
39
39
  def initialize(prompt, prompt_char = '>', histfile = nil)
40
- # Don't initialize the UI here since it will clobber any existing tab
41
- # completion routines prematurely. Instead, wait for the user to
42
- # interact. See bug 1180
43
-
44
40
  # Set the stop flag to false
45
41
  self.stop_flag = false
46
42
  self.disable_output = false
@@ -53,28 +49,28 @@ module Shell
53
49
  self.histfile = histfile
54
50
  end
55
51
 
52
+ def init_tab_complete
53
+ if (self.input and self.input.supports_readline)
54
+ self.input = Input::Readline.new(lambda { |str| tab_complete(str) })
55
+ if histfile and File.exists?(histfile)
56
+ File.readlines(histfile).each { |e|
57
+ Readline::HISTORY << e.chomp
58
+ }
59
+ end
60
+ self.input.output = self.output
61
+ update_prompt(input.prompt)
62
+ end
63
+ end
64
+
56
65
  #
57
66
  # Initializes the user interface input/output classes.
58
67
  #
59
68
  def init_ui(in_input = nil, in_output = nil)
60
-
61
69
  # Initialize the input and output methods
62
70
  self.input = in_input
63
71
  self.output = in_output
64
72
 
65
73
  if (self.input)
66
- begin
67
- if (self.input.supports_readline)
68
- self.input = Input::Readline.new(lambda { |str| tab_complete(str) })
69
- if histfile and File.exists?(histfile)
70
- File.readlines(histfile).each { |e|
71
- Readline::HISTORY << e.chomp
72
- }
73
- end
74
- end
75
- rescue
76
- end
77
-
78
74
  # Extend the input medium as an input shell if the input medium
79
75
  # isn't intrinsicly a shell.
80
76
  if (self.input.intrinsic_shell? == false)
@@ -83,7 +79,6 @@ module Shell
83
79
 
84
80
  self.input.output = self.output
85
81
  end
86
-
87
82
  update_prompt('')
88
83
  end
89
84
 
@@ -126,6 +121,7 @@ module Shell
126
121
  # If the stop flag was set or we've hit EOF, break out
127
122
  break if (self.stop_flag or self.stop_count > 1)
128
123
 
124
+ init_tab_complete
129
125
  line = input.pgets
130
126
  log_output(input.prompt)
131
127
 
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librex
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 25
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 1
9
- version: 0.0.1
9
+ - 3
10
+ version: 0.0.3
10
11
  platform: ruby
11
12
  authors:
12
13
  - Metasploit Development Team
@@ -15,11 +16,11 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-04-30 00:00:00 -05:00
19
+ date: 2010-06-25 00:00:00 -05:00
19
20
  default_executable:
20
21
  dependencies: []
21
22
 
22
- description: Rex provides a variety of classes useful for security testing and exploit development. Based on svn revision 9179
23
+ description: Rex provides a variety of classes useful for security testing and exploit development. Based on svn revision 9625
23
24
  email:
24
25
  - hdm@metasploit.com
25
26
  - jacob.hammack@hammackj.com
@@ -83,6 +84,11 @@ files:
83
84
  - lib/rex/encoding/xor.rb.ts.rb
84
85
  - lib/rex/exceptions.rb
85
86
  - lib/rex/exceptions.rb.ut.rb
87
+ - lib/rex/exploitation/cmdstager/base.rb
88
+ - lib/rex/exploitation/cmdstager/debug_asm.rb
89
+ - lib/rex/exploitation/cmdstager/debug_write.rb
90
+ - lib/rex/exploitation/cmdstager/tftp.rb
91
+ - lib/rex/exploitation/cmdstager/vbs.rb
86
92
  - lib/rex/exploitation/cmdstager.rb
87
93
  - lib/rex/exploitation/egghunter.rb
88
94
  - lib/rex/exploitation/egghunter.rb.ut.rb
@@ -145,6 +151,7 @@ files:
145
151
  - lib/rex/parser/arguments.rb.ut.rb
146
152
  - lib/rex/parser/ini.rb
147
153
  - lib/rex/parser/ini.rb.ut.rb
154
+ - lib/rex/parser/nexpose_xml.rb
148
155
  - lib/rex/parser/nmap_xml.rb
149
156
  - lib/rex/payloads/win32/common.rb
150
157
  - lib/rex/payloads/win32/kernel/common.rb
@@ -310,6 +317,10 @@ files:
310
317
  - lib/rex/proto/smb.rb.ts.rb
311
318
  - lib/rex/proto/sunrpc/client.rb
312
319
  - lib/rex/proto/sunrpc.rb
320
+ - lib/rex/proto/tftp/constants.rb
321
+ - lib/rex/proto/tftp/server.rb
322
+ - lib/rex/proto/tftp/server.rb.ut.rb
323
+ - lib/rex/proto/tftp.rb
313
324
  - lib/rex/proto.rb
314
325
  - lib/rex/proto.rb.ts.rb
315
326
  - lib/rex/script/base.rb
@@ -409,25 +420,29 @@ rdoc_options: []
409
420
  require_paths:
410
421
  - lib
411
422
  required_ruby_version: !ruby/object:Gem::Requirement
423
+ none: false
412
424
  requirements:
413
425
  - - ">="
414
426
  - !ruby/object:Gem::Version
427
+ hash: 57
415
428
  segments:
416
429
  - 1
417
430
  - 8
418
431
  - 7
419
432
  version: 1.8.7
420
433
  required_rubygems_version: !ruby/object:Gem::Requirement
434
+ none: false
421
435
  requirements:
422
436
  - - ">="
423
437
  - !ruby/object:Gem::Version
438
+ hash: 3
424
439
  segments:
425
440
  - 0
426
441
  version: "0"
427
442
  requirements: []
428
443
 
429
444
  rubyforge_project:
430
- rubygems_version: 1.3.6
445
+ rubygems_version: 1.3.7
431
446
  signing_key:
432
447
  specification_version: 3
433
448
  summary: Ruby Exploitation library