Skip to content

Commit

Permalink
style: Automatic code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Mar 13, 2024
1 parent d46b28e commit bce0696
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion analyzer/linux/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def run(self):
for file in os.listdir(PATHS["logs"]):
upload_to_host(os.path.join(PATHS["logs"], file), os.path.join("logs", file))
except Exception as e:
log.warning('The strace log failed to transfer:', e)
log.warning("The strace log failed to transfer:", e)

# Terminate the Auxiliary modules.
log.info("Stopping auxiliary modules")
Expand Down
5 changes: 3 additions & 2 deletions analyzer/linux/lib/core/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ def get_pids(self):
def strace_analysis(self):
kwargs = {"args": self.args, "timeout": self.timeout, "run_as_root": self.run_as_root}
log.info(self.target)
target_cmd = f'{self.target}'

target_cmd = f"{self.target}"
if "args" in kwargs:
target_cmd += f' {" ".join(kwargs["args"])}'

Expand Down Expand Up @@ -189,6 +189,7 @@ def _upload_file(local, remote):
nf.sock.sendall(chunk) # dirty direct send, no reconnecting
nf.close()


def _string_to_bool(raw):
if not isinstance(raw, str):
raise Exception("Unexpected input: not a string :/")
Expand Down
2 changes: 1 addition & 1 deletion lib/cuckoo/core/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class Guest(Base):
status = Column(String(16), nullable=False)
name = Column(String(255), nullable=False)
label = Column(String(255), nullable=False)
platform = Column(String(255), nullable=False)
platform = Column(String(255), nullable=False)
manager = Column(String(255), nullable=False)
started_on = Column(DateTime(timezone=False), default=datetime.now, nullable=False)
shutdown_on = Column(DateTime(timezone=False), nullable=True)
Expand Down
7 changes: 6 additions & 1 deletion lib/cuckoo/core/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,12 @@ def launch_analysis(self):
try:
self.acquire_machine()
guest_log = self.db.set_task_vm_and_guest_start(
self.task.id, self.machine.name, self.machine.label, self.task.platform , self.machine.id, machinery.__class__.__name__
self.task.id,
self.machine.name,
self.machine.label,
self.task.platform,
self.machine.id,
machinery.__class__.__name__,
)
# At this point we can tell the ResultServer about it.
except CuckooOperationalError as e:
Expand Down
8 changes: 4 additions & 4 deletions modules/processing/strace.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import re
import json
import logging
import os
import re

from lib.cuckoo.common.abstracts import Processing
from lib.cuckoo.common.path_utils import path_exists
Expand Down Expand Up @@ -72,11 +72,11 @@ def __init__(self, log_path, syscalls_info, options):
self.fetch_calls(syscalls_info)

def __iter__(self):
return iter(super().__iter__())
return iter(super().__iter__())

def __repr__(self):
return f"<ParseProcessLog log-path: {self._log_path}>"

def begin_reporting(self):
pass

Expand Down
12 changes: 6 additions & 6 deletions utils/db_migration/versions/add_platform_column_for_guests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
"""

# revision identifiers, used by Alembic.
revision = '3a1c6c03844b'
down_revision = 'a8441ab0fd0f'
revision = "3a1c6c03844b"
down_revision = "a8441ab0fd0f"

from alembic import op
import sqlalchemy as sa
from alembic import op


def upgrade():
# Add the platform column to the guests table with a default value of 'windows'
op.add_column('guests', sa.Column('platform', sa.String(length=50), nullable=True))
# Add the platform column to the guests table with a default value of 'windows'
op.add_column("guests", sa.Column("platform", sa.String(length=50), nullable=True))

# Update existing rows with the default value
op.execute("UPDATE guests SET platform = 'windows' WHERE platform IS NULL")


def downgrade():
# Remove the platform column from the guests table
op.drop_column('guests', 'platform')
op.drop_column("guests", "platform")

0 comments on commit bce0696

Please sign in to comment.