Skip to content

Commit

Permalink
[FIX] Code style level 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav WEB committed Jan 30, 2017
1 parent ef42020 commit e0c3234
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 45 deletions.
3 changes: 2 additions & 1 deletion src/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def local_version():
except (AttributeError, PackageError) , e:
raise SrcError(e)

def scan_action(self, params=()):
@classmethod
def scan_action(cls, params=()):
"""
URL scan action
:param dict params: console input args
Expand Down
2 changes: 1 addition & 1 deletion src/core/color/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def colored(text, color):
:return: string
"""

if type(text) is not str:
if False is isinstance(text,str):
text = str(text)
if Color.__has_colors(sys.stdout):
text = text.strip('\n')
Expand Down
7 changes: 7 additions & 0 deletions src/core/filesystem/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ def readraw(data):

@staticmethod
def human_size(size, precision=2):
"""
Humanize accepted bytes
:param int size:
:param int precision:
:return:
"""

suffixes = ['B', 'KB', 'MB', 'GB', 'TB']
suffix_index = 0
size = int(size)
Expand Down
2 changes: 1 addition & 1 deletion src/core/helper/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def to_json(data, sort=True, indents=4):
:return: str
"""

if type(data) is str:
if True is isinstance(data,str):
json_data = json.dumps(json.loads(data), sort_keys=sort, indent=indents)
else:
json_data = json.dumps(data, sort_keys=sort, indent=indents)
Expand Down
3 changes: 2 additions & 1 deletion src/core/http/providers/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def is_indexof(self):
return True
return False

def _get_redirect_url(self, url, response):
@classmethod
def _get_redirect_url(cls, url, response):
"""
Get redirect url
:param str url:
Expand Down
3 changes: 2 additions & 1 deletion src/core/http/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def __get_random_proxy(self):

return server

def __get_proxy_type(self, server):
@classmethod
def __get_proxy_type(cls, server):
"""
Set proxy type
:param str server:
Expand Down
6 changes: 6 additions & 0 deletions src/core/logger/colorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ def emit(self, record):

if os.name != 'nt':
def output_colorized(self, message):
"""
Prepare colorized string
:param str message: message
:return: None
"""
self.stream.write(message)

else:
import re
ansi_esc = re.compile(r'\x1b\[((?:\d+)(?:;(?:\d+))*)m')
Expand Down
1 change: 1 addition & 0 deletions src/core/logger/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@


class Exception():
""" Exception class """
@staticmethod
def log(class_name='Error', message=''):
"""
Expand Down
3 changes: 2 additions & 1 deletion src/core/logger/rainbow.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def colorize(self, record):
end = (' ' * length)[:length]
return output + end

def __pure_line_len(self, string):
@classmethod
def __pure_line_len(cls, string):
"""
Get pure line
:param str string:
Expand Down
5 changes: 4 additions & 1 deletion src/core/options/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ def get_arg_values(self):
try:
arguments = self.parser.parse_args()

if not arguments.host and True is not arguments.version and True is not arguments.update and True is not arguments.examples:
if not arguments.host \
and True is not arguments.version \
and True is not arguments.update \
and True is not arguments.examples:
raise OptionsError("argument --host is required")

if True is arguments.version or True is arguments.update or True is arguments.examples:
Expand Down
4 changes: 2 additions & 2 deletions src/core/system/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@

import os
import subprocess

from .exceptions import CoreSystemError


class Term(type):
""" Term class """
""" Term class"""

@property
def terminal_size(cls):
Expand All @@ -43,6 +42,7 @@ def terminal_size(cls):
class Process(object):
"""Process class"""

ts = None
__metaclass__ = Term

@staticmethod
Expand Down
3 changes: 2 additions & 1 deletion src/lib/browser/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def run(self):
except Exception , e:
self.terminate(e)

def terminate(self, msg):
@classmethod
def terminate(cls, msg):
"""
Terminate thread
:return: None
Expand Down
6 changes: 4 additions & 2 deletions src/lib/reader/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def get_lines(self, params, loader):
except FileSystemError , e:
raise ReaderError(e)

def _subdomains__line(self, line, params):
@classmethod
def _subdomains__line(cls, line, params):
"""
Read lines from subdomains file
:param str line: single line
Expand All @@ -165,7 +166,8 @@ def _subdomains__line(self, line, params):

return line

def _directories__line(self, line, params):
@classmethod
def _directories__line(cls, line, params):
"""
Read lines from directories file
:param str line: single line
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tpl/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Config:
'abort': 'Session canceled', 'use_reports': 'Use --report param to store your scan results',
'logged': 'The {host} has been reported. Press ENTER to rescan or CTRL+C to exit: ',
'checking_connect': 'Wait, please, checking connect to -> {host}:{port} ...',
'slow_connection': 'Too slow connection. Please decrease the number of threads and increase the request timeout',
'slow_connection': 'Too slow connection. Please decrease the num of threads and increase the request timeout',
'online': 'Server {host}:{port} ({ip}) is online!', 'create_queue_progress': 'Create queue {bar}',
'scanning': 'Scanning {host} ...', 'debug': 'Starting debug level {level} . Using scan method: {method} ...',
'indexof_act': 'Apache index of/ pages detecting', 'randomizing': 'Randomizing scan list ...',
Expand Down
29 changes: 25 additions & 4 deletions tests/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,43 @@
class TestController(unittest.TestCase):
""" Controller test"""

@unittest.skip("run")
def test_run(self):
""" Run action test """

pass

@unittest.skip("examples_action")
def test_examples_action(self):
""" Examples action test """

pass

@unittest.skip("update_action")
def test_update_action(self):
""" Update action test """

pass

@unittest.skip("update_action")
def test_version_action(self):
""" Version action test """

pass

@unittest.skip("url_action")
def test_url_action(self):
@unittest.skip("local_version")
def test_local_version_action(self):
""" Local version test """

pass

@unittest.skip("examples_action")
def test_examples_action(self):
@unittest.skip("scan_action")
def test_scan_action(self):
""" Scan action test """

pass



if __name__ == "__main__":
unittest.main()
28 changes: 0 additions & 28 deletions tests/test_filter.py

This file was deleted.

0 comments on commit e0c3234

Please sign in to comment.