https://github.com/xinlin-z/autopass
Entering password automatically for sudo, ssh, scp, like sshpass.
https://github.com/xinlin-z/autopass
password python scp ssh sshpass sudo
Last synced: 6 months ago
JSON representation
Entering password automatically for sudo, ssh, scp, like sshpass.
- Host: GitHub
- URL: https://github.com/xinlin-z/autopass
- Owner: xinlin-z
- License: other
- Created: 2022-07-30T08:52:00.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-08T07:13:55.000Z (over 1 year ago)
- Last Synced: 2024-12-02T02:28:07.446Z (6 months ago)
- Topics: password, python, scp, ssh, sshpass, sudo
- Language: Python
- Homepage:
- Size: 42 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# autopass
* [Installation](#Installation)
* [Usage](#Usage)Entering password automatically for sudo, ssh (remote command) and scp,
like sshpass. Autopass is a pure python version.
For ssh, a `yes` confirmation is also issued automatically
for you if necessary.**No third party module is needed! No need pexpect!**
## Installation
```shell
$ pip install autopass
```## Usage
``` shell
$ python -m autopass -p'passwd' sudo
$ AUTOPASS='passwd' python -m autopass [-t] ssh user@domain [-p port]
````-p`, specify the password.
`-t`, specify a timeout in seconds. SIGKILL will be issued to
child process after timeout. No timeout by default.Password will be issued only once, so if the password is not correct,
the child process will wait for a long time. This is your chance to
place a timeout. Other cases for using timeout might be facing the
terrible network. You can always place a relatively large timeout
value to keep you from waiting like forever.Password can also be exported to `AUTOPASS` environment variable.
``` shell
$ export AUTOPASS='passwd'
$ python -m autopass
```Autopass is focused on command execution, locally or remotely. It cannot
be used interactively. And please do not start a background process by
autopass, like `-f` option of ssh. It is an error. But you definitely
could run autopass with command as a whole in background (by `&`).Exit code of the executed command is return by autopass, you can
use `echo $?` in your shell script to check if the command execution
is successful.