lib/ronin/network/extensions/http/net.rb in ronin-0.2.2 vs lib/ronin/network/extensions/http/net.rb in ronin-0.2.3
- old
+ new
@@ -164,10 +164,37 @@
def Net.http_ok?(options={})
Net.http_head(options).code == 200
end
#
+ # Returns the HTTP Server header for the given _options_.
+ #
+ # Net.http_server(:url => 'http://www.darkc0de.com/)
+ # # => "Apache/2.2.11 (Unix) PHP/4.4.9 mod_ssl/2.2.11 OpenSSL/0.9.8c
+ # mod_fastcgi/2.4.6 Phusion_Passenger/2.1.2 DAV/2 SVN/1.4.2"
+ #
+ def Net.http_server(options={})
+ Net.http_head(options)['server']
+ end
+
+ #
+ # Returns the HTTP X-Powered-By header for the given _options_.
+ #
+ # Net.http_powered_by(:url => 'http://www.stalkdaily.com/')
+ # # => "PHP/5.2.9"
+ #
+ def Net.http_powered_by(options={})
+ resp = Net.http_head(options)
+
+ if resp.code != 200
+ resp = Net.http_get(options)
+ end
+
+ return resp['x-powered-by']
+ end
+
+ #
# Performes an HTTP Lock request with the given _options_. If a _block_
# is given, it will be passed the response from the HTTP server.
# Returns the response from the HTTP server.
#
def Net.http_lock(options={},&block)
@@ -266,16 +293,16 @@
return resp
end
end
#
- # Performes an HTTP Proppath request with the given _options_. If a
+ # Performes an HTTP Proppatch request with the given _options_. If a
# _block_ is given, it will be passed the response from the HTTP server.
# Returns the response from the HTTP server.
#
- def Net.http_prop_path(options={},&block)
+ def Net.http_prop_patch(options={},&block)
Net.http_session(options) do |http|
- resp = http.request(Ronin::Network::HTTP.request(:proppath,options),options[:body])
+ resp = http.request(Ronin::Network::HTTP.request(:proppatch,options),options[:body])
block.call(resp) if block
return resp
end
end