Compare commits

..

28 Commits
2.1.0 ... 2.2.0

Author SHA1 Message Date
Richard Mwewa
456d46fdb1 Create README.md 2022-07-02 22:10:33 +02:00
Richard Mwewa
539c540a72 Update README.md 2022-07-02 22:09:46 +02:00
Richard Mwewa
db413767cd Update setup.py 2022-07-02 22:05:53 +02:00
Richard Mwewa
6a87cb51de Update sign_vars.py 2022-07-02 22:02:58 +02:00
Richard Mwewa
f98bfb34f3 Update log_roller.py 2022-07-02 21:57:53 +02:00
Richard Mwewa
43637193de Update helper.py 2022-07-02 21:56:16 +02:00
Richard Mwewa
33d9c7f5f2 Update csv_loggers.py 2022-07-02 21:53:25 +02:00
Richard Mwewa
835a78284b Update colors.py 2022-07-02 21:48:30 +02:00
Richard Mwewa
4dc2dced32 Update banner.py 2022-07-02 21:45:54 +02:00
Richard Mwewa
4b18c0307e Update main.py 2022-07-02 21:42:24 +02:00
Richard Mwewa
0ec3100347 Update README.md 2022-06-28 13:51:59 +02:00
Richard Mwewa
bb287acfe2 Update README.md 2022-06-28 13:51:01 +02:00
Richard Mwewa
7a6015b8e4 Update README.md 2022-06-28 13:40:51 +02:00
Richard Mwewa
d0f5c660b5 Update README.md 2022-06-28 01:03:06 +02:00
Richard Mwewa
2e65cfcb79 Update README.md 2022-06-28 01:00:15 +02:00
Richard Mwewa
41f392f5a0 Update README.md 2022-06-28 00:53:36 +02:00
Richard Mwewa
18bcc06070 Create codeql.yml 2022-06-28 00:34:21 +02:00
Richard Mwewa
c9cf000b23 Create .gitignore 2022-06-26 21:46:54 +02:00
Richard Mwewa
11e55f7804 Update README.md 2022-06-26 10:18:39 +02:00
Richard Mwewa
96c62c7097 Update banner.py 2022-06-26 10:08:44 +02:00
Richard Mwewa
587641cd18 Update setup.py 2022-06-26 10:07:55 +02:00
Richard Mwewa
d1ad3d14b9 Update banner.py 2022-06-26 10:06:55 +02:00
Richard Mwewa
0e3568f967 Update log_roller.py 2022-06-26 10:05:59 +02:00
Richard Mwewa
51d27c4996 [fix] error in source commands 2022-06-26 10:04:32 +02:00
Richard Mwewa
ae9d9f4af5 Update README.md 2022-06-25 09:47:51 +02:00
Richard Mwewa
482f2ee55a Update README.md 2022-06-24 15:05:38 +02:00
Richard Mwewa
9894b15209 Update README.md 2022-06-24 15:04:48 +02:00
Richard Mwewa
4d563683d2 Update README.md 2022-06-24 14:57:00 +02:00
11 changed files with 758 additions and 753 deletions

72
.github/workflows/codeql.yml vendored Normal file
View File

@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "master" ]
schedule:
- cron: '18 7 * * 3'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
__pycache__/

View File

