Skip to content

Commit

Permalink
[FIX] Code style level 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav WEB committed Jan 30, 2017
1 parent e6bf69c commit b7c8b5a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
19 changes: 15 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
from src import Controller

try:
long_description = pypandoc.convert('README.md', 'rst')
LONG_DESCRIPTION = pypandoc.convert('README.md', 'rst')
except(IOError, ImportError):
long_description = open('README.md').read()
LONG_DESCRIPTION = open('README.md').read()

setup(name='opendoor',

Expand All @@ -36,7 +36,7 @@

version=Controller.local_version(),

description='OWASP Directory Access scanner', long_description=long_description,
description='OWASP Directory Access scanner', long_description=LONG_DESCRIPTION,

# The project's main homepage.
url='https://github.com/stanislav-web/OpenDoor',
Expand Down Expand Up @@ -75,15 +75,26 @@
# 5 - Production/Stable
'Development Status :: 4 - Beta',

# Language
'Natural Language :: English',

# Indicate who your project is intended for
'Intended Audience :: Developers',

# OS which support this package
'Operating System :: MacOS',
'Operating System :: Unix',

# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python', 'Programming Language :: Python :: 2.7',

'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',

# Specify the additional categories
'Topic :: Internet :: WWW/HTTP :: Site Management :: Link Checking'])
28 changes: 14 additions & 14 deletions src/core/http/providers/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class ResponseProvider(object):
""" ResponseProvider class"""

_HTTP_DBG_LEVEL = 3
__INDEX_OF_TITLE = 'Index of /'
__DEFAULT_SOURCE_DETECT_MIN_SIZE = 1000000
__DEFAULT_HTTP_SUCCESS_STATUSES = [100, 101, 200, 201, 202, 203, 204, 205, 206, 207, 208]
__DEFAULT_HTTP_REDIRECT_STATUSES = [301, 302, 303, 304, 307, 308]
__DEFAULT_HTTP_FAILED_STATUSES = [404, 406, 429, 500, 501, 502, 503, 504]
__DEFAULT_HTTP_FORBIDDEN_STATUSES = [401, 403]
__DEFAULT_HTTP_BAD_REQUEST_STATUSES = [400]
_INDEX_OF_TITLE = 'Index of /'
_DEFAULT_SOURCE_DETECT_MIN_SIZE = 1000000
_DEFAULT_HTTP_SUCCESS_STATUSES = [100, 101, 200, 201, 202, 203, 204, 205, 206, 207, 208]
_DEFAULT_HTTP_REDIRECT_STATUSES = [301, 302, 303, 304, 307, 308]
_DEFAULT_HTTP_FAILED_STATUSES = [404, 406, 429, 500, 501, 502, 503, 504]
_DEFAULT_HTTP_FORBIDDEN_STATUSES = [401, 403]
_DEFAULT_HTTP_BAD_REQUEST_STATUSES = [400]

def __init__(self, config):
"""
Expand All @@ -49,7 +49,7 @@ def is_indexof(self):
"""

regex = re.compile('<title>(.*?)</title>', re.IGNORECASE | re.DOTALL)
title = regex.search(self.__INDEX_OF_TITLE)
title = regex.search(self._INDEX_OF_TITLE)
if None is not title:
return True
return False
Expand Down Expand Up @@ -85,17 +85,17 @@ def detect(self, request_url, response):
:return: str
"""

if response.status in self.__DEFAULT_HTTP_SUCCESS_STATUSES:
if response.status in self._DEFAULT_HTTP_SUCCESS_STATUSES:
if 'Content-Length' in response.headers:
if self.__DEFAULT_SOURCE_DETECT_MIN_SIZE <= int(response.headers['Content-Length']):
if self._DEFAULT_SOURCE_DETECT_MIN_SIZE <= int(response.headers['Content-Length']):
return 'file'
if True is self._cfg.is_indexof:
if True is self.is_indexof:
return 'indexof'
return 'success'
elif response.status in self.__DEFAULT_HTTP_FAILED_STATUSES:
elif response.status in self._DEFAULT_HTTP_FAILED_STATUSES:
return 'failed'
elif response.status in self.__DEFAULT_HTTP_REDIRECT_STATUSES:
elif response.status in self._DEFAULT_HTTP_REDIRECT_STATUSES:
if False != response.get_redirect_location():
urlfrag = helper.parse_url(request_url)
redirect_url = response.get_redirect_location().rstrip('/')
Expand All @@ -106,9 +106,9 @@ def detect(self, request_url, response):
if url == redirect_url or redirectfrag.query in urlfrag.path:
return 'failed'
return 'redirect'
elif response.status in self.__DEFAULT_HTTP_BAD_REQUEST_STATUSES:
elif response.status in self._DEFAULT_HTTP_BAD_REQUEST_STATUSES:
return 'bad'
elif response.status in self.__DEFAULT_HTTP_FORBIDDEN_STATUSES:
elif response.status in self._DEFAULT_HTTP_FORBIDDEN_STATUSES:
return 'forbidden'
else:
raise Exception('Unknown response status : `{0}`'.format(response.status))
Expand Down
1 change: 0 additions & 1 deletion src/core/system/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def terminal_size(cls):

(height, width) = subprocess.check_output(['stty', 'size']).split()
ts = {'height': height, 'width': width}
print ts
cls.ts = ts
return cls.ts

Expand Down

0 comments on commit b7c8b5a

Please sign in to comment.