Skip to content

Commit

Permalink
Linting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
buffer committed Jan 16, 2024
1 parent 17cd93f commit 3fc9d6a
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions thug/DOM/DFT.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def set_event_handler_attributes(self, elem):
except Exception: # pylint:disable=broad-except
return

if 'language' in list(attrs.keys()) and not attrs['language'].lower() in ('javascript', ):
if 'language' in list(attrs.keys()) and attrs['language'].lower() not in ('javascript', ):
return

for evt, h in attrs.items():
Expand Down Expand Up @@ -327,7 +327,7 @@ def set_event_listeners(self, elem):
def _handle_onerror(self, tag):
from thug.DOM.W3C.Events.Event import Event

if not 'onerror' in tag.attrs:
if 'onerror' not in tag.attrs:
return

if log.ThugOpts.Personality.isIE():
Expand Down Expand Up @@ -1047,7 +1047,7 @@ def force_handle_meta_x_ua_compatible(self):
if http_equiv is None:
continue

if not http_equiv.lower() in ('x-ua-compatible', ):
if http_equiv.lower() not in ('x-ua-compatible', ):
continue

content = meta.get('content', None)
Expand Down Expand Up @@ -1596,6 +1596,6 @@ def handle_events(self, soup):
self.run_htmlclassifier(soup)

def run(self):
with self.context as ctx: # pylint:disable=unused-variable
with self.context:
self._run()
log.ThugLogging.Shellcode.check_shellcodes()
2 changes: 1 addition & 1 deletion thug/DOM/W3C/Events/EventTarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _addEventListener(self, eventType, listener, capture = False, prio = False):
if getattr(self.tag, '_listeners', None) is None: # pragma: no cover
self.tag._listeners = []

if not (eventType, listener, capture) in self.tag._listeners:
if (eventType, listener, capture) not in self.tag._listeners:
self.__insert_listener(eventType, listener, capture, prio)
return

Expand Down
2 changes: 1 addition & 1 deletion thug/DOM/W3C/HTML/HTMLDocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ def documentMode(self):

for index in range(self.compatible.length):
item = self.compatible.item(index)
if not item.userAgent.lower() in ("ie", ):
if item.userAgent.lower() not in ("ie", ):
continue

_version = item.version.lower()
Expand Down
2 changes: 1 addition & 1 deletion thug/DOM/W3C/HTML/HTMLImageElement.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def setSrc(self, value):
onerror = getattr(self, 'onerror', None)

if log.JSEngine.isJSFunction(onerror):
with self.doc.window.context as ctx: # pylint:disable=unused-variable
with self.doc.window.context:
onerror.__call__()

src = property(getSrc, setSrc)
2 changes: 1 addition & 1 deletion thug/DOM/W3C/HTML/form_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def form_property(default = None):
def getter(self):
if not self.tag.parent.name.lower() in ('form', ):
if self.tag.parent.name.lower() not in ('form', ):
return default

_form = getattr(self, '_form', None)
Expand Down
4 changes: 2 additions & 2 deletions thug/DOM/W3C/URL/URL.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def set_password(self, password):
self.p_url = self.p_url._replace(netloc = _netloc)
return

if not ":" in s_netloc[0]:
if ":" not in s_netloc[0]:
s_netloc[0] = f"{s_netloc[0]}:{password}"
else:
s_netloc[0] = f"{s_netloc[0].split(':')[0]}:{password}"
Expand Down Expand Up @@ -165,7 +165,7 @@ def set_username(self, username):
self.p_url = self.p_url._replace(netloc = _netloc)
return

if not ":" in s_netloc[0]:
if ":" not in s_netloc[0]:
s_netloc[0] = username
else:
s_netloc[0] = f"{username}:{s_netloc[0].split(':')[1]}"
Expand Down
22 changes: 11 additions & 11 deletions thug/Logging/modules/Mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ def add_weak_location(self, url):
Generate a weak location for the given url.
"""

for l in self.data["locations"]:
if l["url"] == url:
for location in self.data["locations"]:
if location["url"] == url:
return

loc = {'mimetype' : '',
Expand Down Expand Up @@ -319,17 +319,17 @@ def activate(self, conto):

tofix = []

for c in self.data["connections"]:
if c["display"] is False and c["destination"] == conto:
c["display"] = True
tofix.append(c["source"])
for connection in self.data["connections"]:
if connection["display"] is False and connection["destination"] == conto:
connection["display"] = True
tofix.append(connection["source"])

for l in self.data["locations"]:
if l["url"] == conto or l["url"] in tofix:
l["display"] = True
for location in self.data["locations"]:
if location["url"] == conto or location["url"] in tofix:
location["display"] = True

for t in tofix:
self.activate(t)
for elem in tofix:
self.activate(elem)

def follow_track(self, end):
"""
Expand Down
4 changes: 2 additions & 2 deletions thug/ThugAPI/ThugVulnModules.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def get_shockwave_flash(self):
return self._shockwave_flash

def set_shockwave_flash(self, version):
if not version.split('.')[0] in ('8', '9', '10', '11', '12', ) or self.invalid_version(version):
if version.split('.')[0] not in ('8', '9', '10', '11', '12', ) or self.invalid_version(version):
log.warning('[WARNING] Invalid Shockwave Flash version provided (using default one)')
return

Expand Down Expand Up @@ -120,7 +120,7 @@ def get_silverlight(self):
return self._silverlight

def set_silverlight(self, version):
if not version.split('.')[0] in ('1', '2', '3', '4', '5', ) or self.invalid_version(version):
if version.split('.')[0] not in ('1', '2', '3', '4', '5', ) or self.invalid_version(version):
log.warning('[WARNING] Invalid Silverlight version provided (using default one)')
return

Expand Down
6 changes: 3 additions & 3 deletions thug/ThugAPI/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .ThugAPI import ThugAPI
from .ThugOpts import ThugOpts
from .ThugVulnModules import ThugVulnModules
from .ThugAPI import ThugAPI # noqa: F401
from .ThugOpts import ThugOpts # noqa: F401
from .ThugVulnModules import ThugVulnModules # noqa: F401

0 comments on commit 3fc9d6a

Please sign in to comment.