项目作者: decuant

项目描述 :
polling dns
高级语言: Lua
项目地址: git://github.com/decuant/pDNS.git
创建时间: 2021-07-16T21:11:52Z
项目社区:https://github.com/decuant/pDNS

开源协议:

下载


pDNS

Polling DNS - rel. 0.0.6 (2021/08/12)

A list of DNS servers is presented to the user. Each server can be enabled or disabled. Running the backtask, enabled servers will be questioned about a URL. Response is in the log file.

The application runs with Lua 5.4.3, wxWidgets 3.1.5, wxLua 3.1.0.0 and luasocket 3.0-rc1.

Log files use some UTF8 characters.

Modules

.1 convert.lua

Download nameservers.csv from https://public-dns.info/.

Run this script to have the csv file converted to a Lua table, which can be the new servers’ list.

A list of country codes, grouped by continent, can be used to filter out rows of no interest.

There’s no settings file.

.2 main.lua

Starting the application with the predefined file.

Main dialog inactive

Starting the backtask to poll each enabled server.

Main dialog active

It runs a backtask on the main window timer and tests a batch of servers per tick. UDP is not supported by wxLua, the program uses luasocket (on Windows the required filename is socket.dll). This program is not intended for speed benchmarking, but to question servers.

The pre-configured data/servers.lua is the servers’ address list in Lua table format.

File data/samplehosts.lua holds a Lua table of Hosts for Sampling, assigned circularly to each new server, thus to make all servers target the same host provide only that name in the list. Hostnames can be reassigned randomly via menu.

For the time being DNS servers are questioned only with a TYPE 1 <hostname>. Response and analisys of the response are recorded in the log log/protocol.log.

When purging servers note that a server with 2 addresses having different responding status is a logical failure.

The application does not enforce to save the servers’ file if modified.

With the backtask enabled, if the application is idling then a scheduler timer is started. When the timer fires then the scheduling routine is called. In this implementation is hard coded.

File user.lua is a container for plugin functions, it can be modified and reloaded at run time.

The status bar shows counters for: Servers, Enabled, Responding, Not Responding (of which the first 2 are servers and the last 2 are addresses).

For both Filter and Find functions use ; for multi-keys in logical OR (as (IT);(FR)).

Response

