{"id":19929094,"url":"https://github.com/thescriptguy/dns-performance-test","last_synced_at":"2025-05-03T10:31:26.675Z","repository":{"id":134310188,"uuid":"358472145","full_name":"TheScriptGuy/dns-performance-test","owner":"TheScriptGuy","description":"Python script to do performance tests for DNS queries","archived":false,"fork":false,"pushed_at":"2022-12-19T00:44:27.000Z","size":121,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T14:22:56.267Z","etag":null,"topics":["a","cname","dns","json","mx","nameserver","performance","python","python3","query","scripting","test","time","txt"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheScriptGuy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-16T04:10:53.000Z","updated_at":"2024-06-13T14:52:34.000Z","dependencies_parsed_at":"2023-07-25T15:15:25.532Z","dependency_job_id":null,"html_url":"https://github.com/TheScriptGuy/dns-performance-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheScriptGuy%2Fdns-performance-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheScriptGuy%2Fdns-performance-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheScriptGuy%2Fdns-performance-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheScriptGuy%2Fdns-performance-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheScriptGuy","download_url":"https://codeload.github.com/TheScriptGuy/dns-performance-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252178816,"owners_count":21707074,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a","cname","dns","json","mx","nameserver","performance","python","python3","query","scripting","test","time","txt"],"created_at":"2024-11-12T22:41:51.436Z","updated_at":"2025-05-03T10:31:26.669Z","avatar_url":"https://github.com/TheScriptGuy.png","language":"Python","readme":"# dns-performance-test\n\nThis script will query DNS servers with a provided query list and measure the response time.\n\n## Device Identification\n\nIn order to track multiple results from different hosts, the hostname and a unique ID is gathered from each host where the script runs.\n\nFor the UUID, when the script runs for it's initial attempt, it'll try and see if there's a uuid.cfg file. \n* If there is a uuid.cfg file, it'll read the contents and use that for identification.\n* if there is not a uuid.cfg file, it'll create a new uuid and write that to uuid.cfg.\n\n## UUID\nTo read the current UUID for the device:\n```bash\npython3 dns-resolution-test.py --getUuid\n```\n\nTo delete the UUID, ether remove the uuid.cfg file, or run the command:\n```bash\npython3 dns-resolution-test.py --deleteUuid\n```\n\nTo renew/reset the UUID:\n```bash\npython3 dns-resolution-test.py --renewUuid\n```\n\n## Tags\n\nIf you want to tag your results for aggregating data across multiple devices, do the following:\n```bash\npython3 dns-resolution-test.py --setTag \u003cTAGNAME\u003e\n```\n\nIf there's no tag.cfg file, then deviceTag in the output.json file is \"\".\n\nIf you want to remove the tag, either remove the tag.cfg file or:\n```bash\npython3 dns-resolution-test.py --deleteTag\n```\n\nTo display the current tag:\n```bash\npython3 dns-resolution-test.py --getTag\n```\n\n## Reference files\n\nBy default, it'll read the inputs from filenames:\n- nameservers.txt - list of DNS nameservers to query\n- queries.txt - list of queries to perform on the DNS nameservers.\n\n**It will also by default not create any output (file, stdout, other).**\n\nThe queries file will accept entries in the following formats:\n```\ntest.com\n123.123.123.123,ptr\nabc.com,a\ncnn.com,mx\ngoogle.com,aaaa\n```\n\nIf an entry has an incorrect DNS query type, for example - referencing 'aaa' (invalid) instead of 'aaaa' (valid IPv6 query type), the program will not stop, but will report an error and continue to the next entry.\n\n## Arguments\n\nIf you want output there are some options available (in any combination):\n```\n  --ifname IFNAME      List of nameserver IP addresses file, each entry on a new line. This can be a URL as well.\n  --ifquery IFQUERY    List of queries file to be performed, each entry on a new line. This can be a URL as well.\n  --ofresults          JSON results output file (uuid,tag,script start time, script end time, results)\n  --jsonstdout         print results to stdout\n  --displayResponses   Display formatted results\n  --verbose            Displays the response times of all the tests.\n  --setTag SETTAG      Set the tag for the query results. Creates tag.cfg file with tag.\n  --deleteTag          Delete the tag file - tag.cfg\n  --getTag             Get the tag from tag.cfg file\n  --renewUuid          Renew the UUID value.\n  --getUuid            Get the UUID value from uuid.cfg file.\n  --deleteUuid         Remove the UUID value. Caution: when script runs again a new UUID will be generated.\n  --httpPOST HTTPPOST  Upload the JSON results to the URL\n```\n\n\n## JSON Sample format\n\n```json\n{\n  \"deviceUuid\": \"\u003cUUID\u003e\",\n  \"hostName\": \"\u003cHOSTNAME\u003e\",\n  \"deviceTag\": \"\u003cDEVICETAG\u003e\",\n  \"scriptUTCStartTime\": \"\u003cScript start time in UTC Format\u003e\",\n  \"scriptUTCEndTime\": \"\u003cScript end time in UTC Format\u003e\",\n  \"dataFormatVersion\": 3,\n  \"queryResults\": {\n    \"dnsNameServerIP\": [\n      {\n        \"query\": {\n          \"queryType\": \"hostname.example\"\n        },\n        \"response\": [\n          \"\u003cIP1\u003e\"\n        ],\n        \"responseTime\": \"\u003cTime in Milliseconds for response\u003e\",\n        \"responseTTL\": \u003ctime_in_seconds_from_nameserver\u003e\n      },\n      {\n        \"query\": {\n          \"queryType\": \"hostname2.example2\"\n        },\n        \"response\": [\n          \"\u003cIP1\u003e\",\n          \"\u003cIP2\u003e\"\n        ],\n        \"responseTime\": \"\u003cTime in Millseconds for response\u003e\",\n        \"responseTTL\": \u003ctime_in_seconds_from_nameserver\u003e\n      },\n      {\n        \"query\": {\n          \"queryType\": \"hostname3.example3\"\n        },\n        \"response\": [\n          \"\u003cIP1\u003e\",\n          \"\u003cIP2\u003e\",\n          \"\u003cIP3\u003e\",\n          \"\u003cIP4\u003e\"\n        ],\n        \"responseTime\": \"\u003cTime in Millseconds for response\u003e\",\n        \"responseTTL\": \u003ctime_in_seconds_from_nameserver\u003e\n      }\n    ]\n  }\n}\n```\n\n## Actual Sample Result:\n\n```json\n{\n  \"deviceUuid\": \"c166d274-2fca-42c2-9a26-d1887ca97bb2\",\n  \"hostName\": \"myTestHost\",\n  \"deviceTag\": \"production\",\n  \"scriptStartTime\": \"2021-05-22 20:25:49.706083\",\n  \"scriptEndTime\": \"2021-05-22 20:25:49.748855\",\n  \"dataFormatVersion\": 3,\n  \"queryResults\": {\n    \"8.8.8.8\": [\n      {\n        \"query\": {\n          \"a\": \"test.com\"\n        },\n        \"response\": [\n          \"69.172.200.235\"\n        ],\n        \"responseTime\": \"7.1\",\n        \"responseTTL\": 311\n      },\n      {\n        \"query\": {\n          \"a\": \"google.com\"\n        },\n        \"response\": [\n          \"142.250.217.110\"\n        ],\n        \"responseTime\": \"13.3\",\n        \"responseTTL\": 3429\n      },\n      {\n        \"query\": {\n          \"a\": \"abc.com\"\n        },\n        \"response\": [\n          \"99.84.73.44\",\n          \"99.84.73.60\",\n          \"99.84.73.41\",\n          \"99.84.73.70\"\n        ],\n        \"responseTime\": \"21.8\",\n        \"responseTTL\": 151\n      },\n      {\n        \"query\": {\n          \"mx\": \"testdomain.com\"\n        },\n        \"response\": [\n          \"20 mail.testdomain.com.\",\n          \"20 mail2.testdomain.com.\",\n          \"30 mail3.testdomain.com.\"\n        ]   \n      }\n    ]\n  }\n}\n```\n\n\nFuture improvements:\n* default list of nameservers and queries to be included in bundle\n* ability to publish results to google sheets, ms excel online, etc.\n* show if the DNS lookup is a PASS/FAIL based on evaluating criteria.\n    * evaluation criteria:\n        * ALL responses must be the same\n        * ANY of the responses must be what we expect\n    * ability to set an evaluation file based on immediate results for comparison later.\n    * show current date, and delta compared to when initial evaluation file was created.\n* support for DNSSEC queries\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthescriptguy%2Fdns-performance-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthescriptguy%2Fdns-performance-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthescriptguy%2Fdns-performance-test/lists"}