multiSSH3 5.46__py3-none-any.whl → 5.48__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of multiSSH3 might be problematic. Click here for more details.
- {multiSSH3-5.46.dist-info → multiSSH3-5.48.dist-info}/METADATA +1 -1
- multiSSH3-5.48.dist-info/RECORD +6 -0
- multiSSH3.py +63 -21
- multiSSH3-5.46.dist-info/RECORD +0 -6
- {multiSSH3-5.46.dist-info → multiSSH3-5.48.dist-info}/WHEEL +0 -0
- {multiSSH3-5.46.dist-info → multiSSH3-5.48.dist-info}/entry_points.txt +0 -0
- {multiSSH3-5.46.dist-info → multiSSH3-5.48.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
multiSSH3.py,sha256=gMGDhDGQFKooYgRUqPW0HQcCpLmOcYgyoHIccs4tQuU,137140
|
|
2
|
+
multiSSH3-5.48.dist-info/METADATA,sha256=NOgMgyRTE1TtYuy3a8kWwqF7M5UXj--jMakNGfLXBg4,18001
|
|
3
|
+
multiSSH3-5.48.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
4
|
+
multiSSH3-5.48.dist-info/entry_points.txt,sha256=xi2rWWNfmHx6gS8Mmx0rZL2KZz6XWBYP3DWBpWAnnZ0,143
|
|
5
|
+
multiSSH3-5.48.dist-info/top_level.txt,sha256=tUwttxlnpLkZorSsroIprNo41lYSxjd2ASuL8-EJIJw,10
|
|
6
|
+
multiSSH3-5.48.dist-info/RECORD,,
|
multiSSH3.py
CHANGED
|
@@ -34,6 +34,7 @@ import uuid
|
|
|
34
34
|
import tempfile
|
|
35
35
|
import math
|
|
36
36
|
from itertools import count
|
|
37
|
+
import queue
|
|
37
38
|
|
|
38
39
|
try:
|
|
39
40
|
# Check if functiools.cache is available
|
|
@@ -46,7 +47,7 @@ except AttributeError:
|
|
|
46
47
|
# If neither is available, use a dummy decorator
|
|
47
48
|
def cache_decorator(func):
|
|
48
49
|
return func
|
|
49
|
-
version = '5.
|
|
50
|
+
version = '5.48'
|
|
50
51
|
VERSION = version
|
|
51
52
|
COMMIT_DATE = '2025-01-30'
|
|
52
53
|
|
|
@@ -90,31 +91,68 @@ def signal_handler(sig, frame):
|
|
|
90
91
|
os.system(f'pkill -ef {os.path.basename(__file__)}')
|
|
91
92
|
sys.exit(0)
|
|
92
93
|
|
|
94
|
+
# def input_with_timeout_and_countdown(timeout, prompt='Please enter your selection'):
|
|
95
|
+
# """
|
|
96
|
+
# Read an input from the user with a timeout and a countdown.
|
|
97
|
+
|
|
98
|
+
# Parameters:
|
|
99
|
+
# timeout (int): The timeout value in seconds.
|
|
100
|
+
# prompt (str): The prompt message to display to the user. Default is 'Please enter your selection'.
|
|
101
|
+
|
|
102
|
+
# Returns:
|
|
103
|
+
# str or None: The user input if received within the timeout, or None if no input is received.
|
|
104
|
+
# """
|
|
105
|
+
# import select
|
|
106
|
+
# # Print the initial prompt with the countdown
|
|
107
|
+
# eprint(f"{prompt} [{timeout}s]: ", end='', flush=True)
|
|
108
|
+
# # Loop until the timeout
|
|
109
|
+
# for remaining in range(timeout, 0, -1):
|
|
110
|
+
# # If there is an input, return it
|
|
111
|
+
# # this only works on linux
|
|
112
|
+
# if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
|
|
113
|
+
# return input().strip()
|
|
114
|
+
# # Print the remaining time
|
|
115
|
+
# eprint(f"\r{prompt} [{remaining}s]: ", end='', flush=True)
|
|
116
|
+
# # Wait a second
|
|
117
|
+
# time.sleep(1)
|
|
118
|
+
# # If there is no input, return None
|
|
119
|
+
# return None
|
|
120
|
+
|
|
93
121
|
def input_with_timeout_and_countdown(timeout, prompt='Please enter your selection'):
|
|
94
122
|
"""
|
|
95
|
-
Read
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
timeout (int): The timeout value in seconds.
|
|
99
|
-
prompt (str): The prompt message to display to the user. Default is 'Please enter your selection'.
|
|
100
|
-
|
|
101
|
-
Returns:
|
|
102
|
-
str or None: The user input if received within the timeout, or None if no input is received.
|
|
123
|
+
Read input from the user with a timeout (cross-platform).
|
|
124
|
+
If the user does not enter any input within `timeout` seconds, return None.
|
|
125
|
+
Otherwise, return the input string.
|
|
103
126
|
"""
|
|
104
|
-
|
|
105
|
-
|
|
127
|
+
# Queue to receive user input from the background thread
|
|
128
|
+
input_queue = queue.Queue()
|
|
129
|
+
def read_input():
|
|
130
|
+
# Read line from stdin and put it in the queue
|
|
131
|
+
user_input = sys.stdin.readline()
|
|
132
|
+
input_queue.put(user_input)
|
|
133
|
+
# Start a thread that will block on input()
|
|
134
|
+
input_thread = threading.Thread(target=read_input, daemon=True)
|
|
135
|
+
input_thread.start()
|
|
136
|
+
# Print the initial prompt
|
|
106
137
|
eprint(f"{prompt} [{timeout}s]: ", end='', flush=True)
|
|
107
|
-
#
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if
|
|
111
|
-
|
|
112
|
-
|
|
138
|
+
# Countdown loop
|
|
139
|
+
start_time = time.time()
|
|
140
|
+
while True:
|
|
141
|
+
# Check if the input thread has finished (i.e., user pressed Enter)
|
|
142
|
+
if not input_queue.empty():
|
|
143
|
+
# We got user input
|
|
144
|
+
user_input = input_queue.get().strip()
|
|
145
|
+
eprint() # move to the next line
|
|
146
|
+
return user_input
|
|
147
|
+
elapsed = int(time.time() - start_time)
|
|
148
|
+
remaining = timeout - elapsed
|
|
149
|
+
if remaining <= 0:
|
|
150
|
+
# Time is up, no input
|
|
151
|
+
eprint() # move to the next line
|
|
152
|
+
return None
|
|
153
|
+
# Update prompt countdown
|
|
113
154
|
eprint(f"\r{prompt} [{remaining}s]: ", end='', flush=True)
|
|
114
|
-
# Wait a second
|
|
115
155
|
time.sleep(1)
|
|
116
|
-
# If there is no input, return None
|
|
117
|
-
return None
|
|
118
156
|
|
|
119
157
|
@cache_decorator
|
|
120
158
|
def getIP(hostname: str,local=False):
|
|
@@ -1879,7 +1917,11 @@ def __generate_display(stdscr, hosts, lineToDisplay = -1,curserPosition = 0, min
|
|
|
1879
1917
|
# with open('keylog.txt','a') as f:
|
|
1880
1918
|
# f.write(str(key)+'\n')
|
|
1881
1919
|
if key == 410: # 410 is the key code for resize
|
|
1882
|
-
return (lineToDisplay,curserPosition , min_char_len, min_line_len, single_window, 'Terminal resize requested')
|
|
1920
|
+
return (lineToDisplay,curserPosition , min_char_len, min_line_len, single_window, 'Terminal resize requested')
|
|
1921
|
+
# if the user pressed ctrl + d and the last line is empty, we will exit by adding 'exit\n' to the last line
|
|
1922
|
+
elif key == 4 and not __keyPressesIn[-1]:
|
|
1923
|
+
__keyPressesIn[-1].extend('exit\n')
|
|
1924
|
+
__keyPressesIn.append([])
|
|
1883
1925
|
elif key == 95 and not __keyPressesIn[-1]: # 95 is the key code for _
|
|
1884
1926
|
# if last line is empty, we will reconfigure the wh to be smaller
|
|
1885
1927
|
if min_line_len != 1:
|
multiSSH3-5.46.dist-info/RECORD
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
multiSSH3.py,sha256=zwE1pgmNe285WDdv8E1eSOyDlxocrHtryWh-mnc8lGM,135558
|
|
2
|
-
multiSSH3-5.46.dist-info/METADATA,sha256=WWIQS5igJ0S3Yrr27PpXOlv2IGdLYHvZfoQ2SB2bamg,18001
|
|
3
|
-
multiSSH3-5.46.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
|
4
|
-
multiSSH3-5.46.dist-info/entry_points.txt,sha256=xi2rWWNfmHx6gS8Mmx0rZL2KZz6XWBYP3DWBpWAnnZ0,143
|
|
5
|
-
multiSSH3-5.46.dist-info/top_level.txt,sha256=tUwttxlnpLkZorSsroIprNo41lYSxjd2ASuL8-EJIJw,10
|
|
6
|
-
multiSSH3-5.46.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|