|
137 | 137 |
|
138 | 138 | end
|
139 | 139 |
|
140 |
| - context "building an elf with linux/x86/shell_bind_tcp" do |
141 |
| - let(:args) { %w! -f elf -p linux/x86/shell_bind_tcp ! } |
142 |
| - # We're not encoding, so should be testable here |
143 |
| - it "should contain /bin/sh" do |
144 |
| - output = venom.generate_raw_payload |
145 |
| - # usually push'd, so it's not all strung together |
146 |
| - output.should include("/sh") |
147 |
| - output.should include("/bin") |
| 140 | + [ |
| 141 | + { :format => "elf", :arch => "x86" }, |
| 142 | + { :format => "raw", :arch => "x86" }, |
| 143 | + { :format => "elf", :arch => "armle" }, |
| 144 | + { :format => "raw", :arch => "armle" }, |
| 145 | + { :format => "elf", :arch => "ppc" }, |
| 146 | + { :format => "raw", :arch => "ppc" }, |
| 147 | + { :format => "elf", :arch => "mipsle" }, |
| 148 | + { :format => "raw", :arch => "mipsle" }, |
| 149 | + ].each do |format_hash| |
| 150 | + format = format_hash[:format] |
| 151 | + arch = format_hash[:arch] |
| 152 | + |
| 153 | + context "building #{format} with linux/#{arch}/shell_bind_tcp" do |
| 154 | + let(:args) { %W! -f #{format} -p linux/#{arch}/shell_bind_tcp ! } |
| 155 | + # We're not encoding, so should be testable here |
| 156 | + it "should contain /bin/sh" do |
| 157 | + output = venom.generate_raw_payload |
| 158 | + # usually push'd, so it's not all strung together |
| 159 | + output.should include("/sh") |
| 160 | + output.should include("/bin") |
| 161 | + end |
148 | 162 | end
|
149 |
| - end |
150 | 163 |
|
151 |
| - context "with a raw linux/x86/shell_bind_tcp" do |
152 |
| - let(:args) { %w! -f raw -p linux/x86/shell_bind_tcp ! } |
153 |
| - # We're not encoding, so should be testable here |
154 |
| - it "should contain /bin/sh" do |
155 |
| - output = venom.generate_raw_payload |
156 |
| - # usually push'd, so it's not all strung together |
157 |
| - output.should include("/sh") |
158 |
| - output.should include("/bin") |
159 |
| - end |
160 | 164 | end
|
161 | 165 |
|
162 | 166 | end
|
|
175 | 179 |
|
176 | 180 | context "without required datastore option" do
|
177 | 181 | # Requires LHOST
|
178 |
| - let(:args) { %w!-f exe -p windows/shell_reverse_tcp ! } |
| 182 | + let(:args) { %w!-f exe -p windows/shell_reverse_tcp! } |
179 | 183 | it "should fail validation" do
|
180 | 184 | expect { venom.generate }.to raise_error(Msf::OptionValidateError)
|
181 | 185 | end
|
182 | 186 | end
|
183 | 187 |
|
184 | 188 | @platform_format_map.each do |plat, formats|
|
185 | 189 | formats.each do |format_hash|
|
| 190 | + format = format_hash[:format] |
| 191 | + arch = format_hash[:arch] |
186 | 192 | # Need a new context for each so the let() will work correctly
|
187 |
| - context "with format=#{format_hash[:format]} platform=#{plat} arch=#{format_hash[:arch]}" do |
| 193 | + context "with format=#{format} platform=#{plat} arch=#{arch}" do |
188 | 194 | # This will build executables with no payload. They won't work
|
189 | 195 | # of course, but at least we can see that it is producing the
|
190 | 196 | # correct file format for the given arch and platform.
|
191 |
| - let(:args) { %W! -p - -f #{format_hash[:format]} -a #{format_hash[:arch]} --platform #{plat} ! } |
192 |
| - it "should print a #{format_hash[:format]} to stdout" do |
| 197 | + let(:args) { %W! -p - -f #{format} -a #{arch} --platform #{plat} ! } |
| 198 | + it "should print a #{format} to stdout" do |
193 | 199 | venom.generate
|
194 | 200 | output = stdout.string
|
195 | 201 | verify_bin_fingerprint(format_hash, output)
|
|
0 commit comments