@@ -1,16 +1,18 @@
![octosuite](images/logo.png) ![logo](https://user-images.githubusercontent.com/74001397/175805580-fffc96d4-e0ef-48bb-a55c-80b2da3e714d.png)
![GitHub](https://img.shields.io/github/license/rly0nheart/octosuite?style=social&logo=github) [![Upload Python Package](https://github.com/rly0nheart/octosuite/actions/workflows/python-publish.yml/badge.svg)](https://github.com/rly0nheart/octosuite/actions/workflows/python-publish.yml)
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/rly0nheart/octosuite?style=social&logo=github) [![CodeQL](https://github.com/rly0nheart/octosuite/actions/workflows/codeql.yml/badge.svg)](https://github.com/rly0nheart/octosuite/actions/workflows/codeql.yml)
![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/rly0nheart/octosuite/2.0.1-alpha?style=social&logo=github) ![GitHub](https://img.shields.io/github/license/rly0nheart/octosuite?style=flat)
![GitHub repo size](https://img.shields.io/github/repo-size/rly0nheart/octosuite?style=social&logo=github) ![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/rly0nheart/octosuite?style=flat&logo=github)
![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/rly0nheart/octosuite/2.2.0?style=flat&logo=github)
![GitHub repo size](https://img.shields.io/github/repo-size/rly0nheart/octosuite?style=flat&logo=github)
> *Simply gather OSINT on Github users & organizations like a God🔥* > *Simply gather OSINT on Github users & organizations like a God🔥*
# Installation ## Wiki
[Refer to the Wiki](https://github.com/rly0nheart/octosuite/wiki) for installation instructions, in addition to all other documentation. [Refer to the Wiki](https://github.com/rly0nheart/octosuite/wiki) for installation instructions, in addition to all other documentation.
# Features ## Features
- [x] Fetches an organization's profile information - [x] Fetches an organization's profile information
- [x] Fetches an oganization's events - [x] Fetches an oganization's events
- [x] Returns an organization's repositories - [x] Returns an organization's repositories
@@ -40,26 +42,19 @@
- [x] Searches commits - [x] Searches commits
- [x] Automatically logs network activity (.logs folder) - [x] Automatically logs network activity (.logs folder)
- [x] User can view, read and delete logs - [x] User can view, read and delete logs
- [x] More available... - [x] ...And more
> *octosuite automatically logs network and minor user activity of each session. The logs are saved by date and time in the .logs folder* ## Note
>> *Although octosuite was developed to work on **Mac**, **Windows**, or any **Linux** *Distribution*, it has only been tested on **Termux** *and* **Kali Linux*** > 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* ✌🏾🙂 >> Although octosuite was developed to work on Mac, Windows, or any Linux Distribution, it has only been tested on Termux and Kali Linux
>>> If you believe octosuite can be better, feel free to open a pull request with your improvements✌🏾🙂
# License ## License
![license](https://user-images.githubusercontent.com/74001397/137917929-2f2cdb0c-4d1d-4e4b-9f0d-e01589e027b5.png) ![license](https://user-images.githubusercontent.com/74001397/137917929-2f2cdb0c-4d1d-4e4b-9f0d-e01589e027b5.png)
## Donations
# About developer Love octosuite and would like to donate? You can buy me a coffee using the button below.
[About.me](https://about.me/rly0nheart)
# Supporters
[![Stargazers repo roster for @rly0nheart/octosuite](https://reporoster.com/stars/rly0nheart/octosuite)](https://github.com/rly0nheart/octosuite/stargazers)
[![Forkers repo roster for @rly0nheart/octosuite](https://reporoster.com/forks/rly0nheart/octosuite)](https://github.com/rly0nheart/octosuite/members)
# Donations
Love octosuite? Please consider buying me a coffee, I will really appreciate it. ☕👌🏾😊
<a href="https://www.buymeacoffee.com/189381184" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a> <a href="https://www.buymeacoffee.com/189381184" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
Your support is much appreciated!☕👌🏾😊

View File

@@ -1,23 +1,22 @@
import getpass import getpass
from octosuite.colors import Color from octosuite.colors import red, white, green, reset
''' '''
Banner banner.py
This class holds the program's banner logo and version tag This file holds the program's banner logo and version tag
''' '''
class Banner: version_tag = "2.2.0"
versionTag = '2.1.0' name_logo = f"""{white}
nameLogo = f'''{Color.white}
_______ __ _______ __ __ _______ __ _______ __ __
| |.----.| |_.-----.| __|.--.--.|__| |_.-----. | |.----.| |_.-----.| __|.--.--.|__| |_.-----.
| - || __|| _| _ ||__ || | || | _| -__| | - || __|| _| _ ||__ || | || | _| -__|
|_______||____||____|_____||_______||_____||__|____|_____| |_______||____||____|_____||_______||_____||__|____|_____|
v{versionTag} v{version_tag}
{Color.white}— Advanced Github {Color.red}OSINT{Color.white} Framework{Color.reset} {white}— Advanced Github {red}OSINT{white} Framework
.:{getpass.getuser()}:. .:{getpass.getuser()}:.
{Color.white}├─ use {Color.green}help{Color.reset}{Color.white} command for usage{Color.reset} ├─ use {green}help{reset}{white} command for usage
{Color.white}└╼ commands are case insensitive{Color.reset} └╼ commands are case insensitive{reset}
''' """

View File

@@ -1,55 +1,43 @@
import sys
import platform import platform
from datetime import datetime from datetime import datetime
# The Color class is responsible for enabling/disabling colors in OctoSuite # This file is responsible for enabling/disabling colors in OctoSuite
# This class gets called first at start up before any other class/method gets called (makes one think why this is not the firstBlood class) # This file gets called first at start up before any other file gets called
# Color class is the reason why users get to choose whether to enable/disable colors # colors.py is the reason why users get to choose whether to enable/disable colors
# Unfortunately for our friends the 'non-Linux' users, they will not yet have the opportunity to see what OctoSuite looks like with colors enabled lol system_info = [("Processor",platform.processor),
class Color: ("Node", platform.node),
colors = True ("Release", platform.release),
# Colors will be unavailable on non-linux machines ("Architecture", platform.architecture),
if sys.platform.lower().startswith(("os", "win", "darwin","ios")): ("Version", platform.version)]
colors = False banner = f"""
OCTOSUITE © 2022 Richard Mwewa
if not colors: {datetime.now().strftime('%A %d %B %Y, %H:%M:%S%p')}
reset = red = white = green = red_bg = ""
"""
else:
# Printing system information was completely unnecessary (just like most things in this program :D) print(banner)
# But at least users will get to know things they did not know about their machines ;) print(f"\t{platform.system()}")
date_time = datetime.now() for key, value in system_info:
sys_info = [("Processor",platform.processor), print(f"\t├─ {key}: {value()}")
("Node", platform.node), print("\n")
("Release", platform.release), while True:
("Architecture", platform.architecture), try:
("Version", platform.version)] color_chooser = input(f"[ ? ] Welcome, would you like to enable colors for this session? (Y/n) ").lower()
if color_chooser == "y":
banner = f""" header_title = "bold white"
OCTOSUITE © 2022 Richard Mwewa red = "[red]"
{date_time.strftime('%A %d %B %Y, %H:%M:%S%p')} white = "[white]"
green = "[green]"
red_bold = "[white bold]"
white_bold = "[white bold]"
{platform.system()}""" green_bold = "[green bold]"
print(banner) reset = "[/]"
for key, value in sys_info: break
print(f"\t├─ {key}: {value()}") elif color_chooser == "n":
print("\n") header_title = red = white = green = red_bold = white_bold = green_bold = reset = ""
while True: break
try: else:
color_chooser = input(f"[ ? ] Welcome, would you like to enable colors for this session? (Y/n) ") print(f"\n[ ! ] Your response '{color_chooser}' is invalid (expected y or n)")
if color_chooser.lower() == "y":
white = "\033[97m"
red = "\033[91m"
reset = "\033[0m"
green = "\033[92m"
break
elif color_chooser.lower() == "n":
red = white = green = red_bg = reset = ""
break
else:
print(f"\n[ ! ] Your response ({color_chooser}) is invalid (expected y or n) ")
except KeyboardInterrupt: except KeyboardInterrupt:
exit(f"[ ! ] Process interrupted with [Ctrl+C].") exit(f"[ ! ] Process interrupted with [Ctrl+C].")

View File

@@ -1,8 +1,9 @@
import csv import csv
import sys
import logging import logging
from rich import print as xprint
from octosuite.sign_vars import SignVar from octosuite.sign_vars import SignVar
from octosuite.log_roller import logRoller from octosuite.log_roller import logRoller
from octosuite.colors import red, white, green, reset
''' '''
csvLogger csvLogger
@@ -13,7 +14,7 @@ class csvLogger:
def logOrgProfile(response): def logOrgProfile(response):
org_profile_fields = ['Profile photo', 'Name', 'Username', 'ID', 'Node ID', 'Email', 'About', 'Location', 'Blog', 'Followers', 'Following', 'Twitter handle', 'Gists', 'Repositories', 'Account type', 'Is verified?', 'Has organization projects?', 'Has repository projects?', 'Created at', 'Updated at'] org_profile_fields = ['Profile photo', 'Name', 'Username', 'ID', 'Node ID', 'Email', 'About', 'Location', 'Blog', 'Followers', 'Following', 'Twitter handle', 'Gists', 'Repositories', 'Account type', 'Is verified?', 'Has organization projects?', 'Has repository projects?', 'Created at', 'Updated at']
org_profile_row = [response.json()['avatar_url'], response.json()['name'], response.json()['login'], response.json()['id'], response.json()['node_id'], response.json()['email'], response.json()['description'], response.json()['location'], response.json()['blog'], response.json()['followers'], response.json()['following'], response.json()['twitter_username'], response.json()['public_gists'], response.json()['public_repos'], response.json()['type'], response.json()['is_verified'], response.json()['has_organization_projects'], response.json()['has_repository_projects'], response.json()['created_at'], response.json()['updated_at']] org_profile_row = [response.json()['avatar_url'], response.json()['name'], response.json()['login'], response.json()['id'], response.json()['node_id'], response.json()['email'], response.json()['description'], response.json()['location'], response.json()['blog'], response.json()['followers'], response.json()['following'], response.json()['twitter_username'], response.json()['public_gists'], response.json()['public_repos'], response.json()['type'], response.json()['is_verified'], response.json()['has_organization_projects'], response.json()['has_repository_projects'], response.json()['created_at'], response.json()['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{response.json()['name']}.csv", 'w') as file: with open(f"output/{response.json()['name']}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -21,18 +22,18 @@ class csvLogger:
writecsv.writerow(org_profile_row) writecsv.writerow(org_profile_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# Creating a .csv file of a user' profile # Creating a .csv file of a user' profile
def logUserProfile(response): def logUserProfile(response):
user_profile_fields = ['Profile photo', 'Name', 'Username', 'ID', 'Node ID', 'Bio', 'Blog', 'Location', 'Followers', 'Following', 'Twitter handle', 'Gists', 'Repositories', 'Organization', 'Is hireable?', 'Is site admin?', 'Joined at', 'Updated at'] user_profile_fields = ['Profile photo', 'Name', 'Username', 'ID', 'Node ID', 'Bio', 'Blog', 'Location', 'Followers', 'Following', 'Twitter handle', 'Gists', 'Repositories', 'Organization', 'Is hireable?', 'Is site admin?', 'Joined at', 'Updated at']
user_profile_row = [response.json()['avatar_url'], response.json()['name'], response.json()['login'], response.json()['id'], response.json()['node_id'], response.json()['bio'], response.json()['blog'], response.json()['location'], response.json()['followers'], response.json()['following'], response.json()['twitter_username'], response.json()['public_gists'], response.json()['public_repos'], response.json()['company'], response.json()['hireable'], response.json()['site_admin'], response.json()['created_at'], response.json()['updated_at']] user_profile_row = [response.json()['avatar_url'], response.json()['name'], response.json()['login'], response.json()['id'], response.json()['node_id'], response.json()['bio'], response.json()['blog'], response.json()['location'], response.json()['followers'], response.json()['following'], response.json()['twitter_username'], response.json()['public_gists'], response.json()['public_repos'], response.json()['company'], response.json()['hireable'], response.json()['site_admin'], response.json()['created_at'], response.json()['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{response.json()['login']}.csv", 'w',) as file: with open(f"output/{response.json()['login']}.csv", 'w',) as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -40,18 +41,18 @@ class csvLogger:
writecsv.writerow(user_profile_row) writecsv.writerow(user_profile_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# create .csv for repository profile # create .csv for repository profile
def logRepoProfile(response): def logRepoProfile(response):
repo_profile_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at'] repo_profile_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at']
repo_profile_row = [response.json()['name'], response.json()['id'], response.json()['description'], response.json()['forks'], response.json()['stargazers_count'], response.json()['watchers'], response.json()['license'], response.json()['default_branch'], response.json()['visibility'], response.json()['language'], response.json()['open_issues'], response.json()['topics'], response.json()['homepage'], response.json()['clone_url'], response.json()['ssh_url'], response.json()['fork'], response.json()['allow_forking'], response.json()['private'], response.json()['archived'], response.json()['is_template'], response.json()['has_wiki'], response.json()['has_pages'], response.json()['has_projects'], response.json()['has_issues'], response.json()['has_downloads'], response.json()['pushed_at'], response.json()['created_at'], response.json()['updated_at']] repo_profile_row = [response.json()['name'], response.json()['id'], response.json()['description'], response.json()['forks'], response.json()['stargazers_count'], response.json()['watchers'], response.json()['license'], response.json()['default_branch'], response.json()['visibility'], response.json()['language'], response.json()['open_issues'], response.json()['topics'], response.json()['homepage'], response.json()['clone_url'], response.json()['ssh_url'], response.json()['fork'], response.json()['allow_forking'], response.json()['private'], response.json()['archived'], response.json()['is_template'], response.json()['has_wiki'], response.json()['has_pages'], response.json()['has_projects'], response.json()['has_issues'], response.json()['has_downloads'], response.json()['pushed_at'], response.json()['created_at'], response.json()['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{response.json()['name']}.csv", 'w') as file: with open(f"output/{response.json()['name']}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -59,18 +60,18 @@ class csvLogger:
writecsv.writerow(repo_profile_row) writecsv.writerow(repo_profile_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# create .csv for repository path contents # create .csv for repository path contents
def logRepoPathContents(content, repo_name): def logRepoPathContents(content, repo_name):
path_content_fields = ['Filename', 'Size (bytes)', 'Type', 'Path', 'SHA', 'URL'] path_content_fields = ['Filename', 'Size (bytes)', 'Type', 'Path', 'SHA', 'URL']
path_content_row = [content['name'], content['size'], content['type'], content['path'], content['sha'], content['html_url']] path_content_row = [content['name'], content['size'], content['type'], content['path'], content['sha'], content['html_url']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{content['name']}_content_from_{repo_name}.csv", 'w') as file: with open(f"output/{content['name']}_content_from_{repo_name}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -78,18 +79,18 @@ class csvLogger:
writecsv.writerow(path_content_row) writecsv.writerow(path_content_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# create .csv for repository stargazer # create .csv for repository stargazer
def logRepoStargazers(stargazer, repo_name): def logRepoStargazers(stargazer, repo_name):
user_follower_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL'] user_follower_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL']
user_follower_row = [stargazer['avatar_url'], stargazer['login'], stargazer['id'], stargazer['node_id'], stargazer['gravatar_id'], stargazer['type'], stargazer['site_admin'], stargazer['html_url']] user_follower_row = [stargazer['avatar_url'], stargazer['login'], stargazer['id'], stargazer['node_id'], stargazer['gravatar_id'], stargazer['type'], stargazer['site_admin'], stargazer['html_url']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{stargazer['login']}_stargazer_of_{repo_name}.csv", 'w') as file: with open(f"output/{stargazer['login']}_stargazer_of_{repo_name}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -97,18 +98,18 @@ class csvLogger:
writecsv.writerow(user_follower_row) writecsv.writerow(user_follower_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# create .csv for repository forks # create .csv for repository forks
def logRepoForks(fork, count): def logRepoForks(fork, count):
repo_fork_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at'] repo_fork_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at']
repo_fork_row = [fork['full_name'], fork['id'], fork['description'], fork['forks'], fork['stargazers_count'], fork['watchers'], fork['license'], fork['default_branch'], fork['visibility'], fork['language'], fork['open_issues'], fork['topics'], fork['homepage'], fork['clone_url'], fork['ssh_url'], fork['fork'], fork['allow_forking'], fork['private'], fork['archived'], fork['is_template'], fork['has_wiki'], fork['has_pages'], fork['has_projects'], fork['has_issues'], fork['has_downloads'], fork['pushed_at'], fork['created_at'], fork['updated_at']] repo_fork_row = [fork['full_name'], fork['id'], fork['description'], fork['forks'], fork['stargazers_count'], fork['watchers'], fork['license'], fork['default_branch'], fork['visibility'], fork['language'], fork['open_issues'], fork['topics'], fork['homepage'], fork['clone_url'], fork['ssh_url'], fork['fork'], fork['allow_forking'], fork['private'], fork['archived'], fork['is_template'], fork['has_wiki'], fork['has_pages'], fork['has_projects'], fork['has_issues'], fork['has_downloads'], fork['pushed_at'], fork['created_at'], fork['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{fork['name']}_fork_{count}.csv", 'w') as file: with open(f"output/{fork['name']}_fork_{count}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -116,18 +117,18 @@ class csvLogger:
writecsv.writerow(repo_fork_row) writecsv.writerow(repo_fork_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# create .csv for repository issues # create .csv for repository issues
def logRepoIssues(issue, repo_name): def logRepoIssues(issue, repo_name):
repo_issue_fields = ['Title', 'ID', 'Node ID', 'Number', 'State', 'Reactions', 'Comments', 'Milestone', 'Assignee', 'Assignees', 'Author association', 'Labels', 'Is locked?', 'Lock reason', 'Closed at', 'Created at', 'Updated at'] repo_issue_fields = ['Title', 'ID', 'Node ID', 'Number', 'State', 'Reactions', 'Comments', 'Milestone', 'Assignee', 'Assignees', 'Author association', 'Labels', 'Is locked?', 'Lock reason', 'Closed at', 'Created at', 'Updated at']
repo_issue_row = [issue['title'], issue['id'], issue['node_id'], issue['number'], issue['state'], issue['reactions'], issue['comments'], issue['milestone'], issue['assignee'], issue['assignees'], issue['author_association'], issue['labels'], issue['locked'], issue['active_lock_reason'], issue['closed_at'], issue['created_at'], issue['updated_at']] repo_issue_row = [issue['title'], issue['id'], issue['node_id'], issue['number'], issue['state'], issue['reactions'], issue['comments'], issue['milestone'], issue['assignee'], issue['assignees'], issue['author_association'], issue['labels'], issue['locked'], issue['active_lock_reason'], issue['closed_at'], issue['created_at'], issue['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{repo_name}_issue_{issue['id']}.csv", 'w') as file: with open(f"output/{repo_name}_issue_{issue['id']}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -135,18 +136,18 @@ class csvLogger:
writecsv.writerow(repo_issue_row) writecsv.writerow(repo_issue_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# create .csv for repository releases # create .csv for repository releases
def logRepoReleases(release, repo_name): def logRepoReleases(release, repo_name):
repo_release_fields = ['Name', 'ID', 'Node ID', 'Tag', 'Branch', 'Assets', 'Is draft?', 'Is prerelease?', 'Created at', 'Published at'] repo_release_fields = ['Name', 'ID', 'Node ID', 'Tag', 'Branch', 'Assets', 'Is draft?', 'Is prerelease?', 'Created at', 'Published at']
repo_release_row = [release['name'], release['id'], release['node_id'], release['tag_name'], release['target_commitish'], release['assets'], release['draft'], release['prerelease'], release['created_at'], release['published_at']] repo_release_row = [release['name'], release['id'], release['node_id'], release['tag_name'], release['target_commitish'], release['assets'], release['draft'], release['prerelease'], release['created_at'], release['published_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{repo_name}_release_{release['name']}.csv", 'w') as file: with open(f"output/{repo_name}_release_{release['name']}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -154,18 +155,18 @@ class csvLogger:
writecsv.writerow(repo_release_row) writecsv.writerow(repo_release_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# Create .csv file for repository contributors # Create .csv file for repository contributors
def logRepoContributors(contributor, repo_name): def logRepoContributors(contributor, repo_name):
repo_contributor_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL'] repo_contributor_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL']
repo_contributor_row = [contributor['avatar_url'], contributor['login'], contributor['id'], contributor['node_id'], contributor['gravatar_id'], contributor['type'], contributor['site_admin'], contributor['html_url']] repo_contributor_row = [contributor['avatar_url'], contributor['login'], contributor['id'], contributor['node_id'], contributor['gravatar_id'], contributor['type'], contributor['site_admin'], contributor['html_url']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{contributor['login']}_contributor_of_{repo_name}.csv", 'w') as file: with open(f"output/{contributor['login']}_contributor_of_{repo_name}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -173,10 +174,10 @@ class csvLogger:
writecsv.writerow(repo_contributor_row) writecsv.writerow(repo_contributor_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
print(f"{SignVar.info} {logRoller.loggingSkipped}\n") print(f"{SignVar.info} {logRoller.loggingSkipped}\n")
@@ -184,7 +185,7 @@ class csvLogger:
def logOrgEvents(event, organization): def logOrgEvents(event, organization):
org_event_fields = ['ID', 'Type', 'Created at', 'Payload'] org_event_fields = ['ID', 'Type', 'Created at', 'Payload']
org_event_row = [event['id'], event['type'], event['created_at'], event['payload']] org_event_row = [event['id'], event['type'], event['created_at'], event['payload']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{organization}_event_{event['id']}.csv", 'w') as file: with open(f"output/{organization}_event_{event['id']}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -192,18 +193,18 @@ class csvLogger:
writecsv.writerow(org_event_row) writecsv.writerow(org_event_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# Create .csv for organization' repositories # Create .csv for organization' repositories
def logOrgRepos(repository, organization): def logOrgRepos(repository, organization):
org_repo_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at'] org_repo_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at']
org_repo_row = [repository['full_name'], repository['id'], repository['description'], repository['forks'], repository['stargazers_count'], repository['watchers'], repository['license'], repository['default_branch'], repository['visibility'], repository['language'], repository['open_issues'], repository['topics'], repository['homepage'], repository['clone_url'], repository['ssh_url'], repository['fork'], repository['allow_forking'], repository['private'], repository['archived'], repository['is_template'], repository['has_wiki'], repository['has_pages'], repository['has_projects'], repository['has_issues'], repository['has_downloads'], repository['pushed_at'], repository['created_at'], repository['updated_at']] org_repo_row = [repository['full_name'], repository['id'], repository['description'], repository['forks'], repository['stargazers_count'], repository['watchers'], repository['license'], repository['default_branch'], repository['visibility'], repository['language'], repository['open_issues'], repository['topics'], repository['homepage'], repository['clone_url'], repository['ssh_url'], repository['fork'], repository['allow_forking'], repository['private'], repository['archived'], repository['is_template'], repository['has_wiki'], repository['has_pages'], repository['has_projects'], repository['has_issues'], repository['has_downloads'], repository['pushed_at'], repository['created_at'], repository['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{repository['name']}_repository_of_{organization}.csv", 'w') as file: with open(f"output/{repository['name']}_repository_of_{organization}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -211,18 +212,18 @@ class csvLogger:
writecsv.writerow(org_repo_row) writecsv.writerow(org_repo_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# .csv for user' repositories # .csv for user' repositories
def logUserRepos(repository, username): def logUserRepos(repository, username):
user_repo_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at'] user_repo_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at']
user_repo_row = [repository['full_name'], repository['id'], repository['description'], repository['forks'], repository['stargazers_count'], repository['watchers'], repository['license'], repository['default_branch'], repository['visibility'], repository['language'], repository['open_issues'], repository['topics'], repository['homepage'], repository['clone_url'], repository['ssh_url'], repository['fork'], repository['allow_forking'], repository['private'], repository['archived'], repository['is_template'], repository['has_wiki'], repository['has_pages'], repository['has_projects'], repository['has_issues'], repository['has_downloads'], repository['pushed_at'], repository['created_at'], repository['updated_at']] user_repo_row = [repository['full_name'], repository['id'], repository['description'], repository['forks'], repository['stargazers_count'], repository['watchers'], repository['license'], repository['default_branch'], repository['visibility'], repository['language'], repository['open_issues'], repository['topics'], repository['homepage'], repository['clone_url'], repository['ssh_url'], repository['fork'], repository['allow_forking'], repository['private'], repository['archived'], repository['is_template'], repository['has_wiki'], repository['has_pages'], repository['has_projects'], repository['has_issues'], repository['has_downloads'], repository['pushed_at'], repository['created_at'], repository['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{repository['name']}_{username}.csv", 'w') as file: with open(f"output/{repository['name']}_{username}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -230,18 +231,18 @@ class csvLogger:
writecsv.writerow(user_repo_row) writecsv.writerow(user_repo_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# .csv for user events # .csv for user events
def logUserEvents(event): def logUserEvents(event):
user_event_fields = ['Actor', 'Type', 'Repository', 'Created at', 'Payload'] user_event_fields = ['Actor', 'Type', 'Repository', 'Created at', 'Payload']
user_event_row = [event['actor']['login'], event['type'], event['repo']['name'], event['created_at'], event['payload']] user_event_row = [event['actor']['login'], event['type'], event['repo']['name'], event['created_at'], event['payload']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{event['actor']['login']}_event_{event['id']}.csv", 'w') as file: with open(f"output/{event['actor']['login']}_event_{event['id']}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -249,18 +250,18 @@ class csvLogger:
writecsv.writerow(user_event_row) writecsv.writerow(user_event_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# .csv for user gists # .csv for user gists
def logUserGists(gist): def logUserGists(gist):
user_gist_fields = ['ID', 'Node ID', 'About', 'Comments', 'Files', 'Git Push URL', 'Is public?', 'Is truncated?', 'Updated at'] user_gist_fields = ['ID', 'Node ID', 'About', 'Comments', 'Files', 'Git Push URL', 'Is public?', 'Is truncated?', 'Updated at']
user_gist_row = [gist['id'], gist['node_id'], gist['description'], gist['comments'], gist['files'], gist['git_push_url'], gist['public'], gist['truncated'], gist['updated_at']] user_gist_row = [gist['id'], gist['node_id'], gist['description'], gist['comments'], gist['files'], gist['git_push_url'], gist['public'], gist['truncated'], gist['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{gist['id']}_gists_{gist['owner']['login']}.csv", 'w') as file: with open(f"output/{gist['id']}_gists_{gist['owner']['login']}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -268,18 +269,18 @@ class csvLogger:
writecsv.writerow(user_gist_row) writecsv.writerow(user_gist_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# .csv for user followers # .csv for user followers
def logUserFollowers(follower, username): def logUserFollowers(follower, username):
user_follower_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL'] user_follower_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL']
user_follower_row = [follower['avatar_url'], follower['login'], follower['id'], follower['node_id'], follower['gravatar_id'], follower['type'], follower['site_admin'], follower['html_url']] user_follower_row = [follower['avatar_url'], follower['login'], follower['id'], follower['node_id'], follower['gravatar_id'], follower['type'], follower['site_admin'], follower['html_url']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{follower['login']}_follower_of_{username}.csv", 'w') as file: with open(f"output/{follower['login']}_follower_of_{username}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -287,18 +288,18 @@ class csvLogger:
writecsv.writerow(user_follower_row) writecsv.writerow(user_follower_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# .csv for user following # .csv for user following
def logUserFollowing(user, username): def logUserFollowing(user, username):
user_following_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL'] user_following_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL']
user_following_row = [user['avatar_url'], user['login'], user['id'], user['node_id'], user['gravatar_id'], user['type'], user['site_admin'], user['html_url']] user_following_row = [user['avatar_url'], user['login'], user['id'], user['node_id'], user['gravatar_id'], user['type'], user['site_admin'], user['html_url']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{user['login']}_followed_by_{username}.csv", 'w') as file: with open(f"output/{user['login']}_followed_by_{username}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -306,18 +307,18 @@ class csvLogger:
writecsv.writerow(user_following_row) writecsv.writerow(user_following_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# .csv for user' subscriptions # .csv for user' subscriptions
def logUserSubscriptions(repository, username): def logUserSubscriptions(repository, username):
user_subscription_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at'] user_subscription_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at']
user_subscription_row = [repository['name'], repository['id'], repository['description'], repository['forks'], repository['stargazers_count'], repository['watchers'], repository['license'], repository['default_branch'], repository['visibility'], repository['language'], repository['open_issues'], repository['topics'], repository['homepage'], repository['clone_url'], repository['ssh_url'], repository['fork'], repository['allow_forking'], repository['private'], repository['archived'], repository['is_template'], repository['has_wiki'], repository['has_pages'], repository['has_projects'], repository['has_issues'], repository['has_downloads'], repository['pushed_at'], repository['created_at'], repository['updated_at']] user_subscription_row = [repository['name'], repository['id'], repository['description'], repository['forks'], repository['stargazers_count'], repository['watchers'], repository['license'], repository['default_branch'], repository['visibility'], repository['language'], repository['open_issues'], repository['topics'], repository['homepage'], repository['clone_url'], repository['ssh_url'], repository['fork'], repository['allow_forking'], repository['private'], repository['archived'], repository['is_template'], repository['has_wiki'], repository['has_pages'], repository['has_projects'], repository['has_issues'], repository['has_downloads'], repository['pushed_at'], repository['created_at'], repository['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{username}_subscriptions_{repository['name']}.csv", 'w') as file: with open(f"output/{username}_subscriptions_{repository['name']}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -325,18 +326,18 @@ class csvLogger:
writecsv.writerow(user_subscription_row) writecsv.writerow(user_subscription_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# .csv for user organizations # .csv for user organizations
def logUserOrgs(organization, username): def logUserOrgs(organization, username):
user_org_fields = ['Profile photo', 'Name', 'ID', 'Node ID', 'URL', 'About'] user_org_fields = ['Profile photo', 'Name', 'ID', 'Node ID', 'URL', 'About']
user_org_row = [organization['avatar_url'], organization['login'], organization['id'], organization['node_id'], organization['url'], organization['description']] user_org_row = [organization['avatar_url'], organization['login'], organization['id'], organization['node_id'], organization['url'], organization['description']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{organization['login']}_{username}.csv", 'w') as file: with open(f"output/{organization['login']}_{username}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -344,18 +345,18 @@ class csvLogger:
writecsv.writerow(user_org_row) writecsv.writerow(user_org_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# Create .csv for user search # Create .csv for user search
def logUserSearch(user, query): def logUserSearch(user, query):
user_search_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL'] user_search_fields = ['Profile photo', 'Username', 'ID', 'Node ID', 'Gravatar ID', 'Account type', 'Is site admin?', 'URL']
user_search_row = [user['avatar_url'], user['login'], user['id'], user['node_id'], user['gravatar_id'], user['type'], user['site_admin'], user['html_url']] user_search_row = [user['avatar_url'], user['login'], user['id'], user['node_id'], user['gravatar_id'], user['type'], user['site_admin'], user['html_url']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{user['login']}_user_search_result_for_{query}.csv", 'w') as file: with open(f"output/{user['login']}_user_search_result_for_{query}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -363,18 +364,18 @@ class csvLogger:
writecsv.writerow(user_search_row) writecsv.writerow(user_search_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# Create .csv for repository search # Create .csv for repository search
def logRepoSearch(repository, query): def logRepoSearch(repository, query):
repo_search_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at'] repo_search_fields = [ 'Name','ID', 'About', 'Forks', 'Stars', 'Watchers', 'License', 'Branch', 'Visibility', 'Language(s)', 'Open issues', 'Topics', 'Homepage', 'Clone URL', 'SSH URL', 'Is fork?', 'Is forkable?', 'Is private?', 'Is archived?', 'Is template?', 'Has wiki?', 'Has pages?', 'Has projects?', 'Has issues?', 'Has downloads?', 'Pushed at', 'Created at', 'Updated at']
repo_search_row = [repository['full_name'], repository['id'], repository['description'], repository['forks'], repository['stargazers_count'], repository['watchers'], repository['license'], repository['default_branch'], repository['visibility'], repository['language'], repository['open_issues'], repository['topics'], repository['homepage'], repository['clone_url'], repository['ssh_url'], repository['fork'], repository['allow_forking'], repository['private'], repository['archived'], repository['is_template'], repository['has_wiki'], repository['has_pages'], repository['has_projects'], repository['has_issues'], repository['has_downloads'], repository['pushed_at'], repository['created_at'], repository['updated_at']] repo_search_row = [repository['full_name'], repository['id'], repository['description'], repository['forks'], repository['stargazers_count'], repository['watchers'], repository['license'], repository['default_branch'], repository['visibility'], repository['language'], repository['open_issues'], repository['topics'], repository['homepage'], repository['clone_url'], repository['ssh_url'], repository['fork'], repository['allow_forking'], repository['private'], repository['archived'], repository['is_template'], repository['has_wiki'], repository['has_pages'], repository['has_projects'], repository['has_issues'], repository['has_downloads'], repository['pushed_at'], repository['created_at'], repository['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{repository['name']}_repository_search_result_for_{query}.csv", 'w') as file: with open(f"output/{repository['name']}_repository_search_result_for_{query}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -382,18 +383,18 @@ class csvLogger:
writecsv.writerow(repo_search_row) writecsv.writerow(repo_search_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# Create .csv for topic search # Create .csv for topic search
def logTopicSearch(topic, query): def logTopicSearch(topic, query):
topic_search_fields = ['Name', 'Score', 'Curated', 'Featured', 'Display name', 'Created by', 'Created at', 'Updated at'] topic_search_fields = ['Name', 'Score', 'Curated', 'Featured', 'Display name', 'Created by', 'Created at', 'Updated at']
topic_search_row = [topic['name'], topic['score'], topic['curated'], topic['featured'], topic['display_name'], topic['created_by'], topic['created_at'], topic['updated_at']] topic_search_row = [topic['name'], topic['score'], topic['curated'], topic['featured'], topic['display_name'], topic['created_by'], topic['created_at'], topic['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{topic['name']}_topic_search_result_for_{query}.csv", 'w') as file: with open(f"output/{topic['name']}_topic_search_result_for_{query}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -401,18 +402,18 @@ class csvLogger:
writecsv.writerow(topic_search_row) writecsv.writerow(topic_search_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# Create .csv for issues search # Create .csv for issues search
def logIssueSearch(issue, query): def logIssueSearch(issue, query):
issue_search_fields = ['Title', 'ID', 'Node ID', 'Number', 'State', 'Reactions', 'Comments', 'Milestone', 'Assignee', 'Assignees', 'Author association', 'Labels', 'Is locked?', 'Lock reason', 'Closed at', 'Created at', 'Updated at'] issue_search_fields = ['Title', 'ID', 'Node ID', 'Number', 'State', 'Reactions', 'Comments', 'Milestone', 'Assignee', 'Assignees', 'Author association', 'Labels', 'Is locked?', 'Lock reason', 'Closed at', 'Created at', 'Updated at']
issue_search_row = [issue['title'], issue['id'], issue['node_id'], issue['number'], issue['state'], issue['reactions'], issue['comments'], issue['milestone'], issue['assignee'], issue['assignees'], issue['author_association'], issue['labels'], issue['locked'], issue['active_lock_reason'], issue['closed_at'], issue['created_at'], issue['updated_at']] issue_search_row = [issue['title'], issue['id'], issue['node_id'], issue['number'], issue['state'], issue['reactions'], issue['comments'], issue['milestone'], issue['assignee'], issue['assignees'], issue['author_association'], issue['labels'], issue['locked'], issue['active_lock_reason'], issue['closed_at'], issue['created_at'], issue['updated_at']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{issue['id']}_issue_search_result_for_{query}.csv", 'w') as file: with open(f"output/{issue['id']}_issue_search_result_for_{query}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -420,18 +421,18 @@ class csvLogger:
writecsv.writerow(issue_search_row) writecsv.writerow(issue_search_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")
# Create .csv for commits search # Create .csv for commits search
def logCommitsSearch(commit, query): def logCommitsSearch(commit, query):
commit_search_fields = ['SHA', 'Author', 'Username', 'Email', 'Committer', 'Repository', 'URL', 'Description'] commit_search_fields = ['SHA', 'Author', 'Username', 'Email', 'Committer', 'Repository', 'URL', 'Description']
commit_search_row = [commit['commit']['tree']['sha'], commit['commit']['author']['name'], commit['author']['login'], commit['commit']['author']['email'], commit['commit']['committer']['name'], commit['repository']['full_name'], commit['html_url'], commit['commit']['message']] commit_search_row = [commit['commit']['tree']['sha'], commit['commit']['author']['name'], commit['author']['login'], commit['commit']['author']['email'], commit['commit']['committer']['name'], commit['repository']['full_name'], commit['html_url'], commit['commit']['message']]
prompt = input(f'\n{SignVar.prompt} {logRoller.askLogCsv}').lower() xprint(f"\n{SignVar.prompt} {logRoller.askLogCsv}", end="");prompt = input().lower()
if prompt == 'y': if prompt == 'y':
with open(f"output/{commit['commit']['tree']['sha']}_commit_search_result_for_{query}.csv", 'w') as file: with open(f"output/{commit['commit']['tree']['sha']}_commit_search_result_for_{query}.csv", 'w') as file:
writecsv = csv.writer(file) writecsv = csv.writer(file)
@@ -439,8 +440,8 @@ class csvLogger:
writecsv.writerow(commit_search_row) writecsv.writerow(commit_search_row)
logging.info(logRoller.loggedToCsv.format(file.name)) logging.info(logRoller.loggedToCsv.format(file.name))
sys.stdout.write(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}\n") xprint(f"{SignVar.positive} {logRoller.loggedToCsv.format(file.name)}")
else: else:
logging.info(logRoller.loggingSkipped) logging.info(logRoller.loggingSkipped.format(prompt))
sys.stdout.write(f"{SignVar.info} ({prompt}) {logRoller.loggingSkipped}\n") xprint(f"{SignVar.info} {logRoller.loggingSkipped.format(prompt)}")

View File

@@ -1,231 +1,182 @@
import sys from rich.table import Table
from octosuite.colors import Color from rich import print as xprint
from octosuite.colors import white, green, white_bold, green_bold, header_title, reset
""" """
Help Help
This class holds the help text for available. This class holds the help text for available commands.
Almost everything in the methods from this class is hard coded
""" """
class Help: class Help:
usageText = 'Use {} to get started' usageText = 'Use syntax {} to get started with %s{}%s.' % (green_bold, reset)
usageText1 = 'Use {} to view all available subcommands.' usageText1 = '%sUse {} to view all available subcommands.%s' % (white, reset)
usageText2 = "%sThe {} command works with subcommands. %s" % (white, reset)
def Org(): def Org():
sys.stdout.write(f""" xprint(Help.usageText2.format(f"{green_bold}org{reset}") + Help.usageText1.format(f"{green_bold}help:org{reset}"))
{Color.white}Note:
-------
The '{Color.green}org{Color.white}' command works with subcommands.
{Help.usageText1.format('help:org')}{Color.reset}
""")
def Repo(): def Repo():
sys.stdout.write(f""" xprint(Help.usageText2.format(f"{green_bold}repo{reset}") + Help.usageText1.format(f"{green_bold}help:repo{reset}"))
{Color.white}Note:
-----
The '{Color.green}repo{Color.white}' command works with subcommands.
{Help.usageText1.format('help:repo')}{Color.reset}
""")
def User(): def User():
sys.stdout.write(f""" xprint(Help.usageText2.format(f"{green_bold}user{reset}") + Help.usageText1.format(f"{green_bold}help:user{reset}"))
{Color.white}Note:
-----
The '{Color.green}user{Color.white}' command works with subcommands.
{Help.usageText1.format('help:user')}{Color.reset}
""")
def Search(): def Search():
sys.stdout.write(f""" xprint(Help.usageText2.format(f"{green_bold}search{reset}") + Help.usageText1.format(f"{green_bold}help:search{reset}"))
{Color.white}Note:
-----
The '{Color.green}search{Color.white}' command works with subcommands.
{Help.usageText1.format('help:search')}{Color.reset}
""")
def Source(): def Source():
sys.stdout.write(f""" xprint(Help.usageText2.format(f"{green_bold}source{reset}") + Help.usageText1.format(f"{green_bold}help:source{reset}"))
{Color.white}Note:
-----
The '{Color.green}source{Color.white}' command works with subcommands.
{Help.usageText1.format('help:source')}{Color.reset}
""")
def Logs(): def Logs():
sys.stdout.write(f""" xprint(Help.usageText2.format(f"{green_bold}logs{reset}") + Help.usageText1.format(f"{green_bold}help:logs{reset}"))
{Color.white}Note:
-----
The '{Color.green}logs{Color.white}' command works with subcommands.
{Help.usageText1.format('help:logs')}{Color.reset}
""")
def Version(): def Version():
sys.stdout.write(f""" xprint(Help.usageText2.format(f"{green_bold}version{reset}") + Help.usageText1.format(f"{green_bold}help:version{reset}"))
{Color.white}Note:
-----
The '{Color.green}version{Color.white}' command works with subcommands.
{Help.usageText1.format('help:version')}{Color.reset}
""")
def Csv(): def Csv():
sys.stdout.write(f""" xprint(Help.usageText2.format(f"{green_bold}csv{reset}") + Help.usageText1.format(f"{green_bold}help:csv{reset}"))
{Color.white}Note:
-----
The '{Color.green}csv{Color.white}' command works with subcommands.
{Help.usageText1.format('help:csv')}{Color.reset}
""")
def versionCommand(): def versionCommand():
sys.stdout.write(f""" version_cmd_table =Table(show_header=True, header_style=header_title)
{Color.white}Version subcommands{Color.reset} version_cmd_table.add_column("Command", style="dim", width=12)
{'='*18} version_cmd_table.add_column("Description")
{Help.usageText.format('version:<subcommand>')} version_cmd_table.add_row("check", "Check for new release(s)")
version_cmd_table.add_row("info", "Version information")
{Color.white}Command Description{Color.reset} syntax = f"{green}version:<command>{reset}"
------- ----------- xprint(f"{Help.usageText.format(syntax, 'version management')}")
check Check for new release(s) xprint(version_cmd_table)
info Version info
""")
def sourceCommand(): def sourceCommand():
sys.stdout.write(f""" source_cmd_table =Table(show_header=True, header_style=header_title)
{Color.white}Source subcommands{Color.reset} source_cmd_table.add_column("Command", style="dim", width=12)
{'='*18} source_cmd_table.add_column("Description")
{Help.usageText.format('source:<subcommand>')} source_cmd_table.add_row("zipball", "Download source code Zipball")
{Color.white}Command Description{Color.reset} source_cmd_table.add_row("tarball", "Download source code Tarball")
-------- -----------
zipball Download source code as zipball syntax = f"{green}source:<command>{reset}"
tarball Download source code as tarball xprint(f"{Help.usageText.format(syntax, 'source code downloads')}")
""") xprint(source_cmd_table)
def searchCommand(): def searchCommand():
sys.stdout.write(f""" search_cmd_table =Table(show_header=True, header_style=header_title)
{Color.white}Search subcommands{Color.reset} search_cmd_table.add_column("Command", style="dim", width=12)
{'='*18} search_cmd_table.add_column("Description")
{Help.usageText.format('search:<subcommand>')} 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)")
{Color.white}Command Description{Color.reset} syntax = f"{green}search:<command>{reset}"
------- ----------- xprint(f"{Help.usageText.format(syntax, 'target discovery')}")
users Search user(s) xprint(search_cmd_table)
repos Search repositor[yies]
topics Search topic(s)
issues Search issue(s)
commits Search commit(s)
""")
def userCommand(): def userCommand():
sys.stdout.write(f""" user_cmd_table =Table(show_header=True, header_style=header_title)
{Color.white}User subcommands{Color.reset} user_cmd_table.add_column("Command", style="dim", width=12)
{'='*17} user_cmd_table.add_column("Description")
{Help.usageText.format('user:<subcommand>')} 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("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")
user_cmd_table.add_row("subscriptions", "Return a target's subscriptions")
{Color.white}Command Description{Color.reset} syntax = f"{green}user:<command>{reset}"
------- ----------- xprint(f"{Help.usageText.format(syntax, 'user investigation(s)')}")
profile Get a user's profile info xprint(user_cmd_table)
gists Return a users's gists
orgs Return organizations that a user belongs to/owns
repos Return a user's repositories
events Return a user's events
follows Check if user(A) follows user(B)
followers Return a user's followers
following Return a list of users the target is following
subscriptions Return a user's subscriptions
""")
def orgCommand(): def orgCommand():
sys.stdout.write(f""" org_cmd_table =Table(show_header=True, header_style=header_title)
{Color.white}Org subcommands{Color.reset} org_cmd_table.add_column("Command", style="dim", width=12)
{'='*16} org_cmd_table.add_column("Description")
{Help.usageText.format('org:<subcommand>')} 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")
{Color.white}Command Description{Color.reset} syntax = f"{green}org:<command>{reset}"
------- ----------- xprint(f"{Help.usageText.format(syntax, 'organization investigation(s)')}")
profile Get an organization's info xprint(org_cmd_table)
repos Return an organization's repositories
events Return an organization's events
member Check if a specified user is a public member of the target organization
""")
def repoCommand(): def repoCommand():
sys.stdout.write(f""" repo_cmd_table =Table(show_header=True, header_style=header_title)
{Color.white}Repo subcommands{Color.reset} repo_cmd_table.add_column("Command", style="dim", width=12)
{'='*17} repo_cmd_table.add_column("Description")
{Help.usageText.format('repo:<subcommand>')} 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("path_contents", "List contents in a path of a repository")
{Color.white}Command Description{Color.reset} syntax = f"{green}repo:<command>{reset}"
------- ----------- xprint(f"{Help.usageText.format(syntax, 'repository investigation(s)')}")
profile Get a repository's info xprint(repo_cmd_table)
issues Return a repository's issues
forks Return a repository's forks
releases Return a repository's releases
stargazers Return a repository's stargazers
pathcontents List contents in a path of a repository
""")
def logsCommand(): def logsCommand():
sys.stdout.write(f""" logs_cmd_table =Table(show_header=True, header_style=header_title)
{Color.white}Logs subcommands{Color.reset} logs_cmd_table.add_column("Command", style="dim", width=12)
{'='*17} logs_cmd_table.add_column("Description")
{Help.usageText.format('logs:<subcommand>')} 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)
{Color.white}Command Description{Color.reset}
------- -----------
view View logs
read Read log
delete Delete log
""")
def csvCommand(): def csvCommand():
sys.stdout.write(f""" csv_cmd_table =Table(show_header=True, header_style=header_title)
{Color.white}Csv subcommands{Color.reset} csv_cmd_table.add_column("Command", style="dim", width=12)
{'='*17} csv_cmd_table.add_column("Description")
{Help.usageText.format('csv:<subcommand>')} 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")
{Color.white}Command Description{Color.reset} syntax = f"{green}csv:<command>{reset}"
------- ----------- xprint(f"{Help.usageText.format(syntax, 'csv management')}")
view View csv files xprint(csv_cmd_table)
read Read csv
delete Delete csv
""")
def helpCommand():
sys.stdout.write(f"""
{Color.white}Core commands{Color.reset}
{'='*13}
{Color.white}Command Description{Color.reset}
------- -----------
help Help menu
exit Close session
clear Clear screen
about Program' info
author Developer' info
{Color.white}Help subcommands{Color.reset}
{'='*16}
{Help.usageText.format('help:<subcommand>')}
{Color.white}Command Description{Color.reset} def helpCommand():
------- ----------- core_cmd_table =Table(show_header=True, header_style=header_title)
csv (coming soon) core_cmd_table.add_column("Command", style="dim", width=12)
org List all organization investigation commands core_cmd_table.add_column("Description")
logs List all logs management commands core_cmd_table.add_row("help", "Help menu")
repo List all repository investigation commands core_cmd_table.add_row("exit", "Close session")
user List all users investigation commands core_cmd_table.add_row("clear", "Clear screen")
search List all target discovery commands core_cmd_table.add_row("about", "Program's info")
source (beta) List all source code download commands (for developers) core_cmd_table.add_row("author", "Developer's info")
version List all version management commands
""") 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("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")
syntax = f"{green}help:<command>{reset}"
xprint(core_cmd_table)
xprint(f"\n\n{Help.usageText.format(syntax, 'octosuite')}")
xprint(help_sub_cmd_table)

View File

@@ -1,25 +1,27 @@
''' """
logRoller logRoller
This class is where the main notification strings/messages are held, 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). 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).
''' """
class logRoller: class logRoller:
Ctrl = 'Session terminated with {}.' Ctrl = "Session terminated with {}."
Error = 'An error occurred: {}' Error = "An error occurred: {}"
sessionOpened = 'Opened new session on {}:{}' sessionOpened = "Opened new session on {}:{}"
sessionClosed = 'Session closed at {}.' sessionClosed = "Session closed at {}."
deletedLog = 'Deleted log: {}' viewingLogs = "Viewing logs..."
readingLog = 'Reading log: {}' viewingCsv = "Viewing CSV file(s)..."
viewingLogs = 'Viewing logs...' deletedLog = "Deleted log -> {}"
fileDownloading = 'Downloading ({})...' readingLog = "Reading log -> {}"
fileDownloaded = 'Downloaded. Saved to downloads/{}' readingCsv = 'Reading csv -> {}'
fileNotFound = 'File ({}) not found.' deletedCsv = 'Deleted csv -> {}'
infoNotFound = 'Information ({} - {} - {}) not found.' fileDownloading = "Downloading -> {}..."
repoNotFound = 'Repository ({}) not found.' fileDownloaded = "Downloaded -> downloads/{}"
userNotFound = 'User (@{}) not found.' infoNotFound = "Information not found -> ({} - {} - {})"
orgNotFound = 'Organization (@{}) not found.' repoNotFound = "Repository not found -> ({})"
repoOrUserNotFound = 'Repository or user not found ({} - @{}).' userNotFound = "User not found -> (@{})"
askLogCsv = 'Do you wish to log this output to a .csv file? (Y/n) ' orgNotFound = "Organization not found -> (@{})"
loggedToCsv = 'Output logged to {}' repoOrUserNotFound = "Repository or user not found -> ({} - @{})"
loggingSkipped = '.csv logging skipped.' askLogCsv = "Do you wish to log this output to a .csv file? (Y/n) "
limitInput = ' Limit {} output to how many? (1-100) ' loggedToCsv = "Output logged -> ({})"
loggingSkipped = "Logging skipped -> ({})"
limitInput = "Limit '{}' output to how many? (1-100) "

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,15 @@
from octosuite.colors import Color from octosuite.colors import red, white, green, reset
''' '''
Attributes SignVar
*Even here, I couldn't think of a good name.* *Even here, I couldn't think of a good name.*
The Attributes class holds the signs/symbols that show what a notification in OctoSuite might be all about. The Attributes class holds the signs/symbols that show what a notification in OctoSuite might be all about.
This might not be very important or necessary in some cases, but I think it's better to know the severerity of the notifications you get in a program. This might not be very important or necessary in some cases, but I think it's better to know the severerity of the notifications you get in a program.
''' '''
class SignVar: class SignVar:
prompt = f'{Color.white}[{Color.green} ? {Color.white}]{Color.reset}' prompt = f"{white}[{green} ? {white}]{reset}"
warning = f'{Color.white}[{Color.red} ! {Color.white}]{Color.reset}' warning = f"{white}[{red} ! {white}]{reset}"
error = f'{Color.white}[{Color.red} x {Color.white}]{Color.reset}' error = f"{white}[{red} x {white}]{reset}"
positive = f'{Color.white}[{Color.green} + {Color.white}]{Color.reset}' positive = f"{white}[{green} + {white}]{reset}"
negative = f'{Color.white}[{Color.red} - {Color.white}]{Color.reset}' negative = f"{white}[{red} - {white}]{reset}"
info = f'{Color.white}[{Color.green} * {Color.white}]{Color.reset}' info = f"{white}[{green} * {white}]{reset}"

View File

@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as file:
setuptools.setup( setuptools.setup(
name="octosuite", name="octosuite",
version="2.1.0", version="2.2.0",
author="Richard Mwewa", author="Richard Mwewa",
author_email="richardmwewa@duck.com", author_email="richardmwewa@duck.com",
packages=["octosuite"], packages=["octosuite"],
@@ -14,7 +14,7 @@ setuptools.setup(
long_description_content_type="text/markdown", long_description_content_type="text/markdown",
url="https://github.com/rly0nheart/octosuite", url="https://github.com/rly0nheart/octosuite",
license="GNU General Public License v3 (GPLv3)", license="GNU General Public License v3 (GPLv3)",
install_requires=["requests"], install_requires=["requests", "rich"],
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Information Technology', 'Intended Audience :: Information Technology',