/////////////////////////////////////////////////////////////////////////////////////////
// A useless server to sit on port 1214 and wait for a connection, to fake the existance
// of Kazaa.
// I will attempt to make the client program realize it is fake, and not identify this
// server as Kazaa.
// Jim Peterson, 2006
/////////////////////////////////////////////////////////////////////////////////////////
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
public class FakeKazza
{
public static void Main()
{
String IP_Adress = "";
IPHostEntry localComputer = Dns.Resolve("localhost");
IPAddress[] localIP = localComputer.AddressList;
for (int i = 0; i < localIP.Length; i++) {
IP_Adress = IP_Adress + localIP[i];
}
while (true) {
try {
IPAddress ipAd = IPAddress.Parse(IP_Adress);
TcpListener listener1 = new TcpListener(ipAd, 1214);
listener1.Start();
Console.WriteLine("Fake Kazaa is running on portt 1214...");
Socket s = listener1.AcceptSocket();
Console.WriteLine("Connection accepted from this IP: " + s.RemoteEndPoint);
byte[] b = new byte[100];
int k = s.Receive(b);
Console.WriteLine("Recieved a bunch of byytes:");
for (int i = 0; i < k; i++) {
Console.Write(Convert.ToChar(b[i]));
}
ASCIIEncoding asen = new ASCIIEncoding();
// Only send these bytes if you want the scanner to identify that
// you are not Kazaa
s.Send(asen.GetBytes("OK, I recieved your bytes"));
Console.WriteLine("\nI sent the client aknowledgement");
s.Close();
listener1.Stop();
}
catch (Exception e) {
Console.WriteLine("Ah, poo, an error: " + e);
}
}
}
}