Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andresriancho committed Dec 31, 2014
1 parent c86833d commit e4d4d84
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 6 deletions.
11 changes: 8 additions & 3 deletions w3af/core/controllers/core_helpers/consumers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class auth(BaseConsumer):

def __init__(self, auth_plugins, w3af_core, timeout):
"""
:param in_queue: A queue that's used to communicate with the thread. Items
that might appear in this queue are:
:param in_queue: A queue that's used to communicate with the thread.
Items that might appear in this queue are:
* POISON_PILL
* FORCE_LOGIN
:param auth_plugins: Instances of auth plugins in a list
Expand All @@ -56,7 +56,9 @@ def run(self):
try:
action = self.in_queue.get(timeout=self._timeout)
except Queue.Empty:
# pylint: disable=E1120
self._login()
# pylint: enable=E1120
else:

if action == POISON_PILL:
Expand All @@ -68,9 +70,10 @@ def run(self):
break

elif action == FORCE_LOGIN:

# pylint: disable=E1120
self._login()
self.in_queue.task_done()
# pylint: enable=E1120

# Adding task here because we want to let the rest of the world know
# that we're still doing something. The _task_done below will "undo"
Expand All @@ -92,4 +95,6 @@ def async_force_login(self):
self.in_queue_put(FORCE_LOGIN)

def force_login(self):
# pylint: disable=E1120
self._login()
# pylint: enable=E1120
2 changes: 2 additions & 0 deletions w3af/core/controllers/core_helpers/consumers/base_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,10 @@ def run(self):
break

else:
# pylint: disable=E1120
self._consume_wrapper(work_unit)
self.in_queue.task_done()
# pylint: enable=E1120

def _teardown(self):
raise NotImplementedError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ def run(self):
try:
work_unit = self.in_queue.get(timeout=0.1)
except Queue.Empty:
# pylint: disable=E1120
self._route_all_plugin_results()
# pylint: enable=E1120
else:
if work_unit == POISON_PILL:

Expand Down Expand Up @@ -135,7 +137,9 @@ def _consume(self, function_id, work_unit):
self._threadpool.apply_async(return_args(self._discover_worker),
(plugin, work_unit,),
callback=self._plugin_finished_cb)
# pylint: disable=E1120
self._route_all_plugin_results()
# pylint: enable=E1120

@task_decorator
def _plugin_finished_cb(self,
Expand All @@ -144,7 +148,9 @@ def _plugin_finished_cb(self,
if not self._running:
return

# pylint: disable=E1120
self._route_plugin_results(plugin)
# pylint: enable=E1120

@task_decorator
def _route_all_plugin_results(self, function_id):
Expand All @@ -156,7 +162,9 @@ def _route_all_plugin_results(self, function_id):
if plugin in self._disabled_plugins:
continue

# pylint: disable=E1120
self._route_plugin_results(plugin)
# pylint: enable=E1120

@task_decorator
def _route_plugin_results(self, function_id, plugin):
Expand Down
16 changes: 13 additions & 3 deletions w3af/core/controllers/tests/pylint_plugins/hashlib_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,28 @@ def update(self, x):
return u''
def digest(self):
return u''
class sha256(object):
def __init__(self, value): pass
def hexdigest(self):
return u''
def update(self, x):
return u''
def digest(self):
return u''
"""


def hashlib_transform(module):
if module.name == 'hashlib':
fake = ASTNGBuilder(MANAGER).string_build(CODE_FIX)

for hashfunc in ('sha1', 'md5', 'sha512'):
for hashfunc in ('sha1', 'md5', 'sha512', 'sha256'):
module.locals[hashfunc] = fake.locals[hashfunc]


def register(linter):
"""called when loaded by pylint --load-plugins, register our tranformation
"""called when loaded by pylint --load-plugins, register our transformation
function here
"""
MANAGER.register_transformer(hashlib_transform)

0 comments on commit e4d4d84

Please sign in to comment.