Skip to content

Instantly share code, notes, and snippets.

@Krutonium
Created March 6, 2017 03:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Krutonium/5067b67e31a39b8bf5465d08fe0e1eb5 to your computer and use it in GitHub Desktop.
Save Krutonium/5067b67e31a39b8bf5465d08fe0e1eb5 to your computer and use it in GitHub Desktop.
Simple piece of code to reboot my misbehaving Hitron GCN3 Modem.
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