Browse Source

Updated the documentation and linked the ssh_manager to the configuration manager.

pull/11/head
jrtechs 6 years ago
parent
commit
6647c33bc4
4 changed files with 88 additions and 43 deletions
  1. +78
    -33
      README.md
  2. +1
    -3
      src/configuration.py
  3. +5
    -3
      src/mount_ssh_drive.py
  4. +4
    -4
      src/ssh_manager.py

+ 78
- 33
README.md View File

@ -1,5 +1,7 @@
# roosay
````
# Roosay
```
------------- -------------
< Only at RIT > < Only at RIT >
------------- -------------
@ -11,32 +13,47 @@
'~( '~ )// '~( '~ )//
_\ '}/ _\ '}/
"--~(/ "--~(/
````
```
roosay is a simple python script which displays an ascii roo with a quote above it roosay is a simple python script which displays an ascii roo with a quote above it
## Install
Copy the roosay.py file from the src directory
## Usage ## Usage
```
python3 roosay.py Super cool message
```
or create a .bashrc alias
```
roosay super cool message
```
python3 roosay.py Super cool message
# Install
```
git clone https://github.com/jrtechs/bash_manager.git
```
or create a .bashrc alias
roosay super cool message
# Dependencies
Make sure that you have the following programs installed.
- python3
- ssh
- ssh-copy-id
- sshfs (only for ssh drive manager)
- fusermount (only for ssh drive manager)
# SSH Manager # SSH Manager
````
```
************************************** **************************************
* SSH manager V 0.2 *
* SSH manager V 1.1 *
* 1) user1@host_name * * 1) user1@host_name *
* 2) user2@host_name_2 * * 2) user2@host_name_2 *
* A) Exit * * A) Exit *
* B) Manager tools * * B) Manager tools *
* C) Socks Tunnel * * C) Socks Tunnel *
* D) SSH Drive Manager *
************************************** **************************************
````
```
## About ## About
I developed this program to simply make it easier to manager all your ssh accounts I developed this program to simply make it easier to manager all your ssh accounts
@ -45,28 +62,36 @@ every time you wish to connect to a computer -- which can be a lot for some peop
This program keeps track of all your ssh accounts so they are a few keystrokes away. This program keeps track of all your ssh accounts so they are a few keystrokes away.
## Installation ## Installation
This program is simply a python script that you execute. For example:
python3 ssh_manager.py
This program is simply a python script that you execute.
```
python3 ssh_manager.py
```
or edit your bash configuration with an alias to make it less typing
alias ss="python3 /path/to/this/file/ssh_manager.py"
You can edit your bash configuration with an alias to make it easier to execute.
```
alias ss="python3 /path/to/this/file/ssh_manager.py"
```
To make this easier, the confuguation manager of this program will has the option to
append this and a few other aliases to your bash manager. This will autobatically
use the location of the scripts in the file.
Please note that this program reads in a text file called "servers.txt". In order for
the bash manager to know where this text file is, please edit line 11 of ssh_manager.py
it should look something like this:
The first time you run this program it will ask you for the locations where you want to store
some files which will be used to store the host names and user accounts. The default is to put
it in the same directory as the source code.
INPUT_FILE = "/path/to/servers.txt"
## Usage ## Usage
Your first time running you should see:
After you accept the configuration you will see something like this.
```` ````
************************************** **************************************
* SSH manager V 0.2 *
* SSH manager V 1.1 *
* A) Exit * * A) Exit *
* B) Manager tools * * B) Manager tools *
* C) Socks Tunnel * * C) Socks Tunnel *
* D) SSH Drive Manager *
**************************************
************************************** **************************************
```` ````
I would like to believe that I made this menu intuitive enough so you don't have to I would like to believe that I made this menu intuitive enough so you don't have to
@ -75,14 +100,15 @@ read any documentation. However...
Typing B will pull up this menu: Typing B will pull up this menu:
```` ````
**************************************
* Options *
* 1) Add Host *
* 2) Copy SSH key to server *
* 3) Remove host name *
* 4) Return to ssh manager *
* 5) Exit *
**************************************
**************************************
* Options *
* 1) Add Host *
* 2) Copy SSH key to server *
* 3) Remove host name *
* 4) Return to ssh manager *
* 5) Manage Configuration and Bash *
* 6) Exit *
**************************************
Enter selection: Enter selection:
```` ````
This is where you can run the add host names to the manager -- same as adding them to This is where you can run the add host names to the manager -- same as adding them to
@ -95,16 +121,19 @@ you can use the "2" option to copy your ssh key to a server.
"4" Returns to the main manager window. "4" Returns to the main manager window.
""
If you added some accounts your main window should look like this: If you added some accounts your main window should look like this:
```` ````
************************************** **************************************
* SSH manager V 0.2 *
* SSH manager V 1.1 *
* 1) user1@host_name * * 1) user1@host_name *
* 2) user2@host_name_2 * * 2) user2@host_name_2 *
* A) Exit * * A) Exit *
* B) Manager tools * * B) Manager tools *
* C) Socks Tunnel * * C) Socks Tunnel *
* D) SSH Drive Manager *
************************************** **************************************
```` ````
@ -128,4 +157,20 @@ Now whichever computer you select, it will open a socks proxy. To use the proxy
localhost and port 8123. localhost and port 8123.
# SSH Drive Mount Manager
This manager makes it easier to mount ssh drives using the "fusermount" command.
```
**************************************
* SSH Drive Manager *
* 1) Mount SSH Drives *
* 2) Un-Mount SSH Drives *
* 3) Remove Remote Drive *
* 4) Add Drive to Mount *
* 5) View Drives *
* 6) Usage *
* 7) Manage Config *
* 8) Exit *
**************************************
```

