mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-08-28 04:46:34 -04:00
port-jobs: Allow server help code to be removed by RMSERVER.py
Former-commit-id: cb58ed696f9aca18b95297d784b1c021ec9f3461 Former-commit-id: b1d93eedcc74812fa68b8624c9a6490e8f58e565
This commit is contained in:
@@ -426,6 +426,7 @@ def print_info():
|
||||
print(' update/-u generate a password for an existing entry')
|
||||
print("\n\u001b[1mtip 1:\u001b[0m you can quickly read an entry with 'sshyp </entry name>'")
|
||||
print("\u001b[1mtip 2:\u001b[0m type 'sshyp' to view a list of saved entries\n")
|
||||
# PORT START HELP-SERVER
|
||||
else:
|
||||
print('\n\u001b[1musage:\u001b[0m sshyp <option> [flag] [<device id>]\n')
|
||||
print('\u001b[1moptions:\u001b[0m')
|
||||
@@ -439,6 +440,7 @@ def print_info():
|
||||
print(' list/-l view all registered device ids and their quick-unlock whitelist status')
|
||||
print(' add whitelist a device id for quick-unlock')
|
||||
print(' del remove a device id from the quick-unlock whitelist\n')
|
||||
# PORT END HELP-SERVER
|
||||
|
||||
|
||||
# shortcut to quickly read an entry
|
||||
|
||||
@@ -66,3 +66,18 @@ new_text = re.sub(regex, '', text)
|
||||
|
||||
# write updated text
|
||||
open('working/sshyp.py', 'w').write(new_text)
|
||||
|
||||
# HELP-SERVER
|
||||
# define PORT target
|
||||
string1 = '# PORT START HELP-SERVER'
|
||||
string2 = '# PORT END HELP-SERVER'
|
||||
|
||||
# read input file
|
||||
text = open('working/sshyp.py', 'r').read()
|
||||
|
||||
# find and replace the defined PORT target
|
||||
regex = re.compile(f"{string1}.*?{string2}\n", re.DOTALL)
|
||||
new_text = re.sub(regex, '', text)
|
||||
|
||||
# write updated text
|
||||
open('working/sshyp.py', 'w').write(new_text)
|
||||
|
||||
Reference in New Issue
Block a user