Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
enty8080 authored Mar 9, 2023
1 parent c5e28f5 commit 3feec48
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 36 deletions.
2 changes: 1 addition & 1 deletion ghost/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ghost/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ghost/core/base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 1 addition & 6 deletions ghost/core/base/console.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -39,11 +39,6 @@ class Console(object):
"""

def __init__(self) -> None:
""" Initialize console.
:return None: None
"""

super().__init__()

self.badges = Badges()
Expand Down
7 changes: 4 additions & 3 deletions ghost/core/base/device.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -31,7 +31,8 @@
from ghost.core.cli.badges import Badges
from ghost.core.cli.colors import Colors
from ghost.core.cli.tables import Tables
from ghost.utils.fs import FSTools

from pex.fs import FS


class Device(object):
Expand Down Expand Up @@ -59,7 +60,7 @@ def __init__(self, host: str, port: int = 5555, timeout: int = 10,
self.colors = Colors()
self.loader = Loader()

self.fs = FSTools()
self.fs = FS()
self.host = host
self.port = int(port)

Expand Down
7 changes: 1 addition & 6 deletions ghost/core/base/loader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -34,11 +34,6 @@ class Loader(object):
"""

def __init__(self) -> None:
""" Initialize loader.
:return None: None
"""

super().__init__()

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion ghost/core/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
66 changes: 57 additions & 9 deletions ghost/core/cli/badges.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,29 +24,77 @@


class Badges(object):
def __init__(self):
""" Subclass of ghost.cli module.
This subclass of ghost.cli module is intended for providing
some message printing methods.
"""

def __init__(self) -> None:
super().__init__()

@staticmethod
def print_empty(message="", end='\n'):
def print_empty(message: str = "", end: str = '\n') -> None:
""" Print string with empty start.
:param str message: message to print
:param str end: string to print after the message
:return None: None
"""

print(f"\033[1K\r{message}", end=end)

@staticmethod
def print_process(message, end='\n'):
def print_process(message: str, end: str = '\n') -> None:
""" Print string with [*] start.
:param str message: message to print
:param str end: string to print after the message
:return None: None
"""

print(f"\033[1K\r\033[1;34m[*]\033[0m {message}", end=end)

@staticmethod
def print_success(message, end='\n'):
def print_success(message: str, end: str = '\n') -> None:
""" Print string with [+] start.
:param str message: message to print
:param str end: string to print after the message
:return None: None
"""

print(f"\033[1K\r\033[1;32m[+]\033[0m {message}", end=end)

@staticmethod
def print_error(message, end='\n'):
def print_error(message: str, end: str = '\n') -> None:
""" Print string with [-] start.
:param str message: message to print
:param str end: string to print after the message
:return None: None
"""

print(f"\033[1K\r\033[1;31m[-]\033[0m {message}", end=end)

@staticmethod
def print_warning(message, end='\n'):
def print_warning(message: str, end: str = '\n') -> None:
""" Print string with [!] start.
:param str message: message to print
:param str end: string to print after the message
:return None: None
"""

print(f"\033[1K\r\033[1;33m[!]\033[0m {message}", end=end)

@staticmethod
def print_information(message, end='\n'):
print(f"\033[1K\r\033[1;77m[i]\033[0m {message}", end=end)
def print_information(message: str, end: str = '\n') -> None:
""" Print string with [i] start.
:param str message: message to print
:param str end: string to print after the message
:return None: None
"""

print(f"\033[1K\r\033[1;77m[i]\033[0m {message}", end=end)
10 changes: 8 additions & 2 deletions ghost/core/cli/colors.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,7 +24,13 @@


class Colors(object):
def __init__(self):
""" Subclass of ghost.cli module.
This subclass of ghost.cli module is intended for providing
different color codes.
"""

def __init__(self) -> None:
super().__init__()

self.BLACK = '\033[30m'
Expand Down
20 changes: 17 additions & 3 deletions ghost/core/cli/tables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,12 +26,26 @@


class Tables(object):
def __init__(self):
""" Subclass of ghost.cli module.
This subclass of ghost.cli module is intended for providing
methods for displaying data in tables.
"""

def __init__(self) -> None:
super().__init__()

self.badges = Badges()

def print_table(self, name, headers, *args, **kwargs) -> None:
def print_table(self, name: str, headers: tuple, *args, **kwargs) -> None:
""" Print table with provided data.
:param str name: table title name
:param tuple headers: table column titles
*args, **kwargs: table data for each column
:return None: None
"""

extra_fill = kwargs.get("extra_fill", 4)
header_separator = kwargs.get("header_separator", "-")

Expand Down
2 changes: 1 addition & 1 deletion ghost/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion ghost/lib/module.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
MIT License
Copyright (c) 2020-2022 EntySec
Copyright (c) 2020-2023 EntySec
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down

0 comments on commit 3feec48

Please sign in to comment.