librex 0.0.6 → 0.0.7

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 (51) hide show
  1. data/README.md +3 -5
  2. data/Rakefile +26 -0
  3. data/lib/rex/compat.rb +1 -1
  4. data/lib/rex/exploitation/javascriptosdetect.rb +125 -62
  5. data/lib/rex/file.rb +15 -0
  6. data/lib/rex/io/stream.rb +1 -1
  7. data/lib/rex/parser/nmap_xml.rb +6 -0
  8. data/lib/rex/poly/block.rb +9 -0
  9. data/lib/rex/post/meterpreter/client.rb +0 -8
  10. data/lib/rex/post/meterpreter/extensions/priv/priv.rb +6 -0
  11. data/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb +1 -1
  12. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_advapi32.rb +49 -35
  13. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_netapi32.rb +26 -0
  14. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb +9 -2
  15. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb +630 -0
  16. data/lib/rex/post/meterpreter/packet.rb +3 -1
  17. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb +143 -57
  18. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb +6 -0
  19. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/net.rb +9 -3
  20. data/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb +6 -4
  21. data/lib/rex/proto.rb +1 -0
  22. data/lib/rex/proto/dhcp/server.rb +4 -2
  23. data/lib/rex/proto/http/packet.rb +5 -6
  24. data/lib/rex/proto/ntlm.rb +7 -0
  25. data/lib/rex/proto/ntlm.rb.ut.rb +177 -0
  26. data/lib/rex/proto/ntlm/base.rb +326 -0
  27. data/lib/rex/proto/ntlm/constants.rb +74 -0
  28. data/lib/rex/proto/ntlm/crypt.rb +340 -0
  29. data/lib/rex/proto/ntlm/exceptions.rb +9 -0
  30. data/lib/rex/proto/ntlm/message.rb +533 -0
  31. data/lib/rex/proto/ntlm/utils.rb +358 -0
  32. data/lib/rex/proto/smb/client.rb +548 -86
  33. data/lib/rex/proto/smb/client.rb.ut.rb +4 -4
  34. data/lib/rex/proto/smb/constants.rb +7 -24
  35. data/lib/rex/proto/smb/crypt.rb +12 -71
  36. data/lib/rex/proto/smb/exceptions.rb +12 -0
  37. data/lib/rex/proto/smb/simpleclient.rb +17 -5
  38. data/lib/rex/proto/smb/utils.rb +3 -460
  39. data/lib/rex/proto/tftp/server.rb +2 -2
  40. data/lib/rex/script/base.rb +2 -2
  41. data/lib/rex/socket.rb +12 -0
  42. data/lib/rex/socket.rb.ut.rb +31 -10
  43. data/lib/rex/socket/ssl_tcp_server.rb.ut.rb +15 -5
  44. data/lib/rex/text.rb +55 -4
  45. data/lib/rex/ui/output.rb +0 -2
  46. data/lib/rex/ui/text/dispatcher_shell.rb +95 -10
  47. data/lib/rex/ui/text/output/buffer.rb +0 -4
  48. data/lib/rex/ui/text/shell.rb +8 -0
  49. data/lib/rex/ui/text/table.rb +21 -1
  50. metadata +15 -19
  51. data/lib/rex/proto/smb/crypt.rb.ut.rb +0 -20
@@ -57,7 +57,8 @@ class Table
57
57
  self.header = opts['Header']
58
58
  self.headeri = opts['HeaderIndent'] || 0
59
59
  self.columns = opts['Columns'] || []
60
- self.rows = opts['Rows'] || []
60
+ # updated below if we got a "Rows" option
61
+ self.rows = []
61
62
 
62
63
  self.width = opts['Width'] || 80
63
64
  self.indent = opts['Indent'] || 0
@@ -72,6 +73,10 @@ class Table
72
73
  self.colprops[idx]['MaxWidth'] = self.columns[idx].length
73
74
  }
74
75
 
76
+ # ensure all our internal state gets updated with the given rows by
77
+ # using add_row instead of just adding them to self.rows. See #3825.
78
+ opts['Rows'].each { |row| add_row(row) } if opts['Rows']
79
+
75
80
  # Merge in options
76
81
  if (opts['ColProps'])
