Skip to content

Commit

Permalink
0.0.31 Task Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryLudemann committed Sep 1, 2022
1 parent 3f2aff8 commit 5c6f751
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 30 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
[![](https://github.com/HarryLudemann/Ngoto/workflows/pytests/badge.svg)]()
[![Maintainability](https://api.codeclimate.com/v1/badges/08e4dc1f109aaa6c4f75/maintainability)](https://codeclimate.com/github/HarryLudemann/Ngoto/maintainability)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/HarryLudemann/Ngoto.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/HarryLudemann/Ngoto/context:python)
[![version-1.3](https://img.shields.io/badge/version-0.0.30-blue)](https://github.com/Datalux/Osintgram/releases/tag/1.3)
![Supported Python versions](https://img.shields.io/badge/python-3.8+-blue.svg)
[![version-1.3](https://img.shields.io/badge/version-0.0.31-blue)](https://github.com/Datalux/Osintgram/releases/tag/1.3)
[![platforms](https://img.shields.io/badge/platform-windows%20%7C%20linux-blue)](https://github.com/loseys/Oblivion/)


# Warning :warning:

<p align="center"><b>This tool is solely for educational purposes. Developer will not be responsible for any misuse of the tool</b></p>

# Setup:
## Using as Command line tool:
#### 1. Clone Repo:
Expand Down
4 changes: 2 additions & 2 deletions ngoto/commands/back.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# contains function to go back
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import options, output
from ngoto.core.util.interface import show_options, output
import os


Expand All @@ -15,7 +15,7 @@ def get_actions(self):
def perform_action(self, pos, _, logger):
if pos.has_parent:
os.system('cls' if os.name in ('nt', 'dos') else 'clear')
options(pos.get_parent())
show_options(pos.get_parent())
logger.debug(
f'Going back to {pos.get_parent().get_name()}',
'Back')
Expand Down
16 changes: 8 additions & 8 deletions ngoto/commands/openFolder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# contains function open folder
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import options
import os
from ngoto.core.util.interface import show_options
from ngoto.core.util.clear import clear_screen


class OpenFolder(CommandBase):
Expand All @@ -11,10 +11,10 @@ def get_description(self):
def get_actions(self):
return ['openFolder', 'openF']

def perform_action(self, *args):
pos = args[0].get_child(int(args[1][1])-1)
pos.set_parent(args[0])
os.system('cls' if os.name in ('nt', 'dos') else 'clear')
options(pos)
args[2].debug(f'Opening folder {pos.get_name()}', program='OpenFolder')
def perform_action(self, pos, options, logger):
pos = pos.get_child(int(options[0])-1)
pos.set_parent(pos)
clear_screen()
show_options(pos)
logger.debug(f'Opening folder {pos.get_name()}', program='OpenFolder')
return pos
18 changes: 9 additions & 9 deletions ngoto/commands/openPlugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# contains function open plugin
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import options
import os
from ngoto.core.util.interface import show_options
from ngoto.core.util.clear import clear_screen


class OpenPlugin(CommandBase):
Expand All @@ -11,13 +11,13 @@ def get_description(self):
def get_actions(self):
return ['openPlugin', 'openP']

def perform_action(self, *args):
plugin = args[0].get_plugin(int(args[1][1]) - args[0].num_children - 1)
if context := plugin.main(args[2]): # if context print
def perform_action(self, pos, options, logger):
plugin = pos.get_plugin(int(options[0]) - pos.num_children - 1)
if context := plugin.main(logger): # if context print
plugin.print_info(context)
else: # if a plugin that returns no context print options
os.system('cls' if os.name in ('nt', 'dos') else 'clear')
options(args[0])
clear_screen()
show_options(pos)

args[2].debug(f'Opening plugin {plugin.name}', program='OpenPlugin')
return args[0]
logger.debug(f'Opening plugin {plugin.name}', program='OpenPlugin')
return pos
8 changes: 4 additions & 4 deletions ngoto/commands/options.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# contains function to show options
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import options
import os
from ngoto.core.util.interface import show_options
from ngoto.core.util.clear import clear_screen


class Options(CommandBase):
Expand All @@ -12,7 +12,7 @@ def get_actions(self):
return ['o', 'options', 'ls']

def perform_action(self, *args):
os.system('cls' if os.name in ('nt', 'dos') else 'clear')
options(args[0])
clear_screen()
show_options(args[0])
args[2].debug('Showing options', program='Options')
return args[0]
6 changes: 3 additions & 3 deletions ngoto/core/clt.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ def __init__(self):
def run_command(self, command: str, options: list = []) -> bool:
check_commands = True
if command.isdigit():
if(num := int(options[0])-1) < self.curr_pos.num_children:
options = ['openF', options[0]]
if (num := int(options[0])-1) < self.curr_pos.num_children:
command = 'openFolder'
elif num < self.curr_pos.num_children + self.curr_pos.num_plugins:
options = ['openP', options[0]]
command = 'openPlugin'
elif command in ['c', 'commands', 'h', 'help']: # display commands
show_commands(self.commands)
check_commands = False
Expand Down
2 changes: 1 addition & 1 deletion ngoto/core/util/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def logo():
''', logo_style)


def options(curr_node): # given Node in plugin and optionally workplace string
def show_options(curr_node): # given Node in plugin
logo()
index = 1
for folder in curr_node.get_children(): # print folders
Expand Down
2 changes: 1 addition & 1 deletion ngoto/core/util/load_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def load_scripts(folder: str) -> None:
module_name = module.split(".")[2]
class_ = getattr(mod, module_name[0].upper() + module_name[1:])
files.append(class_())
return files
return files

0 comments on commit 5c6f751

Please sign in to comment.