Skip to content

Commit

Permalink
Refactor Imports
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryLudemann committed Sep 8, 2022
1 parent c29f876 commit 9ac550b
Show file tree
Hide file tree
Showing 17 changed files with 50 additions and 42 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ Ngoto.egg-info
build
dist
Ngoto.bat
ChromePwTest.py
ChromePwTest.py
log.txt
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ Which will bring you to the following:

## Plugin:
```python
from ngoto.util import Plugin, interface
from ngoto.core.util.rich.table import Table # used in this plugin
from ngoto import Plugin, interface, Table # used in this plugin

class Plugin(Plugin):
name = 'IP'
Expand Down Expand Up @@ -77,8 +76,7 @@ class Plugin(Plugin):
```
## Command:
```python
from ngoto.core.util.command import Command
from ngoto.core.util.interface import output
from ngoto import Command, output
class Logs(Command):

def get_description(self):
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# this script is to launch command line tool

if __name__ == '__main__':
from ngoto.core.clt import CLT
from ngoto import CLT
ngotoCLT = CLT()
ngotoCLT.main()
30 changes: 30 additions & 0 deletions ngoto/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from ngoto.core.clt import CLT
from ngoto.core.module import Module
from ngoto.core.util.interface import output, get_input, logo
from ngoto.core.util.interface import show_options, show_commands
from ngoto.core.util.clear import clear_screen
from ngoto.core.util.notify import notify
from ngoto.core.util.logging import Logging
from ngoto.core.util.node import Node
from ngoto.core.util.plugin import PluginBase
from ngoto.core.util.command import CommandBase
from ngoto.core.util.rich.table import Table
from ngoto.core.util.rich.style import Style

__all__ = [
'CLT',
'Module',
'output',
'get_input',
'logo',
'show_options',
'show_commands',
'clear_screen',
'notify',
'Node',
'PluginBase',
'CommandBase',
'Table',
'Style',
'Logging'
]
4 changes: 1 addition & 3 deletions ngoto/commands/back.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import show_options, output
from ngoto.core.util.clear import clear_screen
from ngoto import CommandBase, show_options, output, clear_screen


class Back(CommandBase):
Expand Down
3 changes: 1 addition & 2 deletions ngoto/commands/clear.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# contains function to clear screen
from ngoto.core.util.command import CommandBase
from ngoto.core.util.clear import clear_screen
from ngoto import CommandBase, clear_screen


class Clear(CommandBase):
Expand Down
3 changes: 1 addition & 2 deletions ngoto/commands/exit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# contains function to exit program
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import output
from ngoto import CommandBase, output
import sys


Expand Down
3 changes: 1 addition & 2 deletions ngoto/commands/logs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# contains function to show logs
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import output
from ngoto import CommandBase, output


class Logs(CommandBase):
Expand Down
4 changes: 1 addition & 3 deletions ngoto/commands/openFolder.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# contains function open folder
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import show_options
from ngoto.core.util.clear import clear_screen
from ngoto import CommandBase, show_options, clear_screen


class OpenFolder(CommandBase):
Expand Down
4 changes: 1 addition & 3 deletions ngoto/commands/openPlugin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# contains function open plugin
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import show_options
from ngoto.core.util.clear import clear_screen
from ngoto import CommandBase, show_options, clear_screen


class OpenPlugin(CommandBase):
Expand Down
4 changes: 1 addition & 3 deletions ngoto/commands/options.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# contains function to show options
from ngoto.core.util.command import CommandBase
from ngoto.core.util.interface import show_options
from ngoto.core.util.clear import clear_screen
from ngoto import CommandBase, show_options, clear_screen


class Options(CommandBase):
Expand Down
2 changes: 1 addition & 1 deletion ngoto/commands/paths.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# contains function to check plugins modules are installed
from ngoto.core.util.command import CommandBase
from ngoto import CommandBase
from ngoto.core import constants as const
import os
from os.path import exists
Expand Down
6 changes: 3 additions & 3 deletions ngoto/core/module.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# still needs to be flushed out

from ngoto.core.util import Node, Plugin
from ngoto.core.util.node import Node
from ngoto.core.ngoto import Ngoto


class Module(Ngoto):
""" Module class, contains Module specific methods """
def get_plugin(self, name: str, node: Node) -> Plugin:
def get_plugin(self, name: str, node: Node):
""" recursive method given plugins name returns plugin,
returns None if not found """
for plugin in node.get_plugins():
Expand All @@ -19,6 +19,6 @@ def get_plugin_context(self, plugin_name: str, args: list) -> dict:
""" Get context from plugin, given plugin name & list of args """
return self.get_plugin(plugin_name, self.curr_pos).get_context(*args)

def add_plugin(self, plugin: Plugin) -> None:
def add_plugin(self, plugin) -> None:
""" Add plugin to current node """
self.curr_pos.add_plugin(plugin)
5 changes: 1 addition & 4 deletions ngoto/plugins/OSINT/URL.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import socket
from ngoto.core.util.plugin import PluginBase
from ngoto.core.util.logging import Logging
from ngoto.core.util.interface import output, get_input
from ngoto.core.util.rich.table import Table, Style # used in this plugin
from ngoto import PluginBase, Logging, output, get_input, Table, Style


class Plugin(PluginBase):
Expand Down
4 changes: 1 addition & 3 deletions ngoto/plugins/OSINT/osint_framework.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# this script loads the osint framework as tree from their github json file
# the main method allowing to traverse the load tree

from ngoto.core.util.plugin import PluginBase
from ngoto.core.util.logging import Logging
from ngoto.core.util.interface import output, get_input
from ngoto import PluginBase, Logging, output, get_input
import requests
import os
import webbrowser
Expand Down
5 changes: 1 addition & 4 deletions ngoto/plugins/Passwords/ChromePasswords.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
from ngoto.core.util.plugin import PluginBase
from ngoto.core.util.logging import Logging
from ngoto.core.util.interface import output
from ngoto.core.util.rich.table import Table, Style # used in this plugin
from ngoto import PluginBase, Logging, output, Table, Style
from dataclasses import dataclass


Expand Down
4 changes: 1 addition & 3 deletions ngoto/plugins/Passwords/WifiPassword.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from ngoto.core.util.plugin import PluginBase
from ngoto.core.util.interface import output
from ngoto.core.util.rich.table import Table, Style # used in this plugin
from ngoto import PluginBase, output, Table, Style # used in this plugin
import subprocess


Expand Down

0 comments on commit 9ac550b

Please sign in to comment.