2016-11-26 11:11:27 +00:00
|
|
|
|
using DnsClient;
|
|
|
|
|
using System;
|
2016-12-09 14:41:35 +00:00
|
|
|
|
using System.Net.Sockets;
|
2016-11-26 11:11:27 +00:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace SMTPServer
|
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/*var request = new DnsQueryRequest();
|
|
|
|
|
var response = request.ResolveAsync("fabianstamm.de", DnDns.Enums.NsType.MX, DnDns.Enums.NsClass.ANY, System.Net.Sockets.ProtocolType.Tcp);
|
|
|
|
|
|
|
|
|
|
OutputResults(response);*/
|
2016-12-09 14:41:35 +00:00
|
|
|
|
TcpClient s = new TcpClient();
|
2016-11-27 17:38:47 +00:00
|
|
|
|
|
2016-11-28 16:26:04 +00:00
|
|
|
|
var l = new MailServer.SMTPServer.SmtpPortListener(25);
|
2016-11-26 11:11:27 +00:00
|
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static async void TestAsync()
|
|
|
|
|
{
|
|
|
|
|
var lookup = new LookupClient();
|
|
|
|
|
var result = await lookup.QueryAsync("fabianstamm.de.", QueryType.MX);
|
|
|
|
|
|
|
|
|
|
foreach (var r in result.AllRecords)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(r.RecordToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void Listener_OnConnected(object source, ConnectedEventArgs e)
|
|
|
|
|
{
|
2016-11-27 17:38:47 +00:00
|
|
|
|
//var session = new MTASession(e);
|
2016-11-26 11:11:27 +00:00
|
|
|
|
//throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
/*
|
|
|
|
|
private static async void OutputResults(Task<DnDns.Query.DnsQueryResponse> res)
|
|
|
|
|
{
|
|
|
|
|
OutputResults(await res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void OutputResults(DnDns.Query.DnsQueryResponse response)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine("Bytes received: " + response.BytesReceived);
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Name: " + response.Name);
|
|
|
|
|
Console.WriteLine("OpCode: " + response.NsClass);
|
|
|
|
|
Console.WriteLine("NsFlags: " + response.NsFlags);
|
|
|
|
|
Console.WriteLine("NsType: " + response.NsType);
|
|
|
|
|
Console.WriteLine("RCode: " + response.RCode);
|
|
|
|
|
Console.WriteLine("OpCode: " + response.OpCode);
|
|
|
|
|
|
|
|
|
|
// Enumerate the Answer Records
|
|
|
|
|
Console.WriteLine("Answers:");
|
|
|
|
|
foreach (IDnsRecord record in response.Answers)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(record.Answer);
|
|
|
|
|
Console.WriteLine(" |--- RDATA Field Length: " + record.DnsHeader.DataLength);
|
|
|
|
|
Console.WriteLine(" |--- Name: " + record.DnsHeader.Name);
|
|
|
|
|
Console.WriteLine(" |--- NS Class: " + record.DnsHeader.NsClass);
|
|
|
|
|
Console.WriteLine(" |--- NS Type: " + record.DnsHeader.NsType);
|
|
|
|
|
Console.WriteLine(" |--- TTL: " + record.DnsHeader.TimeToLive);
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (IDnsRecord record in response.AuthoritiveNameServers)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(record.Answer);
|
|
|
|
|
Console.WriteLine(" |--- RDATA Field Length: " + record.DnsHeader.DataLength);
|
|
|
|
|
Console.WriteLine(" |--- Name: " + record.DnsHeader.Name);
|
|
|
|
|
Console.WriteLine(" |--- NS Class: " + record.DnsHeader.NsClass);
|
|
|
|
|
Console.WriteLine(" |--- NS Type: " + record.DnsHeader.NsType);
|
|
|
|
|
Console.WriteLine(" |--- TTL: " + record.DnsHeader.TimeToLive);
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (IDnsRecord record in response.AdditionalRRecords)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(record.Answer);
|
|
|
|
|
Console.WriteLine(" |--- RDATA Field Length: " + record.DnsHeader.DataLength);
|
|
|
|
|
Console.WriteLine(" |--- Name: " + record.DnsHeader.Name);
|
|
|
|
|
Console.WriteLine(" |--- NS Class: " + record.DnsHeader.NsClass);
|
|
|
|
|
Console.WriteLine(" |--- NS Type: " + record.DnsHeader.NsType);
|
|
|
|
|
Console.WriteLine(" |--- TTL: " + record.DnsHeader.TimeToLive);
|
|
|
|
|
Console.WriteLine();
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
}
|