Skip to content

Commit

Permalink
[FIX] Code style level 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav WEB committed Jan 30, 2017
1 parent 7bd8317 commit 4a88b13
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 102 deletions.
2 changes: 1 addition & 1 deletion src/core/color/color.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __has_colors(stream):
import curses
curses.setupterm()
return curses.tigetnum("colors") > 2
except:
except Exception:
# guess false in case of error
return False

Expand Down
1 change: 0 additions & 1 deletion src/core/filesystem/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ def makedir(dir, mode=0777):
except OSError , e:
if e.errno != errno.EEXIST:
raise FileSystemError("Cannot create directory `{0}`. Reason: {1}".format(dir, e.message))
pass

@staticmethod
def getabsname(filename):
Expand Down
5 changes: 2 additions & 3 deletions src/core/http/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,10 @@ def request(self, url):
except MaxRetryError:
if self.__cfg.DEFAULT_SCAN == self.__cfg.scan:
self.__tpl.warning(key='max_retry_error', url=helper.parse_url(url).path)
pass

except HostChangedError , e:
self.__tpl.warning(key='host_changed_error', details=e)
pass

except ReadTimeoutError:
if self.__cfg.DEFAULT_SCAN == self.__cfg.scan:
self.__tpl.warning(key='read_timeout_error', url=helper.parse_url(url).path)
pass
11 changes: 7 additions & 4 deletions src/core/http/providers/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ def _headers(self):
:return: dict headers
"""

self._add_header('Accept', self._accept)._add_header('Accept-Encoding', self._accept_encoding)._add_header(
'Accept-Language', self._accept_language)._add_header('Referer', ''.join(
[self.__cfg.scheme, self.__cfg.host]))._add_header('User-Agent', self.__user_agent)._add_header(
'Cache-Conrol', 'no-cache')._add_header('Pragma', 'no-cache')
self._add_header('Accept', self._accept)\
._add_header('Accept-Encoding', self._accept_encoding)\
._add_header('Accept-Language', self._accept_language)\
._add_header('Referer', ''.join([self.__cfg.scheme, self.__cfg.host]))\
._add_header('User-Agent', self.__user_agent)\
._add_header('Cache-Conrol', 'no-cache')\
._add_header('Pragma', 'no-cache')

return self.__headers
5 changes: 3 additions & 2 deletions src/core/http/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self, config, debug, **kwargs):
self.__proxylist = kwargs.get('proxy_list')
RequestProvider.__init__(self, config, agent_list=kwargs.get('agent_list'))

self.__server = None
self.__pm = None
self.__cfg = config
self.__debug = debug
Expand Down Expand Up @@ -103,11 +104,11 @@ def request(self, url):
except MaxRetryError:
if self.__cfg.DEFAULT_SCAN == self.__cfg.scan:
self.__tpl.warning(key='proxy_max_retry_error', url=helper.parse_url(url).path, proxy=self.__server)
pass

except ReadTimeoutError:
if self.__cfg.DEFAULT_SCAN == self.__cfg.scan:
self.__tpl.warning(key='read_timeout_error', url=helper.parse_url(url).path)
pass


def __get_random_proxy(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/core/http/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ def handle(self, response, request_url, items_size, total_size):

else:
raise ResponseError('Unable to get response from {url}'.format(url=request_url))
pass

2 changes: 1 addition & 1 deletion src/core/logger/colorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def emit(self, record):
self.flush()
except (KeyboardInterrupt, SystemExit):
raise
except:
except Exception:
self.handleError(record)

if os.name != 'nt':
Expand Down
2 changes: 2 additions & 0 deletions src/core/system/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@


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

@property
def terminal_size(cls):
"""
Expand Down
2 changes: 0 additions & 2 deletions src/core/system/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def kill_process(signum, frame):
os.kill(os.getpid(), signal.SIGTERM)

signal.signal(signal.SIGTSTP, kill_process)
pass

@staticmethod
def exit(msg):
Expand Down Expand Up @@ -95,5 +94,4 @@ def version():
"""

version = platform.python_version().split(".")

return "{0}.{1}".format(version[0], version[1])
5 changes: 2 additions & 3 deletions src/lib/browser/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self, params):
'is_standalone_proxy': self.__config.is_standalone_proxy,
'is_external_torlist': self.__config.is_external_torlist})

self.__reader._count_total_lines()
self.__reader.count_total_lines()

Filter.__init__(self, self.__config, self.__reader.total_lines)

Expand Down Expand Up @@ -100,7 +100,7 @@ def scan(self):
self.__debug.debug_list(total_lines=self.__pool.total_items_size)

if True is self.__config.is_random_list:
self.__reader._randomize_list(self.__config.scan)
self.__reader.randomize_list(self.__config.scan)

tpl.info(key='scanning', host=self.__config.host)

Expand Down Expand Up @@ -174,7 +174,6 @@ def _add_urls(self, urllist):
else:
self.catch_report_data('ignored', url)
tpl.warning(key='ignored_path', path=helper.parse_url(url).path)
pass
self.__pool.join()

except (SystemExit, KeyboardInterrupt):
Expand Down
1 change: 0 additions & 1 deletion src/lib/browser/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def __init__(self, Config):
tpl.debug(key='debug', level=self.__cfg.debug, method=self.__cfg.method)
if True is self.__cfg.is_indexof:
tpl.debug(key='indexof_act', method=self.__cfg.method)
pass

@property
def level(self):
Expand Down
1 change: 0 additions & 1 deletion src/lib/browser/threadpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,3 @@ def resume(self):
for worker in self.__workers:
worker.resume()
self.is_started = True
pass
4 changes: 2 additions & 2 deletions src/lib/reader/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def _directories__line(self, line, params):

return line

def _randomize_list(self, target_list):
def randomize_list(self, target_list):
"""
Randomize scan list
:param str target_list: target list
Expand All @@ -208,7 +208,7 @@ def _randomize_list(self, target_list):
except (CoreSystemError, FileSystemError) , e:
raise ReaderError(e)

def _count_total_lines(self):
def count_total_lines(self):
"""
Count total lines inside wordlist
:param string listname:
Expand Down
2 changes: 0 additions & 2 deletions src/lib/reporter/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,5 @@
Development Team: Stanislav WEB
"""

from .csv import CsvReportPlugin as csv
from .json import JsonReportPlugin as json
from .std import StdReportPlugin as std

38 changes: 0 additions & 38 deletions src/lib/reporter/plugins/csv.py

This file was deleted.

37 changes: 0 additions & 37 deletions src/lib/reporter/plugins/json.py

This file was deleted.

3 changes: 0 additions & 3 deletions src/lib/reporter/plugins/provider/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def __init__(self, data):

self._data = {}
self.__set_data(data)
pass

def __set_data(self, data):
"""
Expand All @@ -42,8 +41,6 @@ def __set_data(self, data):
raise TypeError("Report data has a wrong type")
self._data = data

pass

def process(self):
"""
Process data
Expand Down

0 comments on commit 4a88b13

Please sign in to comment.