Skip to content

Commit a471f29

Browse files
author
Tod Beardsley
committed
Merge rapid7#3476 into rapid7#3481 for meterpreter smilies
This incoporates @OJ's fixes as a result of gemification.
2 parents 8b63d3d + 769f2e4 commit a471f29

File tree

3 files changed

+37
-48
lines changed

3 files changed

+37
-48
lines changed

.gitignore

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,19 @@ external/source/exploits/**/Release
5454

5555
# Avoid checking in Meterpreter binaries. These are supplied upstream by
5656
# the meterpreter_bins gem.
57-
data/meterpreter/elevator.x64.dll
58-
data/meterpreter/elevator.x86.dll
59-
data/meterpreter/ext_server_espia.x64.dll
60-
data/meterpreter/ext_server_espia.x86.dll
61-
data/meterpreter/ext_server_extapi.x64.dll
62-
data/meterpreter/ext_server_extapi.x86.dll
63-
data/meterpreter/ext_server_incognito.x64.dll
64-
data/meterpreter/ext_server_incognito.x86.dll
65-
data/meterpreter/ext_server_kiwi.x64.dll
66-
data/meterpreter/ext_server_kiwi.x86.dll
67-
data/meterpreter/ext_server_lanattacks.x64.dll
68-
data/meterpreter/ext_server_lanattacks.x86.dll
69-
data/meterpreter/ext_server_mimikatz.x64.dll
70-
data/meterpreter/ext_server_mimikatz.x86.dll
71-
data/meterpreter/ext_server_priv.x64.dll
72-
data/meterpreter/ext_server_priv.x86.dll
73-
data/meterpreter/ext_server_stdapi.x64.dll
74-
data/meterpreter/ext_server_stdapi.x86.dll
75-
data/meterpreter/metsrv.x64.dll
76-
data/meterpreter/metsrv.x86.dll
77-
data/meterpreter/screenshot.x64.dll
78-
data/meterpreter/screenshot.x86.dll
57+
data/meterpreter/elevator.*.dll
58+
data/meterpreter/ext_server_espia.*.dll
59+
data/meterpreter/ext_server_extapi.*.dll
60+
data/meterpreter/ext_server_incognito.*.dll
61+
data/meterpreter/ext_server_kiwi.*.dll
62+
data/meterpreter/ext_server_lanattacks.*.dll
63+
data/meterpreter/ext_server_mimikatz.*.dll
64+
data/meterpreter/ext_server_priv.*.dll
65+
data/meterpreter/ext_server_stdapi.*.dll
66+
data/meterpreter/metsrv.*.dll
67+
data/meterpreter/screenshot.*.dll
7968

8069
# Avoid checking in Meterpreter libs that are built from
8170
# private source. If you're interested in this functionality,
8271
# check out Metasploit Pro: http://metasploit.com/download
83-
data/meterpreter/ext_server_pivot.x86.dll
84-
data/meterpreter/ext_server_pivot.x64.dll
72+
data/meterpreter/ext_server_pivot.*.dll

lib/rex/post/meterpreter/extensions/priv/priv.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def getsystem( technique=0 )
4545

4646
elevator_name = Rex::Text.rand_text_alpha_lower( 6 )
4747

48-
elevator_path = MeterpreterBinaries.path(elevator, client.binary_suffix)
48+
elevator_path = MeterpreterBinaries.path('elevator', client.binary_suffix)
4949

5050
elevator_path = ::File.expand_path( elevator_path )
5151

lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: binary -*-
2+
require 'set'
23
require 'rex/post/meterpreter'
34
require 'rex/parser/arguments'
45

@@ -415,23 +416,23 @@ def cmd_load(*args)
415416

416417
@@load_opts.parse(args) { |opt, idx, val|
417418
case opt
418-
when "-l"
419-
exts = []
420-
msf_path = MeterpreterBinaries.metasploit_data_dir
421-
gem_path = MeterpreterBinaries.local_dir
422-
[msf_path, gem_path].each do |path|
423-
::Dir.entries(path).each { |f|
424-
if (::File.file?(::File.join(path, f)) && f =~ /ext_server_(.*)\.#{client.binary_suffix}/ )
425-
exts.push($1) unless exts.include?($1)
426-
end
427-
}
428-
end
429-
print(exts.sort.join("\n") + "\n")
419+
when "-l"
420+
exts = SortedSet.new
421+
msf_path = MeterpreterBinaries.metasploit_data_dir
422+
gem_path = MeterpreterBinaries.local_dir
423+
[msf_path, gem_path].each do |path|
424+
::Dir.entries(path).each { |f|
425+
if (::File.file?(::File.join(path, f)) && f =~ /ext_server_(.*)\.#{client.binary_suffix}/ )
426+
exts.add($1)
427+
end
428+
}
429+
end
430+
print(exts.to_a.join("\n") + "\n")
430431

431-
return true
432-
when "-h"
433-
cmd_load_help
434-
return true
432+
return true
433+
when "-h"
434+
cmd_load_help
435+
return true
435436
end
436437
}
437438

@@ -464,19 +465,19 @@ def cmd_load(*args)
464465
end
465466

466467
def cmd_load_tabs(str, words)
467-
tabs = []
468+
tabs = SortedSet.new
468469
msf_path = MeterpreterBinaries.metasploit_data_dir
469470
gem_path = MeterpreterBinaries.local_dir
470471
[msf_path, gem_path].each do |path|
471472
::Dir.entries(path).each { |f|
472473
if (::File.file?(::File.join(path, f)) && f =~ /ext_server_(.*)\.#{client.binary_suffix}/ )
473474
if (not extensions.include?($1))
474-
tabs.push($1) unless tabs.include?($1)
475+
tabs.add($1)
475476
end
476477
end
477478
}
478479
end
479-
return tabs
480+
return tabs.to_a
480481
end
481482

482483
def cmd_use(*args)
@@ -736,10 +737,10 @@ def cmd_write(*args)
736737

737738
@@write_opts.parse(args) { |opt, idx, val|
738739
case opt
739-
when "-f"
740-
src_file = val
741-
else
742-
cid = val.to_i
740+
when "-f"
741+
src_file = val
742+
else
743+
cid = val.to_i
743744
end
744745
}
745746

0 commit comments

Comments
 (0)