CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/encoders/cmd/ifs.rb
Views: 11779
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Encoder
7
8
# This may produce incorrect code, such as in quoted strings
9
Rank = LowRanking
10
11
def initialize
12
super(
13
'Name' => 'Bourne ${IFS} Substitution Command Encoder',
14
'Description' => %q{
15
This encoder uses Bourne ${IFS} substitution to avoid whitespace
16
without being overly fancy.
17
},
18
'Author' => ['egypt', 'wvu'],
19
'Platform' => %w[ linux unix ],
20
'Arch' => ARCH_CMD,
21
'EncoderType' => Msf::Encoder::Type::CmdPosixIFS
22
)
23
end
24
25
def encode_block(state, buf)
26
# Skip encoding if there are no badchars
27
return buf if state.badchars !~ /\s/
28
29
# Perform ${IFS} encoding
30
buf.gsub(/\s+/, '${IFS}')
31
end
32
33
end
34
35