protonvpn-cli
protonvpn-cli copied to clipboard
Connection test based on IP change may be wrong in some cases
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.