Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alkorgun/blacksmith-2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'expansions/dns/code.py')
-rw-r--r--expansions/dns/code.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/expansions/dns/code.py b/expansions/dns/code.py
new file mode 100644
index 0000000..c9b27cb
--- /dev/null
+++ b/expansions/dns/code.py
@@ -0,0 +1,28 @@
+# coding: utf-8
+
+# BlackSmith mark.2
+# exp_name = "dns" # /code.py v.x1
+# Id: 34~1c
+# Code © (2012) by WitcherGeralt [alkorgun@gmail.com]
+
+class expansion_temp(expansion):
+
+ def __init__(self, name):
+ expansion.__init__(self, name)
+
+ import socket
+
+ def command_dns(self, stype, source, adress, disp):
+ if adress:
+ try:
+ name, alias, addrs = self.socket.gethostbyaddr(adress.encode("idna"))
+ except self.socket.error:
+ answer = AnsBase[7]
+ else:
+ addrs.insert(0, name)
+ answer = ", ".join(addrs)
+ else:
+ answer = AnsBase[1]
+ Answer(answer, stype, source, disp)
+
+ commands = ((command_dns, "dns", 1,),)