Giter Site home page Giter Site logo

auto password input about console-client HOT 2 OPEN

pcloudcom avatar pcloudcom commented on September 12, 2024
auto password input

from console-client.

Comments (2)

imtiajmeah avatar imtiajmeah commented on September 12, 2024 1

FYI for those of you that are interested. The current workaround I'm using is the spawn command script.

#!/usr/bin/expect

spawn pcloudcc -u username -p -s

expect "Please, enter password "

send "password\r"

interact

from console-client.

christian-oudard avatar christian-oudard commented on September 12, 2024

I have done a more complete version of this, keeping the passwords in 1password.
https://gist.github.com/christian-oudard/3c26d90651b7eb142008267d289e966a

#! /usr/bin/bash

# Account information.
OP_EMAIL=<email>
OP_MOUNTPOINT=/home/<username>/pCloudDrive
OP_USER_ID=<user-id>  # Gotten from `op account list`.

# Stop server.
if [[ $1 == 'stop' ]]; then
    expect -f - >/dev/null <<END_EXPECT
spawn pcloudcc --commands_only
expect "pCloud console client v.2.0.1\r
Supported commands are:\r
startcrypto <crypto pass>, stopcrypto, finalize, q, quit\r
> "
send -- "finalize\r"
expect eof
END_EXPECT
    exit 0
fi

# Get passwords.
op whoami >/dev/null 2>&1
if [[ $? == 1 ]]; then
    eval $(op signin --account $OP_USER_ID)
    export "OP_SESSION_$OP_USER_ID"
fi

PASSWORD=$(op item get pcloud --fields label="password")
CRYPTO_PASS=$(op item get pcloud --fields label="crypto pass")

# Start server.
expect -f - >/dev/null <<END_EXPECT
spawn pcloudcc --daemonize --username=$OP_EMAIL --mountpoint $OP_MOUNTPOINT --password --crypto
expect "pCloud console client v.2.0.1\r
Please, enter password\r
"
send -- "$PASSWORD\r"
expect "Enter crypto password.\r
Please, enter password\r
"
send -- "$CRYPTO_PASS\r"
expect eof
END_EXPECT

from console-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.