Skip to content

Instantly share code, notes, and snippets.

@microkost
Created May 16, 2023 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save microkost/0a2d8564a4da04ed8f08377f8942fed0 to your computer and use it in GitHub Desktop.
Save microkost/0a2d8564a4da04ed8f08377f8942fed0 to your computer and use it in GitHub Desktop.
*** Settings ***
Library Selenium2Library
Library String
*** Variables ***
${BROWSER} edge
*** Test Cases ***
Network scanning
[Documentation] Print network details of test execution machine
${ip}= Evaluate [l for l in ([ip for ip in socket.gethostbyname_ex(socket.gethostname())[2] if not ip.startswith("127.")][:1], [[(s.connect(('8.8.8.8', 53)), s.getsockname()[0], s.close()) for s in [socket.socket(socket.AF_INET, socket.SOCK_DGRAM)]][0][1]]) if l][0][0] socket
Log To Console Private IP is: ${ip}
Open Browser http://api.hostip.info/get_json.php ${BROWSER}
${ippublic}= Get Text //html/body/pre #get the IP address text
Log To Console Public networking details are: ${ippublic}
Close Browser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment