Trying to make code climate happier

This commit is contained in:
g0tmi1k
2018-05-14 18:08:42 +01:00
parent f90a64ce81
commit b5e3e6280e
4 changed files with 26 additions and 43 deletions

View File

@@ -3,29 +3,11 @@
class WebSite
module HumansTxt
# Gets a humans.txt URL
# Gets the humans.txt URL
# @return [ String ]
def humans_url
@uri.clone.merge('humans.txt').to_s
end
# Parse humans.txt
# @return [ Array ] URLs generated from humans.txt
def parse_humans_txt
return_object = []
response = Browser.get(humans_url.to_s)
body = response.body
# Get all non-comments
entries = body.split(/\n/)
# Did we get something?
if entries
# Remove any rubbish
entries = clean_uri(entries)
end
return return_object
end
end
end

View File

@@ -3,29 +3,11 @@
class WebSite
module SecurityTxt
# Gets a security.txt URL
# Gets the security.txt URL
# @return [ String ]
def security_url
@uri.clone.merge('.well-known/security.txt').to_s
end
# Parse security.txt
# @return [ Array ] URLs generated from security.txt
def parse_security_txt
return_object = []
response = Browser.get(security_url.to_s)
body = response.body
# Get all non-comments
entries = body.split(/\n/)
# Did we get something?
if entries
# Remove any rubbish
entries = clean_uri(entries)
end
return return_object
end
end
end

View File

@@ -153,6 +153,25 @@ def full_uri(entries)
return return_object
end
# Parse humans.txt
# @return [ Array ] URLs generated from humans.txt
def parse_txt(url)
return_object = []
response = Browser.get(url.to_s)
body = response.body
# Get all non-comments
entries = body.split(/\n/)
# Did we get something?
if entries
# Remove any rubbish
entries = clean_uri(entries)
end
return return_object
end
# Hook to check if the target if down during the scan
# And have the number of requests performed to display at the end of the scan
# The target is considered down after 30 requests with status = 0