chore: Pre-merge tasks completed

Oops, I missed the import for PlatformError :p
This commit is contained in:
Mitul16 2022-02-16 16:19:35 +05:30
parent 1f6c82026e
commit 0632beb992
No known key found for this signature in database
GPG Key ID: 5C5BBBE501A9BA25
5 changed files with 27 additions and 16 deletions

View File

@ -12,7 +12,8 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
sys.path.insert(0, os.path.abspath("../.."))
# -- Project information -----------------------------------------------------

View File

@ -14,6 +14,7 @@ from rich.progress import (
import pwncat
from pwncat.util import console, copyfileobj, human_readable_size, human_readable_delta
from pwncat.commands import Complete, Parameter, CommandDefinition
from pwncat.platform import PlatformError
class Command(CommandDefinition):
@ -77,5 +78,10 @@ class Command(CommandDefinition):
f"uploaded [cyan]{human_readable_size(length)}[/cyan] "
f"in [green]{human_readable_delta(elapsed)}[/green]"
)
except (FileNotFoundError, PermissionError, IsADirectoryError, PlatformError) as exc:
except (
FileNotFoundError,
PermissionError,
IsADirectoryError,
PlatformError,
) as exc:
self.parser.error(str(exc))

View File

@ -93,7 +93,9 @@ class Module(ImplantModule):
yield Status("verifying user permissions")
current_user = session.current_user()
if user != "__pwncat_current__" and current_user.id != 0:
raise ModuleFailed("only [blue]root[/blue] can install implants for other users")
raise ModuleFailed(
"only [blue]root[/blue] can install implants for other users"
)
if not os.path.isfile(key):
raise ModuleFailed(f"private key [bleu]{key}[/blue] does not exist")

View File

@ -8,9 +8,10 @@ import dataclasses
from io import StringIO
import pytest
from pwncat.channel import ChannelError
from Crypto.PublicKey import RSA
from pwncat.channel import ChannelError
PLATFORM_MAP = {"ubuntu": "linux", "centos": "linux", "windows": "windows"}

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3
import pytest
from pwncat.modules import IncorrectPlatformError