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 fbab762 commit 6bb0094
Show file tree
Hide file tree
Showing 19 changed files with 9 additions and 34 deletions.
2 changes: 1 addition & 1 deletion tests/Analysis/test_Honeyagent.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_analyze(self, mocked_post):
with open(jar_path, "rb") as f:
data = f.read()

json_data = lambda: {
json_data = lambda: { # noqa: E731
"result": {
"files": {"file": "test"},
"yara": {"heuristics": [{"rule": "LocalFileAccess"}]},
Expand Down
2 changes: 0 additions & 2 deletions tests/Classifier/test_Classifiers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import os
import shutil
import hashlib
import logging

from thug.ThugAPI.ThugAPI import ThugAPI
from thug.Logging.ThugLogging import ThugLogging

log = logging.getLogger("Thug")

Expand Down
9 changes: 4 additions & 5 deletions tests/DOM/test_HTTPSession.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging
import pytest

Expand Down Expand Up @@ -27,18 +26,18 @@ def __getitem__(self, key):
class TestHTTPSession(object):
def test_invalid_proxy_1(self):
with pytest.raises(SystemExit):
s = HTTPSession("invalid")
HTTPSession("invalid")

def test_invalid_proxy_2(self):
with pytest.raises(SystemExit):
s = HTTPSession("foo://bar")
HTTPSession("foo://bar")

def test_invalid_proxy_3(self):
with pytest.raises(ValueError):
s = HTTPSession("socks5://127.0.0.1:10000")
HTTPSession("socks5://127.0.0.1:10000")

def test_valid_proxy(self):
s = HTTPSession(proxy="http://antifork.org:443")
HTTPSession(proxy="http://antifork.org:443")

def test_normalize_1(self):
window = WindowDict()
Expand Down
1 change: 0 additions & 1 deletion tests/DOM/test_JSInspector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging

import thug
Expand Down
1 change: 0 additions & 1 deletion tests/DOM/test_Location.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging

import thug
Expand Down
1 change: 0 additions & 1 deletion tests/DOM/test_MimeTypes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging

import thug
Expand Down
1 change: 0 additions & 1 deletion tests/DOM/test_Personality.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging

import thug
Expand Down
1 change: 0 additions & 1 deletion tests/DOM/test_SchemeHandler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging

import thug
Expand Down
1 change: 0 additions & 1 deletion tests/Logging/modules/test_MongoDB.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# coding=utf-8
import os
import logging
import pymongo
from mock import patch
Expand Down
1 change: 0 additions & 1 deletion tests/ThugAPI/test_ThugAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest

from thug.ThugAPI.ThugAPI import ThugAPI
from thug.ThugAPI.OpaqueFilter import OpaqueFilter

log = logging.getLogger("Thug")

Expand Down
1 change: 0 additions & 1 deletion tests/ThugAPI/test_ThugOpts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import pytest
import logging

Expand Down
1 change: 0 additions & 1 deletion tests/ThugAPI/test_Watchdog.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging
import time

Expand Down
1 change: 0 additions & 1 deletion tests/functional/test_brokenurl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging

from thug.ThugAPI.ThugAPI import ThugAPI
Expand Down
1 change: 0 additions & 1 deletion tests/functional/test_image_processing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging

from thug.ThugAPI.ThugAPI import ThugAPI
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_mimehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ def test_svg_xml_handler(self, caplog):
sample = os.path.join(self.misc_path, "testSVGXMLHandler.html")

expected = ["[Window] Alert Text: Hello from SVG Javascript"]
self.do_perform_test(caplog, sample, "local")
self.do_perform_test(caplog, sample, expected, "local")
12 changes: 0 additions & 12 deletions tests/functional/test_misc_chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,18 +464,6 @@ def test_getElementsByTagName(self, caplog):

self.do_perform_test(caplog, sample, expected)

def test_getElementsByTagName(self, caplog):
sample = os.path.join(self.misc_path, "testGetElementsByTagName.html")
expected = [
"[object HTMLHtmlElement]",
"[object HTMLHeadElement]",
"[object HTMLBodyElement]",
"[object HTMLParagraphElement]",
"[object HTMLScriptElement]",
]

self.do_perform_test(caplog, sample, expected)

def test_testDocumentElement(self, caplog):
sample = os.path.join(self.misc_path, "testDocumentElement.html")
expected = ['<a href="http://www.google.com">Google</a>']
Expand Down
2 changes: 2 additions & 0 deletions tests/functional/test_misc_ie90.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ def test_testMicrosoftXMLHTTPEvent8(self, caplog):
"confirm: true",
]

self.do_perform_test(caplog, sample, expected)

def test_testMicrosoftXMLHTTPEvent9(self, caplog):
sample = os.path.join(self.misc_path, "testMicrosoftXMLHTTPEvent9.html")
expected = ["[Window] Alert Text: Request completed"]
Expand Down
1 change: 0 additions & 1 deletion tests/functional/test_screenshot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import logging

from thug.ThugAPI.ThugAPI import ThugAPI
Expand Down
2 changes: 1 addition & 1 deletion tools/distributed/thugctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(self, configfile):
def read_config(self):
"""Read config from config file"""

conf = ConfigParser.ConfigParser()
conf = configparser.ConfigParser()
conf.read(self.configfile)
self.host = conf.get("jobs", "host")
self.queue = conf.get("jobs", "queue")
Expand Down

0 comments on commit 6bb0094

Please sign in to comment.