+ 1
- 3
src/configuration.py View File

@ -14,8 +14,6 @@ config dictionary
{servers: "/", quotes: "/", mounts:"/"} {servers: "/", quotes: "/", mounts:"/"}
""" """
import subprocess
import collections
import os.path import os.path
import module import module
@ -68,7 +66,6 @@ def read_config():
Reads the config file and creates a config dictionary Reads the config file and creates a config dictionary
""" """
config = {} config = {}
temp = []
with open(CONFIG_FILE) as file: with open(CONFIG_FILE) as file:
for line in file: for line in file:
temp = line.split(" ") temp = line.split(" ")
@ -100,6 +97,7 @@ def valid_config(config):
""" """
return 'servers' in config and 'quotes' in config and 'mounts' in config return 'servers' in config and 'quotes' in config and 'mounts' in config
def create_config_dependent_files(config): def create_config_dependent_files(config):
""" """
Finds missing files and creates them Finds missing files and creates them

+ 5
- 3
src/mount_ssh_drive.py View File

@ -136,7 +136,8 @@ def print_mount_menu():
"4) Add Drive to Mount", "4) Add Drive to Mount",
"5) View Drives", "5) View Drives",
"6) Usage", "6) Usage",
"7) Exit"])
"7) Manage Config",
"8) Exit"])
def manage_mount_file(): def manage_mount_file():
@ -145,7 +146,7 @@ def manage_mount_file():
""" """
print_mount_menu() print_mount_menu()
i = input("Enter Option:") i = input("Enter Option:")
while i != '7':
while i != '8':
if i == '4': if i == '4':
add_drive() add_drive()
elif i == '3': elif i == '3':
@ -158,9 +159,10 @@ def manage_mount_file():
unmount_all_drives() unmount_all_drives()
elif i == '6': elif i == '6':
print_usage() print_usage()
elif i == '7':
configuration.main()
else: else:
print("Invalid Option") print("Invalid Option")
if i != '1' and i != '2': if i != '1' and i != '2':
print_mount_menu() print_mount_menu()
i = input("Enter Option:") i = input("Enter Option:")

+ 4
- 4
src/ssh_manager.py View File

@ -17,7 +17,6 @@ Computer = collections.namedtuple("Computer", ('host', 'menu_id'))
WELCOME_MESSAGE = "**************************************" WELCOME_MESSAGE = "**************************************"
def main(): def main():
""" """
This function inputs all the available hosts from a text file and This function inputs all the available hosts from a text file and
@ -95,7 +94,6 @@ def socks_ssh_tunnel():
exit_program() exit_program()
def print_sub_menu(): def print_sub_menu():
""" """
prints out a sub help menu for other options prints out a sub help menu for other options
@ -105,7 +103,8 @@ def print_sub_menu():
"2) Copy SSH key to server", "2) Copy SSH key to server",
"3) Remove host name", "3) Remove host name",
"4) Return to ssh manager", "4) Return to ssh manager",
"5) Exit"])
"5) Manage Configuration and Bash",
"6) Exit"])
def print_red(prt): return "\033[91m {}\033[00m" .format(prt) def print_red(prt): return "\033[91m {}\033[00m" .format(prt)
@ -125,7 +124,8 @@ def sub_menu():
2: copy_ssh_key, 2: copy_ssh_key,
3: remove_host, 3: remove_host,
4: main, 4: main,
5: exit_program,
5: configuration.main(),
6: exit_program,
} }
options[int(i)]() options[int(i)]()
else: else:

Loading…
Cancel
Save