Module: Msf::Exploit::Remote::HTTP::Moodle::Course
- Included in:
- Msf::Exploit::Remote::HTTP::Moodle
- Defined in:
- lib/msf/core/exploit/remote/http/moodle/course.rb
Instance Method Summary collapse
-
#enrol(user_id, course_id, enrol_id, sess_key, role = '1') ⇒ Boolean
performs a moodle course enrollment.
-
#get_course_context_id(course_id) ⇒ String?
obtains the contextid from an enrolled course.
-
#get_course_enrol_id(course_id) ⇒ String?
obtains the enrolid from an enrolled course.
Instance Method Details
#enrol(user_id, course_id, enrol_id, sess_key, role = '1') ⇒ Boolean
performs a moodle course enrollment
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/msf/core/exploit/remote/http/moodle/course.rb', line 12 def enrol(user_id, course_id, enrol_id, sess_key, role = '1') res = send_request_cgi({ 'uri' => moodle_enrol_ajax, 'vars_get' => moodle_helper_enrol_get_data(user_id, course_id, enrol_id, sess_key, role), 'keep_cookies' => true }) return false unless res if res.body.include?('success') return true end return false end |
#get_course_context_id(course_id) ⇒ String?
obtains the contextid from an enrolled course
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/msf/core/exploit/remote/http/moodle/course.rb', line 48 def get_course_context_id(course_id) res = send_request_cgi({ 'uri' => moodle_user_home, 'vars_get' => { 'id' => course_id }, 'keep_cookies' => true }) return nil unless res res.body =~ /contextid=(\d*)"/ Regexp.last_match(1) end |
#get_course_enrol_id(course_id) ⇒ String?
obtains the enrolid from an enrolled course
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/msf/core/exploit/remote/http/moodle/course.rb', line 30 def get_course_enrol_id(course_id) res = send_request_cgi({ 'uri' => moodle_user_home, 'vars_get' => { 'id' => course_id }, 'keep_cookies' => true }) return nil unless res res.body =~ /name="enrolid" value="(.*?)"/ Regexp.last_match(1) end |