librex 0.0.42 → 0.0.43

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/README.markdown +1 -1
  2. data/lib/rex/compat.rb +10 -0
  3. data/lib/rex/post/meterpreter/channels/pools/file.rb +1 -1
  4. data/lib/rex/post/meterpreter/extensions/stdapi/fs/dir.rb +20 -18
  5. data/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb +11 -22
  6. data/lib/rex/post/meterpreter/extensions/stdapi/fs/file_stat.rb +2 -1
  7. data/lib/rex/post/meterpreter/extensions/stdapi/railgun.rb.ts.rb +4 -0
  8. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/api_constants.rb +27 -0
  9. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/api_constants.rb.ut.rb +7 -0
  10. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_advapi32.rb +498 -242
  11. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_iphlpapi.rb +18 -18
  12. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_kernel32.rb +695 -694
  13. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_netapi32.rb +6 -5
  14. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ntdll.rb +24 -24
  15. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_shell32.rb +5 -4
  16. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_user32.rb +551 -551
  17. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/def/def_ws2_32.rb +93 -93
  18. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll.rb +56 -42
  19. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll.rb.ut.rb +4 -4
  20. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_helper.rb.ut.rb +5 -5
  21. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_wrapper.rb +26 -0
  22. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_wrapper.rb.ut.rb +63 -0
  23. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/multicall.rb +4 -4
  24. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb +151 -96
  25. data/lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb.ut.rb +80 -5
  26. data/lib/rex/post/meterpreter/extensions/stdapi/sys/config.rb +3 -3
  27. data/lib/rex/post/meterpreter/extensions/stdapi/sys/process.rb +11 -11
  28. data/lib/rex/post/meterpreter/extensions/stdapi/sys/registry.rb +3 -3
  29. data/lib/rex/post/meterpreter/packet.rb +12 -11
  30. data/lib/rex/proto/dhcp/server.rb +36 -42
  31. data/lib/rex/socket/range_walker.rb +1 -1
  32. data/lib/rex/text.rb +18 -1
  33. data/lib/rex/ui/text/table.rb +1 -1
  34. metadata +5 -3
@@ -172,7 +172,7 @@ class RangeWalker
172
172
 
173
173
  #
174
174
  # Calls the given block with each address. This is basically a wrapper for
175
- # +next_ip+
175
+ # #next_ip
176
176
  #
177
177
  def each(&block)
178
178
  while (ip = next_ip)
@@ -35,6 +35,7 @@ module Text
35
35
  Alpha = UpperAlpha + LowerAlpha
36
36
  AlphaNumeric = Alpha + Numerals
37
37
  HighAscii = [*(0x80 .. 0xff)].pack("C*")
38
+ LowAscii = [*(0x00 .. 0x1f)].pack("C*")
38
39
  DefaultWrap = 60
39
40
  AllChars = [*(0x00 .. 0xff)].pack("C*")
40
41
 
@@ -1122,7 +1123,23 @@ module Text
1122
1123
  def self.pack_int64le(val)
1123
1124
  [val & 0x00000000ffffffff, val >> 32].pack("V2")
1124
1125
  end
1125
-
1126
+
1127
+
1128
+ #
1129
+ # A custom unicode filter for dealing with multi-byte strings on a 8-bit console
1130
+ # Punycode would have been more "standard", but it requires valid Unicode chars
1131
+ #
1132
+ def self.unicode_filter_encode(str)
1133
+ if (str.unpack("C*") & ( LowAscii + HighAscii + "\x7f" ).unpack("C*")).length > 0
1134
+ str = "$U$" + str.unpack("C*").select{|c| c < 0x7f and c > 0x1f and c != 0x2d}.pack("C*") + "-0x" + str.unpack("H*")[0]
1135
+ else
1136
+ str
1137
+ end
1138
+ end
1139
+
1140
+ def self.unicode_filter_decode(str)
1141
+ str.gsub( /\$U\$([\x20-\x2c\x2e-\x7E]*)\-0x([A-Fa-f0-9]+)/ ){|m| [$2].pack("H*") }
1142
+ end
1126
1143
 
1127
1144
  protected
1128
1145
 
@@ -94,7 +94,7 @@ class Table
94
94
  # Converts table contents to a string.
95
95
  #
96
96
  def to_s
97
- str = prefix
97
+ str = ''
98
98
  str << header_to_s || ''
99
99
  str << columns_to_s || ''
100
100
  str << hr_to_s || ''
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: librex
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.42
5
+ version: 0.0.43
6
6
  platform: ruby
7
7
  authors:
8
8
  - Metasploit Development Team
@@ -11,11 +11,11 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2011-07-12 00:00:00 -05:00
14
+ date: 2011-07-19 00:00:00 -05:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
 
18
- description: Rex provides a variety of classes useful for security testing and exploit development. Based on SVN Revision 13159
18
+ description: Rex provides a variety of classes useful for security testing and exploit development. Based on SVN Revision 13247
19
19
  email:
20
20
  - hdm@metasploit.com
21
21
  - jacob.hammack@hammackj.com
@@ -253,6 +253,8 @@ files:
253
253
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_function.rb.ut.rb
254
254
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_helper.rb
255
255
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_helper.rb.ut.rb
256
+ - lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_wrapper.rb
257
+ - lib/rex/post/meterpreter/extensions/stdapi/railgun/dll_wrapper.rb.ut.rb
256
258
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/mock_magic.rb
257
259
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/multicall.rb
258
260
  - lib/rex/post/meterpreter/extensions/stdapi/railgun/railgun.rb