add docker image to run it in windows
This commit is contained in:
parent
3e32aa958c
commit
3d5db06343
@ -4,12 +4,19 @@
|
|||||||
[](https://github.com/fluzzi/connpy/blob/main/LICENSE)
|
[](https://github.com/fluzzi/connpy/blob/main/LICENSE)
|
||||||
[](https://pypi.org/pypi/connpy/)
|
[](https://pypi.org/pypi/connpy/)
|
||||||
|
|
||||||
Connpy is a ssh and telnet connection manager and automation module
|
Connpy is a ssh and telnet connection manager and automation module for Linux, Mac and Docker
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
pip install connpy
|
pip install connpy
|
||||||
|
|
||||||
|
### Run it in Windows using docker
|
||||||
|
```
|
||||||
|
git clone https://github.com/fluzzi/connpy
|
||||||
|
docker compose -f path/to/folder/docker-compose.yml build
|
||||||
|
docker compose -f path/to/folder/docker-compose.yml run -it connpy-app
|
||||||
|
```
|
||||||
|
|
||||||
## Automation module usage
|
## Automation module usage
|
||||||
### Standalone module
|
### Standalone module
|
||||||
```
|
```
|
||||||
|
@ -482,7 +482,7 @@ class node:
|
|||||||
cmd = cmd + " {}".format(self.host)
|
cmd = cmd + " {}".format(self.host)
|
||||||
else:
|
else:
|
||||||
cmd = cmd + " {}".format("@".join([self.user,self.host]))
|
cmd = cmd + " {}".format("@".join([self.user,self.host]))
|
||||||
expects = ['yes/no', 'refused', 'supported', 'Invalid|[u|U]sage: (ssh|sftp)', '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", "bad permissions"]
|
expects = ['yes/no', 'refused', 'supported', 'Invalid|[u|U]sage: (ssh|sftp)', '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", "[b|B]ad (owner|permissions)"]
|
||||||
elif self.protocol == "telnet":
|
elif self.protocol == "telnet":
|
||||||
cmd = "telnet " + self.host
|
cmd = "telnet " + self.host
|
||||||
if self.port != '':
|
if self.port != '':
|
||||||
@ -495,7 +495,7 @@ class node:
|
|||||||
passwords = self._passtx(self.password)
|
passwords = self._passtx(self.password)
|
||||||
else:
|
else:
|
||||||
passwords = []
|
passwords = []
|
||||||
expects = ['[u|U]sername:', 'refused', 'supported', 'invalid option', 'ssh-keygen.*\"', 'timeout|timed.out', 'unavailable', 'closed', '[p|P]assword:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching", "bad permissions"]
|
expects = ['[u|U]sername:', 'refused', 'supported', 'invalid option', 'ssh-keygen.*\"', 'timeout|timed.out', 'unavailable', 'closed', '[p|P]assword:', r'>$|#$|\$$|>.$|#.$|\$.$', 'suspend', pexpect.EOF, pexpect.TIMEOUT, "No route to host", "resolve hostname", "no matching", "[b|B]ad (owner|permissions)"]
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid protocol: " + self.protocol)
|
raise ValueError("Invalid protocol: " + self.protocol)
|
||||||
attempts = 1
|
attempts = 1
|
||||||
|
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
connpy-app:
|
||||||
|
build: .
|
||||||
|
image: connpy-app
|
||||||
|
volumes:
|
||||||
|
- ./docker/connpy/:/app
|
||||||
|
- ./docker/logs/:/logs
|
||||||
|
- ./docker/ssh/:/root/.ssh/
|
4
docker/connpy/.gitignore
vendored
Normal file
4
docker/connpy/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
4
docker/logs/.gitignore
vendored
Normal file
4
docker/logs/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
4
docker/ssh/.gitignore
vendored
Normal file
4
docker/ssh/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
21
dockerfile
Normal file
21
dockerfile
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Use the official python image
|
||||||
|
|
||||||
|
FROM python:3.11-alpine as connpy-app
|
||||||
|
|
||||||
|
# Set the entrypoint
|
||||||
|
# Set the working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install any additional dependencies
|
||||||
|
RUN apk update && apk add --no-cache openssh fzf fzf-tmux ncurses bash
|
||||||
|
RUN pip3 install connpy
|
||||||
|
RUN connpy config --configfolder /app
|
||||||
|
|
||||||
|
#AUTH
|
||||||
|
RUN ssh-keygen -A
|
||||||
|
RUN mkdir /root/.ssh && \
|
||||||
|
chmod 700 /root/.ssh
|
||||||
|
|
||||||
|
|
||||||
|
#Set the entrypoint
|
||||||
|
ENTRYPOINT ["connpy"]
|
Loading…
Reference in New Issue
Block a user