Created
March 6, 2017 03:47
-
-
Save Krutonium/5067b67e31a39b8bf5465d08fe0e1eb5 to your computer and use it in GitHub Desktop.
Simple piece of code to reboot my misbehaving Hitron GCN3 Modem.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Net.Http; | |
namespace RebootModem | |
{ | |
class MainClass | |
{ | |
public static void Main(string[] args) | |
{ | |
var baseAddress = new Uri("http://192.168.0.1"); | |
using (var handler = new HttpClientHandler { UseCookies = true }) | |
using (var client = new HttpClient(handler) { BaseAddress = baseAddress }) | |
{ | |
var message = new HttpRequestMessage(HttpMethod.Get, "/goform/login?user=cusadmin&pws=password"); | |
var result = client.SendAsync(message).Result; | |
Console.WriteLine(result.Content.ReadAsStringAsync().Result); | |
var message2 = new HttpRequestMessage(HttpMethod.Get, "/goform/Reboot?model=%7B%22reboot%22%3A%221%22%7D"); | |
//The above model=blagh string seems to be the same across modems, Not sure what it is supposed to be. | |
result = client.SendAsync(message2).Result; | |
Console.WriteLine("Your Modem should now be rebooting."); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment