{"action":"created","issue":{"url":"https://api.github.com/repos/pocc/merlink/issues/24","repository_url":"https://api.github.com/repos/pocc/merlink","labels_url":"https://api.github.com/repos/pocc/merlink/issues/24/labels{/name}","comments_url":"https://api.github.com/repos/pocc/merlink/issues/24/comments","events_url":"https://api.github.com/repos/pocc/merlink/issues/24/events","html_url":"https://github.com/pocc/merlink/issues/24","id":316472231,"number":24,"title":"Error if not connected to internet","user":{"login":"pocc","id":10995145,"avatar_url":"https://avatars0.githubusercontent.com/u/10995145?v=4","gravatar_id":"","url":"https://api.github.com/users/pocc","html_url":"https://github.com/pocc","followers_url":"https://api.github.com/users/pocc/followers","following_url":"https://api.github.com/users/pocc/following{/other_user}","gists_url":"https://api.github.com/users/pocc/gists{/gist_id}","starred_url":"https://api.github.com/users/pocc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pocc/subscriptions","organizations_url":"https://api.github.com/users/pocc/orgs","repos_url":"https://api.github.com/users/pocc/repos","events_url":"https://api.github.com/users/pocc/events{/privacy}","received_events_url":"https://api.github.com/users/pocc/received_events","type":"User","site_admin":false},"labels":[{"id":889450105,"url":"https://api.github.com/repos/pocc/merlink/labels/feature","name":"feature","color":"a2eeef","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/pocc/merlink/milestones/1","html_url":"https://github.com/pocc/merlink/milestone/1","labels_url":"https://api.github.com/repos/pocc/merlink/milestones/1/labels","id":3270108,"number":1,"title":"Finish UI features","description":"UI should look polished and ready for MVP","creator":{"login":"pocc","id":10995145,"avatar_url":"https://avatars0.githubusercontent.com/u/10995145?v=4","gravatar_id":"","url":"https://api.github.com/users/pocc","html_url":"https://github.com/pocc","followers_url":"https://api.github.com/users/pocc/followers","following_url":"https://api.github.com/users/pocc/following{/other_user}","gists_url":"https://api.github.com/users/pocc/gists{/gist_id}","starred_url":"https://api.github.com/users/pocc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pocc/subscriptions","organizations_url":"https://api.github.com/users/pocc/orgs","repos_url":"https://api.github.com/users/pocc/repos","events_url":"https://api.github.com/users/pocc/events{/privacy}","received_events_url":"https://api.github.com/users/pocc/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":1,"state":"open","created_at":"2018-04-16T11:41:00Z","updated_at":"2018-04-22T07:41:11Z","due_on":"2018-04-30T07:00:00Z","closed_at":null},"comments":2,"created_at":"2018-04-21T08:05:56Z","updated_at":"2018-04-27T04:05:29Z","closed_at":null,"author_association":"OWNER","body":"Error if we can't connect to dashboard due to dns or no internet.\r\n\r\nThis might include nslookups, pings to 8.8.8.8 etc. to identify issue"},"comment":{"url":"https://api.github.com/repos/pocc/merlink/issues/comments/384857921","html_url":"https://github.com/pocc/merlink/issues/24#issuecomment-384857921","issue_url":"https://api.github.com/repos/pocc/merlink/issues/24","id":384857921,"user":{"login":"apierson27","id":8882972,"avatar_url":"https://avatars0.githubusercontent.com/u/8882972?v=4","gravatar_id":"","url":"https://api.github.com/users/apierson27","html_url":"https://github.com/apierson27","followers_url":"https://api.github.com/users/apierson27/followers","following_url":"https://api.github.com/users/apierson27/following{/other_user}","gists_url":"https://api.github.com/users/apierson27/gists{/gist_id}","starred_url":"https://api.github.com/users/apierson27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apierson27/subscriptions","organizations_url":"https://api.github.com/users/apierson27/orgs","repos_url":"https://api.github.com/users/apierson27/repos","events_url":"https://api.github.com/users/apierson27/events{/privacy}","received_events_url":"https://api.github.com/users/apierson27/received_events","type":"User","site_admin":false},"created_at":"2018-04-27T04:05:29Z","updated_at":"2018-04-27T04:05:29Z","author_association":"NONE","body":"Here's a rough start to get this going:\r\n\r\n```python\r\n#! /usr/bin/python\r\n\r\nimport subprocess\r\nimport re\r\nprocess = subprocess.Popen([\"powershell\", \"Get-NetConnectionProfile\"], stdout=subprocess.PIPE)\r\n\r\n# resultant data is a tuple of bytes, so just decode to a string\r\nresult = process.communicate()[0].decode(\"utf-8\")\r\n\r\nconnection_data = {}\r\n\r\nfor line in result.split(\"\\r\\n\"):\r\n\tif line:\r\n\t\tsqueezed = re.sub('\\s+', '', line)\r\n\t\tconnection_data.update([squeezed.split(':')])\r\n\t\t\r\n\r\nfor key, value in connection_data.items():\t\t\r\n\tprint(\"%s : %s\" % (key, value))```\r\n\r\nFrom there, checking whether Windows thinks it has a working Inet connection is just a matter of checking if the IPv4Connectivity key has a value of \"Internet\" (see here for reference: https://docs.microsoft.com/en-us/powershell/module/netconnection/get-netconnectionprofile?view=win10-ps)\r\n\r\nThis has some obvious concerns about error handling that I didn't get a chance to look into yet, but I can do some more digging on what subprocess might raise if it runs into a permissions issue if you think this is a viable route to take."}}
{"actor":{"display_login":"apierson27"}}