Skip to content

Commit

Permalink
Fixed issues that affected Windows machines
Browse files Browse the repository at this point in the history
[Errno 22] Invalid argument: This error occurred in Windows machines on session start up, the datetime format used a symbol that is reserved by the windows system, thus breaking octosuite whenever it attempted to log an activity to a file.

[Error 2] The system cannot find the file specified: This error occurred whenever the clear command was entered, since the command was being passed through subprocess with shell set to False.
  • Loading branch information
rly0nheart committed Sep 14, 2022
1 parent 04ea880 commit c296f09
Show file tree
Hide file tree
Showing 9 changed files with 492 additions and 408 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
- [x] ...And more

## Note
> octosuite automatically logs network and minor user activity of each session. The logs are saved by date and time in the .logs folder
>> If you believe octosuite can be better, feel free to open a pull request with your improvements✌🏾🙂
> Octosuite automatically logs network and user activity of each session, the logs are saved by date and time in the .logs folder

## License
![license](https://user-images.githubusercontent.com/74001397/137917929-2f2cdb0c-4d1d-4e4b-9f0d-e01589e027b5.png)
Expand Down
6 changes: 3 additions & 3 deletions octosuite/banner.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import getpass
from octosuite.colors import red, white, green, reset

'''
"""
banner.py
This file holds the program's banner logo and version tag
'''
version_tag = "2.2.2"
"""
version_tag = "2.2.3"
name_logo = f"""{white}
_______ __ _______ __ __
| |.----.| |_.-----.| __|.--.--.|__| |_.-----.
Expand Down
58 changes: 29 additions & 29 deletions octosuite/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,39 @@
# This file gets called first at start up before any other file gets called
# colors.py is the reason why users get to choose whether to enable/disable colors
system_info = [("Processor",platform.processor),
("Node", platform.node),
("Release", platform.release),
("Architecture", platform.architecture),
("Version", platform.version)]
("Node", platform.node),
("Release", platform.release),
("Architecture", platform.architecture),
("Version", platform.version)]
banner = f"""
OCTOSUITE © 2022 Richard Mwewa
{datetime.now().strftime('%A %d %B %Y, %H:%M:%S%p')}
"""
OCTOSUITE © 2022 Richard Mwewa
{datetime.now().strftime('%A %d %B %Y, %H:%M:%S%p')}
"""

print(banner)
print(f"\t{platform.system()}")
for key, value in system_info:
print(f"\t├─ {key}: {value()}")
print(f"\t├─ {key}: {value()}")
print("\n")
while True:
try:
color_chooser = input(f"[ ? ] Welcome, would you like to enable colors for this session? (Y/n) ").lower()
if color_chooser == "y":
header_title = "bold white"
red = "[red]"
white = "[white]"
green = "[green]"
red_bold = "[white bold]"
white_bold = "[white bold]"
green_bold = "[green bold]"
reset = "[/]"
break
elif color_chooser == "n":
header_title = red = white = green = red_bold = white_bold = green_bold = reset = ""
break
else:
print(f"\n[ ! ] Your response '{color_chooser}' is invalid (expected y or n)")
except KeyboardInterrupt:
exit(f"[ ! ] Process interrupted with [Ctrl+C].")
try:
color_chooser = input(f"[ ? ] Welcome, would you like to enable colors for this session? (Y/n) ").lower()
if color_chooser == "y":
header_title = "bold white"
red = "[red]"
white = "[white]"
green = "[green]"
red_bold = "[white bold]"
white_bold = "[white bold]"
green_bold = "[green bold]"
reset = "[/]"
break
elif color_chooser == "n":
header_title = red = white = green = red_bold = white_bold = green_bold = reset = ""
break
else:
print(f"\n[ ! ] Your response '{color_chooser}' is invalid (expected y or n)")

except KeyboardInterrupt:
exit(f"[ ! ] Process interrupted with [Ctrl+C].")
5 changes: 3 additions & 2 deletions octosuite/csv_loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
from octosuite.log_roller import logRoller
from octosuite.colors import red, white, green, reset

'''
"""
csvLogger
This class holds the methods for creating .csv files of each functionality in main
'''
"""

class csvLogger:
# .csv for organization' profile
def logOrgProfile(response):
Expand Down
139 changes: 76 additions & 63 deletions octosuite/helper.py
Original file line number Diff line number Diff line change
@@ -1,93 +1,106 @@
from rich.table import Table
from rich import print as xprint
from octosuite.colors import white, green, white_bold, green_bold, header_title, reset

"""
Help
This class holds the help text for available commands.
"""


class Help:
usageText = 'Use syntax {} to get started with %s{}%s.' % (green_bold, reset)
usageText1 = '%sUse {} to view all available subcommands.%s' % (white, reset)
usageText2 = "%sThe {} command works with subcommands. %s" % (white, reset)

def Org():
xprint(Help.usageText2.format(f"{green_bold}org{reset}") + Help.usageText1.format(f"{green_bold}help:org{reset}"))


xprint(
Help.usageText2.format(f"{green_bold}org{reset}") + Help.usageText1.format(f"{green_bold}help:org{reset}"))


def Repo():
xprint(Help.usageText2.format(f"{green_bold}repo{reset}") + Help.usageText1.format(f"{green_bold}help:repo{reset}"))


xprint(Help.usageText2.format(f"{green_bold}repo{reset}") + Help.usageText1.format(
f"{green_bold}help:repo{reset}"))


def User():
xprint(Help.usageText2.format(f"{green_bold}user{reset}") + Help.usageText1.format(f"{green_bold}help:user{reset}"))

xprint(Help.usageText2.format(f"{green_bold}user{reset}") + Help.usageText1.format(
f"{green_bold}help:user{reset}"))


def Search():
xprint(Help.usageText2.format(f"{green_bold}search{reset}") + Help.usageText1.format(f"{green_bold}help:search{reset}"))


xprint(Help.usageText2.format(f"{green_bold}search{reset}") + Help.usageText1.format(
f"{green_bold}help:search{reset}"))


def Source():
xprint(Help.usageText2.format(f"{green_bold}source{reset}") + Help.usageText1.format(f"{green_bold}help:source{reset}"))

xprint(Help.usageText2.format(f"{green_bold}source{reset}") + Help.usageText1.format(
f"{green_bold}help:source{reset}"))


def Logs():
xprint(Help.usageText2.format(f"{green_bold}logs{reset}") + Help.usageText1.format(f"{green_bold}help:logs{reset}"))


xprint(Help.usageText2.format(f"{green_bold}logs{reset}") + Help.usageText1.format(
f"{green_bold}help:logs{reset}"))


def Version():
xprint(Help.usageText2.format(f"{green_bold}version{reset}") + Help.usageText1.format(f"{green_bold}help:version{reset}"))


xprint(Help.usageText2.format(f"{green_bold}version{reset}") + Help.usageText1.format(
f"{green_bold}help:version{reset}"))


def Csv():
xprint(Help.usageText2.format(f"{green_bold}csv{reset}") + Help.usageText1.format(f"{green_bold}help:csv{reset}"))


xprint(
Help.usageText2.format(f"{green_bold}csv{reset}") + Help.usageText1.format(f"{green_bold}help:csv{reset}"))


def versionCommand():
version_cmd_table =Table(show_header=True, header_style=header_title)
version_cmd_table = Table(show_header=True, header_style=header_title)
version_cmd_table.add_column("Command", style="dim", width=12)
version_cmd_table.add_column("Description")
version_cmd_table.add_row("check", "Check for new release(s)")
version_cmd_table.add_row("check", "Check for new release(s)")
version_cmd_table.add_row("info", "Version information")

syntax = f"{green}version:<command>{reset}"
xprint(f"{Help.usageText.format(syntax, 'version management')}")
xprint(version_cmd_table)


def sourceCommand():
source_cmd_table =Table(show_header=True, header_style=header_title)
source_cmd_table = Table(show_header=True, header_style=header_title)
source_cmd_table.add_column("Command", style="dim", width=12)
source_cmd_table.add_column("Description")
source_cmd_table.add_row("zipball", "Download source code Zipball")
source_cmd_table.add_row("zipball", "Download source code Zipball")
source_cmd_table.add_row("tarball", "Download source code Tarball")

syntax = f"{green}source:<command>{reset}"
xprint(f"{Help.usageText.format(syntax, 'source code downloads')}")
xprint(source_cmd_table)


def searchCommand():
search_cmd_table =Table(show_header=True, header_style=header_title)
search_cmd_table = Table(show_header=True, header_style=header_title)
search_cmd_table.add_column("Command", style="dim", width=12)
search_cmd_table.add_column("Description")
search_cmd_table.add_row("users", "Search user(s)")
search_cmd_table.add_row("users", "Search user(s)")
search_cmd_table.add_row("repos", "Search repositor[y][ies]")
search_cmd_table.add_row("topics", "Search topic(s)")
search_cmd_table.add_row("issues", "Search issue(s)")
search_cmd_table.add_row("commits", "Search commit(s)")
search_cmd_table.add_row("commits", "Search commit(s)")

syntax = f"{green}search:<command>{reset}"
xprint(f"{Help.usageText.format(syntax, 'target discovery')}")
xprint(search_cmd_table)


def userCommand():
user_cmd_table =Table(show_header=True, header_style=header_title)
user_cmd_table = Table(show_header=True, header_style=header_title)
user_cmd_table.add_column("Command", style="dim", width=12)
user_cmd_table.add_column("Description")
user_cmd_table.add_row("profile", "Get a target's profile info")
user_cmd_table.add_row("profile", "Get a target's profile info")
user_cmd_table.add_row("gists", "Return a users's gists")
user_cmd_table.add_row("org", "Return organizations that a target belongs to/owns")
user_cmd_table.add_row("repos", "Return a target's repositories")
user_cmd_table.add_row("events", "Return a target's events")
user_cmd_table.add_row("events", "Return a target's events")
user_cmd_table.add_row("follows", "Check if user(A) follows user(B)")
user_cmd_table.add_row("followers", "Return a target's followers")
user_cmd_table.add_row("following", "Return a list of users the target is following")
Expand All @@ -96,82 +109,82 @@ def userCommand():
syntax = f"{green}user:<command>{reset}"
xprint(f"{Help.usageText.format(syntax, 'user investigation(s)')}")
xprint(user_cmd_table)


def orgCommand():
org_cmd_table =Table(show_header=True, header_style=header_title)
org_cmd_table = Table(show_header=True, header_style=header_title)
org_cmd_table.add_column("Command", style="dim", width=12)
org_cmd_table.add_column("Description")
org_cmd_table.add_row("profile", "Get a target organization' profile info")
org_cmd_table.add_row("profile", "Get a target organization' profile info")
org_cmd_table.add_row("repos", "Return a target organization' repositories")
org_cmd_table.add_row("events", "Return a target organization' events")
org_cmd_table.add_row("member", "Check if a specified user is a public member of the target organization")

syntax = f"{green}org:<command>{reset}"
xprint(f"{Help.usageText.format(syntax, 'organization investigation(s)')}")
xprint(org_cmd_table)


def repoCommand():
repo_cmd_table =Table(show_header=True, header_style=header_title)
repo_cmd_table = Table(show_header=True, header_style=header_title)
repo_cmd_table.add_column("Command", style="dim", width=12)
repo_cmd_table.add_column("Description")
repo_cmd_table.add_row("profile", "Get a repository's info")
repo_cmd_table.add_row("profile", "Get a repository's info")
repo_cmd_table.add_row("issues", "Return a repository's issues")
repo_cmd_table.add_row("forks", "Return a repository's forks")
repo_cmd_table.add_row("releases", "Return a repository's releases")
repo_cmd_table.add_row("stargazers", "Return a repository's stargazers")
repo_cmd_table.add_row("stargazers", "Return a repository's stargazers")
repo_cmd_table.add_row("path_contents", "List contents in a path of a repository")

syntax = f"{green}repo:<command>{reset}"
xprint(f"{Help.usageText.format(syntax, 'repository investigation(s)')}")
xprint(repo_cmd_table)


def logsCommand():
logs_cmd_table =Table(show_header=True, header_style=header_title)
logs_cmd_table = Table(show_header=True, header_style=header_title)
logs_cmd_table.add_column("Command", style="dim", width=12)
logs_cmd_table.add_column("Description")
logs_cmd_table.add_row("view", "View logs")
logs_cmd_table.add_row("view", "View logs")
logs_cmd_table.add_row("read", "Read log")
logs_cmd_table.add_row("delete", "Delete log")

syntax = f"{green}logs:<command>{reset}"
xprint(f"{Help.usageText.format(syntax, 'log(s) management')}")
xprint(logs_cmd_table)


def csvCommand():
csv_cmd_table =Table(show_header=True, header_style=header_title)
csv_cmd_table = Table(show_header=True, header_style=header_title)
csv_cmd_table.add_column("Command", style="dim", width=12)
csv_cmd_table.add_column("Description")
csv_cmd_table.add_row("view", "View csv files")
csv_cmd_table.add_row("view", "View csv files")
csv_cmd_table.add_row("read", "Read csv")
csv_cmd_table.add_row("delete", "Delete csv")

syntax = f"{green}csv:<command>{reset}"
xprint(f"{Help.usageText.format(syntax, 'csv management')}")
xprint(csv_cmd_table)


def helpCommand():
core_cmd_table =Table(show_header=True, header_style=header_title)
core_cmd_table = Table(show_header=True, header_style=header_title)
core_cmd_table.add_column("Command", style="dim", width=12)
core_cmd_table.add_column("Description")
core_cmd_table.add_row("help", "Help menu")
core_cmd_table.add_row("exit", "Close session")
core_cmd_table.add_row("help", "Help menu")
core_cmd_table.add_row("exit", "Close session")
core_cmd_table.add_row("clear", "Clear screen")
core_cmd_table.add_row("about", "Program's info")
core_cmd_table.add_row("about", "Program's info")
core_cmd_table.add_row("author", "Developer's info")
help_sub_cmd_table =Table(show_header=True, header_style=header_title)

help_sub_cmd_table = Table(show_header=True, header_style=header_title)
help_sub_cmd_table.add_column("Command", style="dim", width=12)
help_sub_cmd_table.add_column("Description")
help_sub_cmd_table.add_row("csv", "List all csv management commands")
help_sub_cmd_table.add_row("logs", "List all logs management commands")
help_sub_cmd_table.add_row("org", "List all organization investigation commands")
help_sub_cmd_table.add_row("user", "List all users investigation commands")
help_sub_cmd_table.add_row("repo", "List all repository investigation commands")
help_sub_cmd_table.add_row("repo", "List all repository investigation commands")
help_sub_cmd_table.add_row("search", "List all target discovery commands")
help_sub_cmd_table.add_row("source", "List all source code download commands (for developers)")
help_sub_cmd_table.add_row("version", "List all version management commands")
Expand Down
7 changes: 4 additions & 3 deletions octosuite/log_roller.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""
logRoller
This class is where the main notification strings/messages are held,
and are being used in two different cases (they're beig used by logging to be written to log files, and being printed out to the screen).
logRoller This class is where the main notification strings/messages are held, and are being used in two different
cases (they're being used by logging to be written to log files, and being printed out to the screen).
"""


class logRoller:
Ctrl = "Session terminated with {}."
Error = "An error occurred: {}"
Expand Down
Loading

0 comments on commit c296f09

Please sign in to comment.