Skip to content

Commit

Permalink
Remove explicit inheritance from object (kevoreilly#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMythologist authored Apr 29, 2022
1 parent 9b17496 commit c1ea46a
Show file tree
Hide file tree
Showing 48 changed files with 77 additions and 77 deletions.
2 changes: 1 addition & 1 deletion admin/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def file_recon(file: str, yara_category: str = "CAPE"):
TARGET = os.path.join(CAPE_PATH, "analyzer", "windows", "modules", "packages", filename)
elif b"def choose_package(file_type, file_name, exports, target)" in f:
TARGET = os.path.join(CAPE_PATH, "analyzer", "windows", "lib", "core", filename)
elif b"class Signature(object):" in f and b"class Processing(object):" in f:
elif b"class Signature:" in f and b"class Processing:" in f:
TARGET = os.path.join(CAPE_PATH, "lib", "cuckoo", "common", filename)
elif b"class Analyzer:" in f and b"class PipeHandler(Thread):" in f and b"class PipeServer(Thread):" in f:
TARGET = os.path.join(CAPE_PATH, "analyzer", "windows", filename)
Expand Down
8 changes: 4 additions & 4 deletions agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def do_POST(self):
self.httpd.handle(self)


class MiniHTTPServer(object):
class MiniHTTPServer:
def __init__(self):
self.handler = MiniHTTPRequestHandler

Expand Down Expand Up @@ -146,7 +146,7 @@ def shutdown(self):
self.s._BaseServer__shutdown_request = True


class jsonify(object):
class jsonify:
"""Wrapper that represents Flask.jsonify functionality."""

def __init__(self, **kwargs):
Expand All @@ -163,7 +163,7 @@ def headers(self, obj):
pass


class send_file(object):
class send_file:
"""Wrapper that represents Flask.send_file functionality."""

def __init__(self, path):
Expand Down Expand Up @@ -191,7 +191,7 @@ def headers(self, obj):
obj.send_header("Content-Length", self.length)


class request(object):
class request:
form = {}
files = {}
client_ip = None
Expand Down
4 changes: 2 additions & 2 deletions analyzer/linux/lib/common/abstracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from lib.common.exceptions import CuckooPackageError


class Package(object):
class Package:
"""Base abstract analysis package."""

PATHS = []
Expand Down Expand Up @@ -69,7 +69,7 @@ def get_pids(self):
return []


class Auxiliary(object):
class Auxiliary:
priority = 0

def __init__(self, options={}, analyzer=None):
Expand Down
2 changes: 1 addition & 1 deletion analyzer/linux/lib/common/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def upload_to_host(file_path, dump_path, pids=[], metadata="", category=""):
nc.close()


class NetlogConnection(object):
class NetlogConnection:
def __init__(self, proto=""):
config = Config(cfg="analysis.conf")
self.hostip, self.hostport = config.ip, config.port
Expand Down
2 changes: 1 addition & 1 deletion analyzer/linux/lib/core/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def _guess_package_name(file_type, file_name):
return None


class Package(object):
class Package:
"""Base analysis package"""

def __init__(self, target, **kwargs):
Expand Down
6 changes: 3 additions & 3 deletions analyzer/windows/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ def run(self):
return True


class Files(object):
class Files:
PROTECTED_NAMES = [
"vmwareuser.exe",
"vmwareservice.exe",
Expand Down Expand Up @@ -810,7 +810,7 @@ def dump_files(self):
self.delete_file(list(self.files.keys())[0])


class ProcessList(object):
class ProcessList:
def __init__(self):
self.pids = []
self.pids_notrack = []
Expand Down Expand Up @@ -855,7 +855,7 @@ def remove_pid(self, pid):
self.pids_notrack.remove(pid)


class CommandPipeHandler(object):
class CommandPipeHandler:
"""Pipe Handler.
This class handles the notifications received through the Pipe Server and
decides what to do with them.
Expand Down
4 changes: 2 additions & 2 deletions analyzer/windows/lib/common/abstracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
log = logging.getLogger(__name__)


class Package(object):
class Package:
"""Base abstract analysis package."""

PATHS = []
Expand Down Expand Up @@ -179,7 +179,7 @@ def move_curdir(self, filepath):
return newpath


class Auxiliary(object):
class Auxiliary:
def __init__(self, options=None, config=None):
"""@param options: options dict."""
if options is None:
Expand Down
2 changes: 1 addition & 1 deletion analyzer/windows/lib/common/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def upload_to_host(file_path, dump_path, pids="", ppids="", metadata="", categor
nc.close()


class NetlogConnection(object):
class NetlogConnection:
def __init__(self, proto=""):
self.hostip, self.hostport = config.ip, config.port
self.sock = None
Expand Down
2 changes: 1 addition & 1 deletion analyzer/windows/lib/core/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def run(self):
return True


class LogServer(object):
class LogServer:
def __init__(self, result_ip, result_port, logserver_path):
# Create the Named Pipe.
sd = SECURITY_DESCRIPTOR()
Expand Down
2 changes: 1 addition & 1 deletion docs/book/src/customization/packages.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Package object:
from lib.api.process import Process
from lib.common.exceptions import CuckooPackageError
class Package(object):
class Package:
def start(self):
raise NotImplementedError
Expand Down
14 changes: 7 additions & 7 deletions lib/cuckoo/common/abstracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
myresolver.nameserver = ["8.8.8.8"]


class Auxiliary(object):
class Auxiliary:
"""Base abstract class for auxiliary modules."""

def __init__(self):
Expand All @@ -114,7 +114,7 @@ def stop(self):
raise NotImplementedError


class Machinery(object):
class Machinery:
"""Base abstract class for machinery modules."""

# Default label used in machinery configuration file to supply virtual
Expand Down Expand Up @@ -646,7 +646,7 @@ def _extract_creation_time(node):
return snapshot


class Processing(object):
class Processing:
"""Base abstract class for processing module."""

order = 1
Expand Down Expand Up @@ -713,7 +713,7 @@ def run(self):
raise NotImplementedError


class Signature(object):
class Signature:
"""Base class for Cuckoo signatures."""

name = ""
Expand Down Expand Up @@ -1564,7 +1564,7 @@ def as_result(self):
)


class Report(object):
class Report:
"""Base abstract class for reporting module."""

order = 1
Expand Down Expand Up @@ -1621,7 +1621,7 @@ def run(self):
raise NotImplementedError


class Feed(object):
class Feed:
"""Base abstract class for feeds."""

name = ""
Expand Down Expand Up @@ -1692,7 +1692,7 @@ def run(self, modified=False):
return


class ProtocolHandler(object):
class ProtocolHandler:
"""Abstract class for protocol handlers coming out of the analysis."""

def __init__(self, task_id, ctx, version=None):
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/aplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
__author__ = "Sandor Nemes"


class APLib(object):
class APLib:

__slots__ = "source", "destination", "tag", "bitcount", "strict"

Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def open_exclusive(path, mode="xb", bufsize=-1):
raise


class Storage(object):
class Storage:
@staticmethod
def get_filename_from_path(path):
"""Cross-platform filename extraction from path.
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class ICONDIRENTRY(Structure):
]


class PEGroupIconDir(object):
class PEGroupIconDir:
def __init__(self, data):
self.data = data
self.icondir = None
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_dotnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# Note universal_newlines should be False as some binaries fails to convert bytes to text


class DotNETExecutable(object):
class DotNETExecutable:
""".NET analysis"""

def __init__(self, file_path):
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_elf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
ELFFile = False


class ELF(object):
class ELF:
def __init__(self, file_path):
self.file_path = file_path
self.elf = None
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_encoded_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


# TODO: this probably can be replaced by vbe_decoder
class EncodedScriptFile(object):
class EncodedScriptFile:
"""Deobfuscates and interprets Windows Script Files."""

encoding = (
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_hwp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
log = logging.getLogger(__name__)


class HwpDocument(object):
class HwpDocument:
"""Static analysis of HWP documents."""

def __init__(self, filepath: str):
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
log = logging.getLogger(__name__)


class Java(object):
class Java:
"""Java Static Analysis"""

def __init__(self, file_path: str, decomp_jar: str):
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_lnk.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
log = logging.getLogger(__name__)


class LnkShortcut(object):
class LnkShortcut:
signature = [0x4C, 0x00, 0x00, 0x00]
guid = [
0x01,
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_office.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
log = logging.getLogger(__name__)


class Office(object):
class Office:
"""Office Document Static Analysis
Supported formats:
- Word 97-2003 (.doc, .dot), Word 2007+ (.docm, .dotm)
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
log = logging.getLogger(__name__)


class PDF(object):
class PDF:
"""PDF Analysis."""

def __init__(self, file_path: str):
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_pe.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def IsPEImage(buf: bytes, size: int = False) -> bool:
return True


class PortableExecutable(object):
class PortableExecutable:
"""PE analysis."""

def __init__(self, file_path: str):
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
log = logging.getLogger(__name__)


class URL(object):
class URL:
"""URL 'Static' Analysis"""

def __init__(self, url: str):
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/integrations/parse_wsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
HAVE_BS4 = False


class WindowsScriptFile(object):
class WindowsScriptFile:
script_re = "<\\s*script\\s*.*>.*?<\\s*/\\s*script\\s*>"

def __init__(self, filepath):
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/irc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
log = logging.getLogger("Processing.Pcap.irc.protocol")


class ircMessage(object):
class ircMessage:
"""IRC Protocol Request."""

# Client commands
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/netlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def check_names_for_typeinfo(arginfo):
return argnames, converters


class BsonParser(object):
class BsonParser:
"""Interprets .bson logs from the monitor.
The monitor provides us with "info" messages that explain how the function
arguments will come through later on. This class remembers these info
Expand Down
4 changes: 2 additions & 2 deletions lib/cuckoo/common/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def __init__(self, url):
self.url = url


class File(object):
class File:
"""Basic file object class with all useful utilities."""

# The yara rules should not change during one Cuckoo run and as such we're
Expand Down Expand Up @@ -575,7 +575,7 @@ class Static(File):
pass


class ProcDump(object):
class ProcDump:
def __init__(self, dump_file, pretty=False):
self._dumpfile = open(dump_file, "rb")
self.dumpfile = mmap.mmap(self._dumpfile.fileno(), 0, access=mmap.ACCESS_READ)
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/pdftools/pdf-parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,7 @@ def RunLengthDecode(data):
# and to permit persons to whom the Software is furnished to do so, subject to the following conditions:


class LZWDecoder(object):
class LZWDecoder:
def __init__(self, fp):
self.fp = fp
self.buff = 0
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ def inner(self, *args, **kwargs):
return inner


class SuperLock(object):
class SuperLock:
def __init__(self):
self.tlock = threading.Lock()
self.mlock = multiprocessing.Lock()
Expand Down
Loading

0 comments on commit c1ea46a

Please sign in to comment.