Moved http response to a function
This commit is contained in:
@@ -326,4 +326,9 @@ def valid_json?(json)
|
|||||||
return true
|
return true
|
||||||
rescue JSON::ParserError => e
|
rescue JSON::ParserError => e
|
||||||
return false
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
# Get the HTTP response code
|
||||||
|
def get_http_status(url)
|
||||||
|
Browser.get(url.to_s).code
|
||||||
end
|
end
|
||||||
@@ -15,12 +15,6 @@ class WebSite
|
|||||||
@uri.clone.merge('robots.txt').to_s
|
@uri.clone.merge('robots.txt').to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check status code for each robots.txt entry
|
|
||||||
def header_robots_txt(url)
|
|
||||||
code = Browser.get(url).code
|
|
||||||
puts info("Interesting entry from robots.txt: #{url} [HTTP #{code}]")
|
|
||||||
end
|
|
||||||
|
|
||||||
# Parse robots.txt
|
# Parse robots.txt
|
||||||
# @return [ Array ] URLs generated from robots.txt
|
# @return [ Array ] URLs generated from robots.txt
|
||||||
def parse_robots_txt
|
def parse_robots_txt
|
||||||
|
|||||||
23
wpscan.rb
23
wpscan.rb
@@ -237,16 +237,29 @@ def main
|
|||||||
spacer()
|
spacer()
|
||||||
|
|
||||||
if wp_target.has_robots?
|
if wp_target.has_robots?
|
||||||
puts info("robots.txt available under: #{wp_target.robots_url}")
|
code = get_http_status(wp_target.robots_url)
|
||||||
|
puts info("robots.txt available under: #{wp_target.robots_url} [HTTP #{code}]")
|
||||||
|
|
||||||
wp_target.parse_robots_txt.each do |dir|
|
wp_target.parse_robots_txt.each do |dir|
|
||||||
wp_target.header_robots_txt(dir)
|
code = get_http_status(dir)
|
||||||
|
puts info("Interesting entry from robots.txt: #{dir} [HTTP #{code}]")
|
||||||
|
end
|
||||||
|
spacer()
|
||||||
|
end
|
||||||
|
|
||||||
|
if wp_target.has_sitemap?
|
||||||
|
puts info("Sitemap found: #{wp_target.sitemap_url}")
|
||||||
|
|
||||||
|
wp_target.parse_sitemap.each do |dir|
|
||||||
|
code = get_http_status(dir)
|
||||||
|
puts info("Sitemap entry: #{dir} [HTTP #{code}]")
|
||||||
end
|
end
|
||||||
spacer()
|
spacer()
|
||||||
end
|
end
|
||||||
|
|
||||||
if wp_target.has_humans?
|
if wp_target.has_humans?
|
||||||
puts info("humans.txt available under: #{wp_target.humans_url}")
|
code = get_http_status(wp_target.humans_url)
|
||||||
|
puts info("humans.txt available under: #{wp_target.humans_url} [HTTP #{code}]")
|
||||||
|
|
||||||
wp_target.parse_humans_txt.each do |dir|
|
wp_target.parse_humans_txt.each do |dir|
|
||||||
puts info("Interesting entry from humans.txt: #{dir}")
|
puts info("Interesting entry from humans.txt: #{dir}")
|
||||||
@@ -315,8 +328,10 @@ def main
|
|||||||
# Get RSS
|
# Get RSS
|
||||||
rss = wp_target.rss_url
|
rss = wp_target.rss_url
|
||||||
if rss
|
if rss
|
||||||
|
code = get_http_status(rss)
|
||||||
|
|
||||||
# Feedback
|
# Feedback
|
||||||
puts info("RSS Feed: #{rss}")
|
puts info("Found an RSS Feed: #{rss} [HTTP #{code}]")
|
||||||
|
|
||||||
# Print users from RSS feed
|
# Print users from RSS feed
|
||||||
wp_target.rss_authors(rss)
|
wp_target.rss_authors(rss)
|
||||||
|
|||||||
Reference in New Issue
Block a user