77
82
  opts['ColProps'].each_key { |col|
@@ -106,6 +111,21 @@ class Table
106
111
 
107
112
  return str
108
113
  end
114
+
115
+ #
116
+ # Converts table contents to a csv
117
+ #
118
+ def to_csv
119
+ str = ''
120
+ str << ( columns.join(",") + "\n" )
121
+ rows.each { |row|
122
+ next if is_hr(row)
123
+ str << ( row.map{|x|
124
+ x.gsub(/[\r\n]/, ' ').gsub(/\s+/, ' ').gsub('"', '""')
125
+ }.map{|x| "\"#{x}\"" }.join(",") + "\n" )
126
+ }
127
+ str
128
+ end
109
129
 
110
130
  #
111
131
  #
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librex
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 6
10
- version: 0.0.6
5
+ version: 0.0.7
11
6
  platform: ruby
12
7
  authors:
13
8
  - Metasploit Development Team
@@ -16,11 +11,11 @@ autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
13
 
19
- date: 2011-01-04 00:00:00 -06:00
14
+ date: 2011-03-10 00:00:00 -06:00
20
15
  default_executable:
21
16
  dependencies: []
22
17
 
23
- description: Rex provides a variety of classes useful for security testing and exploit development. Based on svn revision 11474
18
+ description: Rex provides a variety of classes useful for security testing and exploit development. Based on svn revision 11930
24
19
  email:
25
20
  - hdm@metasploit.com
26
21
  - jacob.hammack@hammackj.com
@@ -231,6 +226,7 @@ files:
231
226
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_advapi32.rb
232
227
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_iphlpapi.rb
233
228
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_kernel32.rb
229
+ - lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_netapi32.rb
234
230
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ntdll.rb
235
231
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_shell32.rb
236
232
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_user32.rb
@@ -239,6 +235,7 @@ files:
239
235
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/multicall.rb
240
236
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb
241
237
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/tlv.rb
238
+ - lib/rex/post/meterpreter/extensions/stdapi/railgun/util.rb
242
239
  - lib/rex/post/meterpreter/extensions/stdapi/stdapi.rb
243
240
  - lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb
244
241
  - lib/rex/post/meterpreter/extensions/stdapi/sys/event_log.rb
@@ -332,6 +329,14 @@ files:
332
329
  - lib/rex/proto/http/server.rb.ut.rb
333
330
  - lib/rex/proto/http.rb
334
331
  - lib/rex/proto/http.rb.ts.rb
332
+ - lib/rex/proto/ntlm/base.rb
333
+ - lib/rex/proto/ntlm/constants.rb
334
+ - lib/rex/proto/ntlm/crypt.rb
335
+ - lib/rex/proto/ntlm/exceptions.rb
336
+ - lib/rex/proto/ntlm/message.rb
337
+ - lib/rex/proto/ntlm/utils.rb
338
+ - lib/rex/proto/ntlm.rb
339
+ - lib/rex/proto/ntlm.rb.ut.rb
335
340
  - lib/rex/proto/proxy/socks4a.rb
336
341
  - lib/rex/proto/rfb/cipher.rb
337
342
  - lib/rex/proto/rfb/client.rb
@@ -343,7 +348,6 @@ files:
343
348
  - lib/rex/proto/smb/constants.rb
344
349
  - lib/rex/proto/smb/constants.rb.ut.rb
345
350
  - lib/rex/proto/smb/crypt.rb
346
- - lib/rex/proto/smb/crypt.rb.ut.rb
347
351
  - lib/rex/proto/smb/evasions.rb
348
352
  - lib/rex/proto/smb/exceptions.rb
349
353
  - lib/rex/proto/smb/simpleclient.rb
@@ -448,7 +452,7 @@ files:
448
452
  - lib/rex/zip.rb
449
453
  - lib/rex.rb
450
454
  - lib/rex.rb.ts.rb
451
- has_rdoc: false
455
+ has_rdoc: true
452
456
  homepage: http://www.metasploit.com/
453
457
  licenses: []
454
458
 
@@ -462,25 +466,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
462
466
  requirements:
463
467
  - - ">="
464
468
  - !ruby/object:Gem::Version
465
- hash: 57
466
- segments:
467
- - 1
468
- - 8
469
- - 7
470
469
  version: 1.8.7
471
470
  required_rubygems_version: !ruby/object:Gem::Requirement
472
471
  none: false
473
472
  requirements:
474
473
  - - ">="
475
474
  - !ruby/object:Gem::Version
476
- hash: 3
477
- segments:
478
- - 0
479
475
  version: "0"
480
476
  requirements: []
481
477
 
482
478
  rubyforge_project:
483
- rubygems_version: 1.4.1
479
+ rubygems_version: 1.6.2
484
480
  signing_key:
485
481
  specification_version: 3
486
482
  summary: Ruby Exploitation library
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- $:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..'))
4
-
5
- require 'rex/test'
6
- require 'rex/proto/smb/crypt'
7
-
8
- class Rex::Proto::SMB::Crypt::UnitTest < Test::Unit::TestCase
9
-
10
- Klass = Rex::Proto::SMB::Crypt
11
-
12
- def test_parse
13
-
14
- pass = "XXXXXXX"
15
- chal = "Z" * 8
16
-
17
- assert_equal("\xc2\x48\xcf\x61\x65\xfe\x55\xef\xac\xa0\x30\x09\x66\xdc\x37\x96\x04\x6b\x9c\x0b\xb4\xa5\x2e\x27", Klass.lanman_des(pass, chal), 'lanman_des')
18
- assert_equal("\x8d\x04\x18\x58\xf0\x78\xcc\xfa\x15\x60\xa4\x61\x76\x90\xe5\x51\x84\xfd\x70\xec\x7f\x23\xb7\xf9", Klass.ntlm_md4(pass, chal), 'ntlm_md4')
19
- end
20
- end