ProtonVPN / protonvpn-cli

Legacy protonvpn-cli: ProtonVPN Command-Line Tool for Linux and macOS. This has been superseded by https://github.com/ProtonVPN/protonvpn-cli-ng
Other
602 stars 96 forks source link

Connection test based on IP change may be wrong in some cases #191

Open Tamaranch opened 5 years ago

Tamaranch commented 5 years ago

I had the case recently using my phone as a modem: my IP changed during the openvpn connection process. But in the code, we have:

if [[ ("$current_ip" != "$new_ip") && ("$new_ip" != "Error.") ]]; then
  echo "[$] Connected!"
  echo "[#] New IP: $new_ip"

So pvpn concluded that I was connected when it was not! A complementary test should be added, such as

if [[ ("$current_ip" != "$new_ip") && ("$new_ip" != "Error.") && grep -q "route add $new_ip" "$connection_logs" ]]; then
  echo "[$] Connected!"
  echo "[#] New IP: $new_ip"

I don't know if it's really the right way to do it, so I do not propose a PR, but something should probably be done.