Skip to content

Commit

Permalink
added changed file struct for add modules OS #4
Browse files Browse the repository at this point in the history
  • Loading branch information
mh4x0f committed May 5, 2018
1 parent ccfe06a commit 18008fb
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Version 1.3.2
- added command "agents" for list all agents in session
- added lock session when execute command as job
- added option ssh key Authentication #3
- added changed file struct for add modules OS #4

Version 1.3.1
=============
Expand Down
4 changes: 2 additions & 2 deletions shell/b1tifi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python2.7
from os import path,mkdir
from shell.core.consoleUI import Console
from shell.core.utils.color import banner
from shell.core.main import Console
from shell.core.utility.color import banner
version = '1.3.2'
author = 'Marcos Nesster (@mh4x0f)'
def main():
Expand Down
File renamed without changes.
19 changes: 8 additions & 11 deletions shell/core/consoleUI.py → shell/core/common/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,21 @@
import argparse
import cmd
import shlex
import sqlite3
from os import system,path,getcwd
from subprocess import check_output
from re import search
from tabulate import tabulate
import shell.core.libs.secureSSH as SSHConnection
from shell.core.utils import color
import shell.core.utils.constants as C
from shell.core.utility import color
import shell.core.utility.constants as C

class Console(cmd.Cmd):
def __init__(self,db_path):
class ConsoleUI(cmd.Cmd):
def __init__(self,settings,ssh_session=None, dcon=dict):
cmd.Cmd.__init__(self)
self.prompt = color.setcolor('b1tifi:: ', color='Blue')
self.con = sqlite3.connect(db_path)
self.db = self.con.cursor()
self.db.execute(C.createTables)
self.settings = {'all' :{},'check' :[],'agents':{}}
self.sshConnect = SSHConnection
self.settings = settings
self.db = dcon['db_cursor']
self.con = dcon['db_con']
self.sshConnect = ssh_session
self.search_all_agents()

def do_list(self,args):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions shell/core/libs/secureSSH.py → shell/core/connection/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from datetime import datetime
from pexpect import pxssh
from os import path
from shell.core.utils.threads import Thread_Jobs
from shell.core.utils.color import setcolor,display_messages
from shell.core.utility.threads import Thread_Jobs
from shell.core.utility.color import setcolor,display_messages

class ssh(object):
def __init__(self, host,port, user, password,checkconnect=True):
Expand Down
35 changes: 35 additions & 0 deletions shell/core/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import sqlite3
import shell.core.connection.ssh as SSHConnection
from shell.core.common.console import ConsoleUI
import shell.core.utility.constants as C

class Console(ConsoleUI):
''' main class console UI'''
def __init__(self,path):
self.load_database(path)
self.ssh = SSHConnection
self.settings = {'all' :{},'check' :[],'agents':{}}
ConsoleUI.__init__(self,self.settings,self.ssh, {'db_con': self.con, 'db_cursor': self.db})

def load_database(self, path):
self.con = sqlite3.connect(path)
self.db = self.con.cursor()
self.db.execute(C.createTables)

def do_modules(self, args):
''' show all modules '''
pass

def precmd(self, line):
newline=line.strip()
is_cmt=newline.startswith('#')
if is_cmt:
return ('')
return (line)

def postcmd(self, stop, line):
return stop

def emptyline(self):
"""Do nothing on empty input line"""
pass
Empty file added shell/core/utility/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import threading
from shell.core.utils.color import display_messages
from shell.core.utility.color import display_messages
class Thread_Jobs(threading.Thread):
def __init__(self,cmd,session):
threading.Thread.__init__(self)
Expand Down
Empty file added shell/modules/__init__.py
Empty file.

0 comments on commit 18008fb

Please sign in to comment.