ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/HostUpdateSharp/HostUpdateSharp.cs
Revision: 86
Committed: 2004-03-01T17:09:19-08:00 (21 years, 3 months ago) by Douglas Thrift
File size: 1030 byte(s)
Log Message:
Die!

File Contents

# Content
1 // Host Update Sharp
2 //
3 // Douglas Thrift
4 //
5 // $Id$
6
7 using System;
8 using System.IO;
9 using System.Net;
10 using System.Text;
11
12 public class HostUpdateSharp
13 {
14 public static void Main(string[] args)
15 {
16 #if _uname_
17 String os = "FreeBSD 4.9-STABLE i386";
18 #else
19 OperatingSystem os = Environment.OSVersion;
20 #endif
21 StringBuilder host = new StringBuilder("host=" + Dns.GetHostName());
22 string url = "http://topsecret.douglasthrift.net/auth/hostupdate.cgi";
23
24 if (host.ToString().IndexOf('.') < 0)
25 {
26 host.Append(".local.douglasthrift.net");
27 }
28
29 Console.WriteLine(host);
30 Console.WriteLine(os);
31
32 HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
33
34 request.Accept = "text/plain";
35 request.ContentLength = host.Length;
36 request.ContentType = "application/x-www-form-urlencoded";
37 request.Credentials = new NetworkCredential("HostUpdate", "frell2003");
38 request.KeepAlive = false;
39 request.Method = "POST";
40 request.PreAuthenticate = true;
41 request.UserAgent = "Host Update Sharp/1.0 (" + os + ")";
42 }
43 }

Properties

Name Value
svn:eol-style native
svn:keywords Id