interface fixes
This commit is contained in:
parent
ba9fa303ba
commit
a39cd7ae68
|
@ -4,7 +4,7 @@ sshch is released under DWTWL 2.55 license
|
||||||
|
|
||||||
sshch compatible with pyhon2 and python3, no additional libraries are required
|
sshch compatible with pyhon2 and python3, no additional libraries are required
|
||||||
### Screenshot
|
### Screenshot
|
||||||
![sshch](https://raw.githubusercontent.com/zlaxy/sshch/master/sshch_screenshot.png)
|
![sshch](https://gitlab.com/zlax/sshch/raw/master/sshch_screenshot.png)
|
||||||
### Installing
|
### Installing
|
||||||
**You can install a release version from pip:**
|
**You can install a release version from pip:**
|
||||||
```bash
|
```bash
|
||||||
|
|
6
setup.py
6
setup.py
|
@ -8,15 +8,15 @@ def main():
|
||||||
setup(name='sshch',
|
setup(name='sshch',
|
||||||
author='zlaxy',
|
author='zlaxy',
|
||||||
author_email='zlaxyi@gmail.com',
|
author_email='zlaxyi@gmail.com',
|
||||||
url='https://github.com/zlaxy/sshch/',
|
url='https://gitlab.com/zlax/sshch',
|
||||||
description='Ssh connection and aliases manager',
|
description='Ssh connection and aliases manager',
|
||||||
long_description='SSH connection and aliases manager with curses and command line interface',
|
long_description='SSH connection and aliases manager with curses and command line interface',
|
||||||
long_description_content_type='text/x-rst',
|
long_description_content_type='text/x-rst',
|
||||||
license='DWTWL 2.55',
|
license='DWTWL 2.55',
|
||||||
version='1.0',
|
version='1.03',
|
||||||
py_modules=['sshch'],
|
py_modules=['sshch'],
|
||||||
scripts=['sshch/sshch'],
|
scripts=['sshch/sshch'],
|
||||||
keywords='sshch ssh aliases manager',
|
keywords='sshch ssh aliases curses manager',
|
||||||
python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4',
|
python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4',
|
||||||
|
|
||||||
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
|
# http://pypi.python.org/pypi?%3Aaction=list_classifiers
|
||||||
|
|
26
sshch/sshch
26
sshch/sshch
|
@ -19,8 +19,8 @@ import time
|
||||||
import curses
|
import curses
|
||||||
from curses import textpad, panel
|
from curses import textpad, panel
|
||||||
|
|
||||||
# https://github.com/zlaxy/sshch
|
# https://gitlab.com/zlax/sshch
|
||||||
version = "1.0"
|
version = "1.03"
|
||||||
# path to conf file, default: ~/.config/sshch.conf
|
# path to conf file, default: ~/.config/sshch.conf
|
||||||
conf_file = path.expanduser("~") + '/.config/sshch.conf'
|
conf_file = path.expanduser("~") + '/.config/sshch.conf'
|
||||||
# expand groups by default
|
# expand groups by default
|
||||||
|
@ -64,12 +64,29 @@ def RemoveAliases(aliases):
|
||||||
conf.write(open(conf_file, "w"))
|
conf.write(open(conf_file, "w"))
|
||||||
|
|
||||||
|
|
||||||
|
def ConvertPassword(password):
|
||||||
|
password_string = "'"
|
||||||
|
for char in password:
|
||||||
|
if char == "'":
|
||||||
|
password_string += "'"+'"'+"'"+'"'+"'"
|
||||||
|
elif char == '"':
|
||||||
|
password_string += "''"+'"'+"''"
|
||||||
|
elif char == ';':
|
||||||
|
password_string += "'"+"\;"+"'"
|
||||||
|
elif char == "\\":
|
||||||
|
password_string += "'"+'"'+"\\"+"\\"+'"'+"'"
|
||||||
|
else:
|
||||||
|
password_string += char
|
||||||
|
password_string += "'"
|
||||||
|
return password_string
|
||||||
|
|
||||||
|
|
||||||
def ConnectAlias(alias, command=False):
|
def ConnectAlias(alias, command=False):
|
||||||
exec_string = ""
|
exec_string = ""
|
||||||
if conf.has_option(alias, "password"):
|
if conf.has_option(alias, "password"):
|
||||||
password = base64.b32decode(base64.b16decode(
|
password = base64.b32decode(base64.b16decode(
|
||||||
base64.b64decode(conf.get(alias, "password"))))
|
base64.b64decode(conf.get(alias, "password"))))
|
||||||
exec_string = 'sshpass -p "' + password.decode('utf-8') + '" '
|
exec_string = "sshpass -p " + ConvertPassword(password.decode('utf-8')) + " "
|
||||||
if conf.has_option(alias, "exec_string"):
|
if conf.has_option(alias, "exec_string"):
|
||||||
exec_string = exec_string + conf.get(alias, "exec_string")
|
exec_string = exec_string + conf.get(alias, "exec_string")
|
||||||
if command:
|
if command:
|
||||||
|
@ -240,6 +257,7 @@ def GetTreeList(strings=True, expandlist=True):
|
||||||
else:
|
else:
|
||||||
return resultalias;
|
return resultalias;
|
||||||
|
|
||||||
|
|
||||||
def CMDFullList(option, opt, value, parser):
|
def CMDFullList(option, opt, value, parser):
|
||||||
for p in GetTreeList():
|
for p in GetTreeList():
|
||||||
print (p)
|
print (p)
|
||||||
|
@ -493,6 +511,7 @@ def CursesMain():
|
||||||
(height // 2) - 1, 4, "Enter new alias:", "",
|
(height // 2) - 1, 4, "Enter new alias:", "",
|
||||||
normal_text, highlight_text)
|
normal_text, highlight_text)
|
||||||
add_alias = new_alias_textpad.edit(CursesTextpadConfirm)
|
add_alias = new_alias_textpad.edit(CursesTextpadConfirm)
|
||||||
|
if not add_alias == "":
|
||||||
add_alias = add_alias.split()[0].strip()
|
add_alias = add_alias.split()[0].strip()
|
||||||
if not add_alias == "":
|
if not add_alias == "":
|
||||||
add_result = AddNewAlias(add_alias)
|
add_result = AddNewAlias(add_alias)
|
||||||
|
@ -526,6 +545,7 @@ def CursesMain():
|
||||||
(height // 2) - 1, 4, "Enter group name (without spaces):", "",
|
(height // 2) - 1, 4, "Enter group name (without spaces):", "",
|
||||||
normal_text, highlight_text)
|
normal_text, highlight_text)
|
||||||
add_group = new_group_textpad.edit(CursesTextpadConfirm)
|
add_group = new_group_textpad.edit(CursesTextpadConfirm)
|
||||||
|
if not add_group == "":
|
||||||
add_group = add_group.split()[0].strip()
|
add_group = add_group.split()[0].strip()
|
||||||
if not add_group == "":
|
if not add_group == "":
|
||||||
add_result = AddNewAlias(add_group)
|
add_result = AddNewAlias(add_group)
|
||||||
|
|
Loading…
Reference in New Issue