Metadata-Version: 2.4
Name: autopass
Version: 0.14
Summary: Entering password automatically for sudo, ssh and scp
Project-URL: homepage, https://github.com/xinlin-z/autopass
Author: xinlin-z
License: MIT License
        
        Copyright (c) 2023 xinlin-z for autopass
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
        Additional Information:
        https://github.com/xinlin-z/autopass
        https://cs.pynote.net
        
License-File: LICENSE
Keywords: password,scp,ssh,sshpass,sudo
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# Autopass

* [Installation](#Installation)
* [Usage](#Usage)

Entering password automatically for sudo, ssh (remote command) and scp,
like sshpass. However, autopass is a pure Python version script.

**No third party module is needed! No need pexpect!**

## Installation

```shell
$ pip install autopass
```

## Usage

``` shell
$ python -m autopass -p'passwd' sudo <command>
$ AUTOPASS='passwd' python -m autopass [-t<N>] ssh user@domain [-p port] <command>
```

`-p<passwd>`, specify the password.

`-t<N>`, specify a timeout in seconds. SIGKILL will be issued to
child process after timeout. No timeout by default.

**Password will be issued only once and only in the first line of output
for security reason**. So if the password is not correct,
the child process will wait for a long time. This is your chance to
set a timeout. Other cases such as a
terrible network, an unknown host or the fingerprint of host is not right,
etc, might also need a timeout to prevent from waiting too long.
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 <passwd-needed-command>
```

Autopass is a simple tool only for 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 returned properly, you can
use `echo $?` in your shell script to check if the command execution
is successful.

Have fun... ^____^

