{"id":56,"date":"2009-04-17T13:54:56","date_gmt":"2009-04-17T20:54:56","guid":{"rendered":"http:\/\/domemtech.com\/?p=56"},"modified":"2016-04-04T20:25:34","modified_gmt":"2016-04-05T00:25:34","slug":"56","status":"publish","type":"post","link":"http:\/\/165.227.223.229\/index.php\/2009\/04\/17\/56\/","title":{"rendered":"Netgear router monitor"},"content":{"rendered":"<p>Feeling bored and looking for some fun, I wrote a Netgear router monitor program. This is what programmers do. \u00c2\u00a0I was interested in seeing what websites were accessed through the router at my home. \u00c2\u00a0While there is a log available via the router, the buffer in a router are notoriously small and data that are only a few minutes old are lost.\u00c2\u00a0 This tool fixes that by polling the router every few seconds.\u00c2\u00a0 The tool looks for router that is a model WGR614v6, but other Netgear routers may work. \u00c2\u00a0For other routers, I would expect a change to the code to parse the output.<br \/>\n<!--more--><\/p>\n<p>The executable (.NET) is <a href=\"http:\/\/domemtech.com\/code\/NetgearMonitor.exe\">here<\/a>, and the source code\u00c2\u00a0is <a href=\"http:\/\/domemtech.com\/code\/NetgearMonitor.zip\">here<\/a> (C# Windows Form application).\u00c2\u00a0 You have to be able to provide a login ID, password, and domain for your router for it to work.<\/p>\n<p>The only difficult part was understanding how to use the network credentials for specifying the userid\/password\/domain when making a WebRequest. Without the proper credentials, the router returns an &#8220;401 unauthorized&#8221; response. The TextBox controls (textBox3, textBox4, textBox5) used below contain the user id, password, and domain for the login. The TextBox control for the router address (textBox1) is appended with &#8220;\/FW_log.htm&#8221; to get the URI for the logs. Once the response is received, the program looks for strings that begin with &#8220;[ALLOW&#8221;. These are the records contained in the log.<\/p>\n<pre><code>\r\n\r\n   NetworkCredential myCred = new\r\n   NetworkCredential(this.textBox3.Text, this.textBox4.Text, this.textBox5.Text);\r\n   CredentialCache myCache = new CredentialCache();\r\n\r\n   myCache.Add(new Uri(this.textBox1.Text), \"Basic\", myCred);\r\n\r\n   HttpWebRequest\u00c2\u00a0 request\u00c2\u00a0 = (HttpWebRequest)\r\n   WebRequest.Create(this.textBox1.Text + \"\/FW_log.htm\");\r\n   request.Credentials = myCache;\r\n   try\r\n   {\r\n      HttpWebResponse response = (HttpWebResponse)\r\n         request.GetResponse();\r\n      Stream resStream = response.GetResponseStream();\r\n<\/code><\/pre>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-60\" title=\"netgearmonitor\" src=\"http:\/\/domemtech.com\/wordpress\/wp-content\/uploads\/2009\/04\/netgearmonitor.png\" alt=\"netgearmonitor\" width=\"901\" height=\"498\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Feeling bored and looking for some fun, I wrote a Netgear router monitor program. This is what programmers do. \u00c2\u00a0I was interested in seeing what websites were accessed through the router at my home. \u00c2\u00a0While there is a log available via the router, the buffer in a router are notoriously small and data that are &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/165.227.223.229\/index.php\/2009\/04\/17\/56\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Netgear router monitor&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/165.227.223.229\/index.php\/wp-json\/wp\/v2\/posts\/56"}],"collection":[{"href":"http:\/\/165.227.223.229\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/165.227.223.229\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/165.227.223.229\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/165.227.223.229\/index.php\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":0,"href":"http:\/\/165.227.223.229\/index.php\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"wp:attachment":[{"href":"http:\/\/165.227.223.229\/index.php\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/165.227.223.229\/index.php\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/165.227.223.229\/index.php\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}