This is a typical response.

  1. 05197: Hostname: tineye.com
  2. 05198:
  3. 05199: ----- [ Response frame ] -----
  4. 00000000 0B 52 81 80 00 01 00 03 00 02 00 0C 06 74 69 6E .R.?.........tin
  5. 00000010 65 79 65 03 63 6F 6D 00 00 01 00 01 C0 0C 00 01 eye.com.....?...
  6. 00000020 00 01 00 00 01 2C 00 04 68 16 34 8E C0 0C 00 01 .....,..h.4??...
  7. 00000030 00 01 00 00 01 2C 00 04 68 16 35 8E C0 0C 00 01 .....,..h.5??...
  8. 00000040 00 01 00 00 01 2C 00 04 AC 43 15 EE C0 0C 00 02 .....,..?C.?...
  9. 00000050 00 01 00 00 A3 43 00 15 04 65 6D 6D 61 02 6E 73 ....?C...emma.ns
  10. 00000060 0A 63 6C 6F 75 64 66 6C 61 72 65 C0 13 C0 0C 00 .cloudflare?.?..
  11. 00000070 02 00 01 00 00 A3 43 00 06 03 73 69 64 C0 5D C0 .....?C...sid?]?
  12. 00000080 79 00 01 00 01 00 00 F4 E9 00 04 AC 40 21 8F C0 y......?..?@!.?
  13. 00000090 79 00 01 00 01 00 00 F4 E9 00 04 AD F5 3B 8F C0 y......?...?;.?
  14. 000000A0 79 00 01 00 01 00 00 F4 E9 00 04 6C A2 C1 8F C0 y......?..l??.?
  15. 000000B0 58 00 01 00 01 00 01 14 19 00 04 AC 40 20 70 C0 X..........?@ p?
  16. 000000C0 58 00 01 00 01 00 01 14 19 00 04 AD F5 3A 70 C0 X...........?:p?
  17. 000000D0 58 00 01 00 01 00 01 14 19 00 04 6C A2 C0 70 C0 X..........l??p?
  18. 000000E0 79 00 1C 00 01 00 01 19 C4 00 10 2A 06 98 C1 00 y.......?..*.??.
  19. 000000F0 50 00 00 00 00 00 00 AC 40 21 8F C0 79 00 1C 00 P......?@!.?y...
  20. 00000100 01 00 01 19 C4 00 10 26 06 47 00 00 58 00 00 00 ....?..&.G..X...
  21. 00000110 00 00 00 AD F5 3B 8F C0 79 00 1C 00 01 00 01 19 ....?;.?y.......
  22. 00000120 C4 00 10 28 03 F8 00 00 50 00 00 00 00 00 00 6C ?..(.?..P......l
  23. 00000130 A2 C1 8F C0 58 00 1C 00 01 00 01 47 0A 00 10 28 ??.?X......G...(
  24. 00000140 03 F8 00 00 50 00 00 00 00 00 00 6C A2 C0 70 C0 .?..P......l??p?
  25. 00000150 58 00 1C 00 01 00 01 47 0A 00 10 2A 06 98 C1 00 X......G...*.??.
  26. 00000160 50 00 00 00 00 00 00 AC 40 20 70 C0 58 00 1C 00 P......?@ p?X...
  27. 00000170 01 00 01 47 0A 00 10 26 06 47 00 00 50 00 00 00 ...G...&.G..P...
  28. 00000180 00 00 00 AD F5 3A 70 ....?:p
  29. 05200:
  30. 05201: Message Header:
  31. 05202:
  32. 05203: Recursion desired = 1
  33. 05204: Truncation flag = 0
  34. 05205: Authoritative answer flag = 0
  35. 05206: Opcode = 0
  36. 05207: Query/Response flag = 1
  37. 05208: Return code = 0
  38. 05209: Recursion available = 1
  39. 05210: Questions count = 1
  40. 05211: Answers count = 3
  41. 05212: Authoritative servers count = 2
  42. 05213: Additional records count = 12
  43. 05214: URL requested = tineye.com
  44. 05215: Type of query (req) = 1
  45. 05216: Class (protocol) (req) = 1
  46. 05217:
  47. 05218: Answers:
  48. 05219:
  49. 05220: Pointer value = 0x0c
  50. 05221: Type of query (ans) = 1
  51. 05222: Class (protocol) (ans) = 1
  52. 05223: Time to live = 300
  53. 05224: Record lenght = 4
  54. 05225: Assigned Ip address = 104.22.52.142
  55. 05226:
  56. 05227: Pointer value = 0x0c
  57. 05228: Type of query (ans) = 1
  58. 05229: Class (protocol) (ans) = 1
  59. 05230: Time to live = 300
  60. 05231: Record lenght = 4
  61. 05232: Assigned Ip address = 104.22.53.142
  62. 05233:
  63. 05234: Pointer value = 0x0c
  64. 05235: Type of query (ans) = 1
  65. 05236: Class (protocol) (ans) = 1
  66. 05237: Time to live = 300
  67. 05238: Record lenght = 4
  68. 05239: Assigned Ip address = 172.67.21.238
  69. 05240:
  70. 05241:
  71. 05242: Authoritatives:
  72. 05243:
  73. 05244: Pointer value = 0x0c
  74. 05245: Type of query (ans) = 2
  75. 05246: Class (protocol) (ans) = 1
  76. 05247: Time to live = 41795
  77. 05248: Record lenght = 21
  78. 05249: Alias = emma.ns.cloudflare.com
  79. 05250:
  80. 05251: Pointer value = 0x0c
  81. 05252: Type of query (ans) = 2
  82. 05253: Class (protocol) (ans) = 1
  83. 05254: Time to live = 41795
  84. 05255: Record lenght = 6
  85. 05256: Alias = sid.ns.cloudflare.com

The server replied at the specified ip address, but the reply is a DNS error code.

  1. 01930: Return code failure: The specified name does not exist in the domain
  2. 01943: Return code failure: The server has failed internally
  3. 02543: Return code failure: For policy the server refused to answer

Hits & Failures counters

A basic count of ip address hits is enabled in code at the protocol level. It is dumped into the data folder and can grow big. Some hosts never change ip address, while others change it every few seconds.

This is an example of the hits table, grouped by hostname.

  1. local _hittable =
  2. {
  3. ["www.wordreference.com"] =
  4. {
  5. ["138.201.122.174"] = 12,
  6. ["23.111.171.90"] = 3,
  7. ["195.201.57.207"] = 8,
  8. },
  9. ["fixounet.free.fr"] =
  10. {
  11. ["212.27.63.105"] = 29,
  12. },
  13. ["news.ycombinator.com"] =
  14. {
  15. ["209.216.230.240"] = 17,
  16. },
  17. ["observablehq.com"] =
  18. {
  19. ["104.22.20.220"] = 22,
  20. ["172.67.37.221"] = 22,
  21. ["104.22.21.220"] = 22,
  22. },
  23. ["www.opensubtitles.org"] =
  24. {
  25. ["104.26.8.126"] = 18,
  26. ["172.67.72.143"] = 18,
  27. ["104.26.9.126"] = 18,
  28. },
  29. ["www.barbarianfc.co.uk"] =
  30. {
  31. ["52.17.214.161"] = 4,
  32. },
  33. ...

The third address looks a bluff. The fourth useless.

  1. ["hostwinds.com"] =
  2. {
  3. ["104.18.16.143"] = 590,
  4. ["104.18.17.143"] = 590,
  5. ["162.241.226.169"] = 1,
  6. ["127.0.0.1"] = 1,
  7. },

A similar list traces the number of times a server’ s address has failed responding. This file is used at start up to blank addresses in the servers’ list.

This is an example of the failures table, grouped by company.

  1. local _hittable =
  2. {
  3. ["JSC Kazakhtelecom - Almaty (KZ)"] =
  4. {
  5. ["92.46.44.18"] = 5,
  6. ["178.88.161.200"] = 5,
  7. },
  8. ["Evolutio Cloud Enabler S.A. Unipersonal - (ES)"] =
  9. {
  10. ["212.66.160.2"] = 9,
  11. ["212.163.193.3"] = 9,
  12. },
  13. ["Regional TeleSystems Ltd. - Ryazan (RU)"] =
  14. {
  15. ["193.9.242.78"] = 15,
  16. ["193.9.240.62"] = 15,
  17. },

List of changes

Rel. 0.0.6

  • Modified sorting to use the IP4 address as number, not text.
  • Added scheduler to repeat a task when in idle and after timer.
  • Added menu entry to assign random hosts to servers.

Rel. 0.0.5

  • Flush all open log streams at close.
  • Protocol parsing at authoritatives.
  • Added sorting by column.
  • Call convert.lua to make a fresh servers’ list in user menu.
  • Save last used find/filter text in .ini file.
  • Reworked the menus.
  • Added filter/find text function.
  • Filter servers’ list using the failing list.
  • Dump list of failing servers’ addresses (with enable/disable).
  • Dump protocol statistics (with enable/disable).
  • Added extra check in convert.lua.
  • Added counters in the status bar.
  • Load set of functions in external file as menu.
  • Fuzzy toggle the enable flag for each server in list.
  • Scramble servers’ list.
  • Minimized grid resfresh calls.

Rel. 0.0.4

  • Test for valid IP4 address.
  • Modified the window’s ini file to support control over the font to use.
  • Added deletion of selected servers.
  • Added possibility to purge from the servers’ list either the verified or the failing ones.

Author

decuant

License

The standard MIT license applies.