Skip to content

Commit

Permalink
Update payload.py
Browse files Browse the repository at this point in the history
add some extension detect logic
  • Loading branch information
kxcode committed Jun 7, 2015
1 parent d67d4cc commit d86e16a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ def _populate_list_with_file(file_name):
clean_list.append(e.decode("utf-8", "replace"))
return clean_list

def _has_extension(res):
#wether the last path sector has '.'
if res.rfind("/") == -1:
return "." in res
else:
return "." in res[res.rfind("/"):]

class Payload():
def __init__(self, target, payload_filename):
Expand Down Expand Up @@ -83,7 +89,7 @@ def get_queue(self):
for extension in self.extensions:
# If resource is a whole word and user didnt provide a extension
# put a final /
if not extension and not '.' in resource and not self.remove_slash:
if not extension and not _has_extension(resource) and not self.remove_slash:
resource += '/'

# Put a . before extension if the users didnt do it
Expand Down

0 comments on commit d86e16a

Please sign in to comment.