0

I use Docker to build an image and within that image, I have a .exp file I run to authorise the installation of some software which requires user input in the terminal.

When I send a value after using send nothing is printed in the command line window when building the image, the value sent is empty. Any help is much appreciated I would really like to get to the bottom of this quickly.

Dockerfile

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
COPY bin/Release/netcoreapp3.1/ App/
COPY bin/Release/netcoreapp3.1/expressvpn.exp /
WORKDIR /App

RUN /bin/bash -c "apt update"
RUN apt-get install ./expressvpn_2.5.0.505-1_amd64.deb -y && apt-get install sudo -y && apt-get install expect -y

WORKDIR ..
RUN expect ./expressvpn.exp
ENTRYPOINT ["dotnet", "TestingApp.dll"]

expressvpn.exp

#!/usr/bin/expect -d

spawn expressvpn activate
expect "code:"
send "someactivationcode\r"
expect "information."
send "n\r"
expect eof

Powershell output

spawn expressvpn activate
Enter activation code:
Activating...
Unable to sign in. Please check your connection and try again.
send: spawn id exp3 not open
    while executing
"send "n\r""
    (file "./expressvpn.exp" line 9)

'someactivationcode' should be printed where 'Enter activation code"' appears but instead it is empty.

steve
  • 797
  • 1
  • 9
  • 27
  • Can the command succeed if you manually run it? And are there any special chars in the activation code? – sexpect - Expect for Shells Jun 30 '20 at 08:57
  • The activation code is entirely alphanumeric, I cannot manually run it unfortunately as I am doing it through a dockerfile to create an image. Unless you can and I just don't know how to do it. – steve Jun 30 '20 at 09:04
  • 1
    The problem is not in Expect. You need to find out why `expressvpn activate` failed with `unable to sign in`. Not sure if it has options like `--debug` or `--verbose` so you may get more detailed info. – sexpect - Expect for Shells Jun 30 '20 at 13:06
  • but shouldn't there be **someactivationcode** after `Enter activation code:` in the console? I am wondering if that's why it fails to sign in because nothing is being sent in the first place. – steve Jun 30 '20 at 13:14
  • What happens when you execute expressvpn manually? Do you see the code when you type it in? Some applications hide keyboard input for passwords. – glenn jackman Jun 30 '20 at 13:17
  • I would focus on the "Unable to sign in" error. – glenn jackman Jun 30 '20 at 13:17
  • thanks guys. I added `-d` in the Dockerfile `expect` and I can see the code is being sent. It printed to console it the very first time so I thought it would always show. I will look until into the unable to sign error – steve Jun 30 '20 at 13:25
  • did you find out what the issue was with the sign-in error? I'm hitting the issue now... – geekscrap Dec 18 '21 at 17:37
  • @geekscrap this was a long time ago unfortunately I don't remember. What I do remember tho is that I just ended up using another this ready-made image which worked flawlessly https://hub.docker.com/r/polkaned/expressvpn – steve Dec 19 '21 at 19:05

0 Answers0