-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathResolveDns.cs
62 lines (52 loc) · 1.23 KB
/
ResolveDns.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MikuBot.Modules;
using MikuBot.Commands;
using System.Net;
using System.Net.Sockets;
using System.IO;
namespace MikuBot.ExtraPlugins
{
public class Whois : MsgCommandModuleBase
{
public override string Name
{
get { return "Whois"; }
}
public override void HandleCommand(MsgCommand cmd, IBotContext bot)
{
if (!cmd.BotCommand.Is(Name) || !cmd.BotCommand.Params.HasParam(0))
return;
var url = cmd.BotCommand.Params[0];
using (var tcp = new TcpClient("whois.joker.com", 43))
{
Byte[] arrDomain = Encoding.ASCII.GetBytes(url.ToCharArray());
var s = tcp.GetStream();
using (var writer = new StreamWriter(s))
{
writer.WriteLine(url);
writer.Flush();
}
var sr = new StreamReader(s);
string strLine = null;
bool output = false;
var receiver = cmd.Reply(bot.Writer);
while (null != (strLine = sr.ReadLine()))
{
//if (output)
receiver.Notice(strLine);
/*if (!output) {
output = true;
}*/
}
}
}
public override InitialModuleStatus InitialStatus
{
// TODO: remove when finished
get { return InitialModuleStatus.NotLoaded; }
}
}
}