-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Land #10516, Add brace expansion encoder and update ${IFS} encoder
- Loading branch information
1 parent
4e967d4
commit 0294d7e
Showing
5 changed files
with
57 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
## | ||
# This module requires Metasploit: https://metasploit.com/download | ||
# Current source: https://github.com/rapid7/metasploit-framework | ||
## | ||
|
||
class MetasploitModule < Msf::Encoder | ||
|
||
# This may produce incorrect code due to minimal escaping | ||
Rank = LowRanking | ||
|
||
def initialize | ||
super( | ||
'Name' => 'Bash Brace Expansion Command Encoder', | ||
'Description' => %q{ | ||
This encoder uses brace expansion in Bash and other shells | ||
to avoid whitespace without being overly fancy. | ||
}, | ||
'Author' => ['wvu', 'egypt'], | ||
'Platform' => 'unix', | ||
'Arch' => ARCH_CMD, | ||
'EncoderType' => Msf::Encoder::Type::CmdUnixBrace | ||
) | ||
end | ||
|
||
def encode_block(state, buf) | ||
# Skip encoding if there are no badchars | ||
return buf if state.badchars !~ /\s/ | ||
|
||
# Perform brace expansion encoding | ||
"{#{buf.gsub(',', '\\,').gsub(/\s+/, ',')}}" | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters