Fix:
- Fix not allowing to use some regex symbols when passing arguments.
- Fix AI requests timing out when list of nodes is big.
- Fix error when forwarding connpy run commands to a file
Features:
- Improve AI response time changing list of devices to list of OS,
reducing the lenght of request.
- Update GPT model to last one.
- Add filtering option to list command, Also format can be passed to
format the output as needed.
- Allow to use regular expresions to match nodes in: run command
(using yaml file or directly), remove command.
- When there is a connectivity error, now it shows the error number
plus the protocol error.
This commit is contained in:
1 parent
0254cf6ccb
commit
f4ff035da3
6 files changed
+180
-97
No files matched your search
+7
-6
@@ -436,7 +436,7 @@ class node:
|
||||
passwords = self._passtx(self.password)
|
||||
else:
|
||||
passwords = []
|
||||
expects = ['yes/no', 'refused', 'supported', 'cipher', 'ssh-keygen.*\"', 'timeout', 'unavailable', 'closed', '[p|P]assword:|[u|U]sername:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching"]
|
||||
expects = ['yes/no', 'refused', 'supported', 'cipher', 'ssh-keygen.*\"', 'timeout|timed.out', 'unavailable', 'closed', '[p|P]assword:|[u|U]sername:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching"]
|
||||
elif self.protocol == "telnet":
|
||||
cmd = "telnet " + self.host
|
||||
if self.port != '':
|
||||
@@ -449,7 +449,7 @@ class node:
|
||||
passwords = self._passtx(self.password)
|
||||
else:
|
||||
passwords = []
|
||||
expects = ['[u|U]sername:', 'refused', 'supported', 'cipher', 'ssh-keygen.*\"', 'timeout', 'unavailable', 'closed', '[p|P]assword:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching"]
|
||||
expects = ['[u|U]sername:', 'refused', 'supported', 'cipher', 'ssh-keygen.*\"', 'timeout|timed.out', 'unavailable', 'closed', '[p|P]assword:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching"]
|
||||
else:
|
||||
raise ValueError("Invalid protocol: " + self.protocol)
|
||||
attempts = 1
|
||||
@@ -476,9 +476,6 @@ class node:
|
||||
else:
|
||||
self.missingtext = True
|
||||
break
|
||||
if results == 4:
|
||||
child.terminate()
|
||||
return "Connection failed code:" + str(results) + "\n" + child.after.decode()
|
||||
if results in [1, 2, 3, 4, 5, 6, 7, 12, 13, 14, 15]:
|
||||
child.terminate()
|
||||
if results == 12 and attempts != max_attempts:
|
||||
@@ -486,7 +483,11 @@ class node:
|
||||
endloop = True
|
||||
break
|
||||
else:
|
||||
return "Connection failed code:" + str(results)
|
||||
if results == 12:
|
||||
after = "Connection timeout"
|
||||
else:
|
||||
after = child.after.decode()
|
||||
return ("Connection failed code:" + str(results) + "\n" + child.before.decode() + after + child.readline().decode()).rstrip()
|
||||
if results == 8:
|
||||
if len(passwords) > 0:
|
||||
child.sendline(passwords[i])
|
||||
|
||||
Reference in new issue
Block a user