Skip to main content
added 15 characters in body
Source Link
nxnev
  • 3.8k
  • 2
  • 15
  • 29

This worked for me:

#!/usr/bin/env bash

url='https://www.vpnbook.com/freevpn'
html=$( curl -# -L "${url}" 2> '/dev/null' )

username=$(
  <<< "${html}" \
  grep -P -o -e '(?<=<li>Username: <strong>)(.*?)(?=<\/strong><\/li>)' |
  head -n 1
)

password=$(
  <<< "${html}" \
  grep -P -o -e '(?<=<li>Password: <strong>)(.*?)(?=<\/strong><\/li>)' |
  head -n 1
)

printf '%s\n' "Username: ${username}" "Password: ${password}"

This worked for me:

#!/usr/bin/env bash

url='https://www.vpnbook.com/freevpn'
html=$( curl -# -L "${url}" )

username=$(
  <<< "${html}" \
  grep -P -o -e '(?<=<li>Username: <strong>)(.*?)(?=<\/strong><\/li>)' |
  head -n 1
)

password=$(
  <<< "${html}" \
  grep -P -o -e '(?<=<li>Password: <strong>)(.*?)(?=<\/strong><\/li>)' |
  head -n 1
)

printf '%s\n' "Username: ${username}" "Password: ${password}"

This worked for me:

#!/usr/bin/env bash

url='https://www.vpnbook.com/freevpn'
html=$( curl -# -L "${url}" 2> '/dev/null' )

username=$(
  <<< "${html}" \
  grep -P -o -e '(?<=<li>Username: <strong>)(.*?)(?=<\/strong><\/li>)' |
  head -n 1
)

password=$(
  <<< "${html}" \
  grep -P -o -e '(?<=<li>Password: <strong>)(.*?)(?=<\/strong><\/li>)' |
  head -n 1
)

printf '%s\n' "Username: ${username}" "Password: ${password}"
Source Link
nxnev
  • 3.8k
  • 2
  • 15
  • 29

This worked for me:

#!/usr/bin/env bash

url='https://www.vpnbook.com/freevpn'
html=$( curl -# -L "${url}" )

username=$(
  <<< "${html}" \
  grep -P -o -e '(?<=<li>Username: <strong>)(.*?)(?=<\/strong><\/li>)' |
  head -n 1
)

password=$(
  <<< "${html}" \
  grep -P -o -e '(?<=<li>Password: <strong>)(.*?)(?=<\/strong><\/li>)' |
  head -n 1
)

printf '%s\n' "Username: ${username}" "Password: ${password}"