Package: doh-cli
doh-cliA simpleDNS over HTTPSclient for the command line.This is a simple DoH python client (RFC 8484, GET), which supportsplain(default) andjsonoutput.Installpip3installdoh-cliUpgradeor upgrade to latest version bypipinstall--upgradedoh-cliRequirementsIt's based & tested on Python 3.If you want to contribute, you can clone the repository and install all dependencies locally:pip3install.Usagedoh-clilibredns.grAHelpdoh-cli--helpSupported Resource RecordsAAAAACNAMEMXNSSOASPFSRVTXTCAADNSKEYDSSupported DoH ProvidersLibreDNSGoogleCloudflareQuad9CleanBrowsingCIRASecureDNSyou may also provide your own DoH server URLDoH Optionslibredns (default)libredns-ads (LibreDNS No-Trackers/Ads)googlecloudflarequad9cleanbrowsing (blocks access to adult, pornographic and explicit sites, also VPNs)cleanbrowsing-secure (blocks access to phishing, malware and malicious domains)cleanbrowsing-adult (blocks access to all adult, pornographic and explicit sites)cira (CIRA's Canadian Shield)cira-protect (Malware and phishing protection)cira-family (blocking pornographic content plus protected)securednssecuredns-ads (blockign ads, malware and phishing)Some ExamplesIPv4doh-clilibredns.grA116.202.176.26in jsondoh-clilibredns.grA--json[{"Query":"libredns.gr.","TTL":"366","RR":"A","Answer":"116.202.176.26"}]you can usejqto format, parse output:doh-clilibredns.grA--json|jq.[{"Query":"libredns.gr.","TTL":"54","RR":"A","Answer":"116.202.176.26"}]IPv6doh-cliexample.orgAAAA2606:2800:220:1:248:1893:25c8:1946doh-cliexample.orgAAAA--json|jq.[{"Query":"example.org.","TTL":"45832","RR":"AAAA","Answer":["2606:2800:220:1:248:1893:25c8:1946"]}]CNAMEdoh-cliwww.libredns.grCNAME--json|jq.[{"Query":"www.libredns.gr.","TTL":"600","RR":"CNAME","Answer":"libredns.gr."}]MXdoh-clilibreops.ccMX--json|jq.[{"Query":"libreops.cc.","TTL":"10794","RR":"MX","Answer":["10","spool.mail.gandi.net.","libreops.cc.","10794","IN","MX","50","fb.mail.gandi.net."]}]CAAdoh-clilibredns.grCAA--json[{"Query":"libredns.gr.","TTL":"590","RR":"CAA","Answer":["0","issue","\"letsencrypt.org\""]}]DNSKEYDNS Key record 	The key record used in DNSSEC. Uses the same format as the KEY record.doh-cliDNSKEYnasa.gov25638AwEAAd86yGbz2WUp4VqClb1svSW9oyx0CQqCCGebNIEEqbXsF5PtCz225RKL3cDrmPHIeSETR6iUvfPSDiKquYearoLFmPjU0q1AJJmrZIzl9rDgMx/c9OPJxBnhp196ntJEaGySgXSoaXQEdUpm8lZzhkjftTfCX9mwDY2abxa3Vq3t25638AwEAAa/Jh5zZ/apbhzIG6CEUT8LL+WNK+HuVLbFf/pxk5Q/Qmng08J1+24B5ObWK+lUNGHN/FYC0TVbbofeHHOLVS88CBmK9Zu5RWqDicYYKFu8vra+MXEcwLc6E0fTfR9I/OAIWF6GScPHnkq8GoK2qau8gSD96UsAw6mCsWEqdyqof25738AwEAAbo7ImTCXl2KuV8NK+0zEvLC+OrNM0/6rT/kKZncFc0CqIIQwZUJtdurpvi3mUFY0J6Pv394E2gu/OLOe+EcIRatjxSvKITBM+PJTJq0OtwsGtBQyu4uU8hS2SNEg1hEJVGHE5q5LWIAy01TBnibyGOyVJE4N3M50ezp4E7DqEYG6WkhZQxLDjn0T4exKPDqIkP+QUB6OwF2CWKtWtpPIpI1i9h9OgIWUfXb3uLEgcnJlAYYAf9Jw35hPPDoFP+Zi9fJ4mQ0olm8gj4668QZoCJ57MDr3p3Rntfw5Ca+AQVNwnaqcB7iUWHYPZP0KLk7V02NloWXpwNHOA8O1TsOYtc=DSDelegation signer 	The record used to identify the DNSSEC signing key of a delegated zonedoh-clinasa.govDS--output=json|jq.[{"Query":"nasa.gov.","TTL":"3588","RR":"DS","Answer":["41452","8","2","7490b7f47af44d4c0bed3a7a2fefeb50cf55e3209e5a82e30a44f9d4aa9ae688"]}][{"Query":"nasa.gov.","TTL":"3588","RR":"DS","Answer":["41452","8","1","83bb6c5ac559bbe1e8b17a98465145265a3cafc4"]}]DNSSECUsing--dnssecsets theEDNS DOflag. The response will then include the DNSSEC signature for the requested record set.doh-cliAnasa.gov--dnssec52.0.14.11623.22.39.1208260020210325164559202102231606096816nasa.gov.HqVx19SOdF4Mx2+UZl7rhecv99zJdj0786R7sAAXP2poG5QDa9zpYz7WXz/y2UtVHpMk+0gfb2SrxQ1p93+VWs0S2UxnwZQI8qtwuB6/9780LVLa8ZHEDVZzdO1NAAx1AfaaQ0FjoxErPipPBi4edvMSYjnvVhY+0baRH2i1syk=Plain Outputdoh-clilibredns.grA116.202.176.26verbosedoh-clilibredns.grA--verbose116.202.176.26
Verbose:https://doh.libredns.gr/dns-query?dns=lSIBAAABAAAAAAAACGxpYnJlZG5zAmdyAAABAAEdebugdoh-clitest.libredns.grA--debug116.202.176.26
Debug:id24169opcodeQUERY
rcodeNOERROR
flagsQRRDRA;QUESTION
test.libredns.gr.INA;ANSWER
test.libredns.gr.3600INA116.202.176.26;AUTHORITY
libredns.gr.1822INSOAns1.gandi.net.hostmaster.gandi.net.158281281410800360060480010800;ADDITIONALQuery timedoh-clitest.libredns.grA--time116.202.176.26
Querytime:531.764doh-clitest.libredns.gr--time--json|jq.[{"Query":"test.libredns.gr.","TTL":"3600","RR":"A","Answer":["116.202.176.26"]},{"Query Time":"476.537"}]Disclaimer: This value is related to the client request towards the DoH provider, not the actual dns response.Choose another DNS serverdoh-clilibredns.grA--dnscloudflare116.202.176.26or you can use LibreDNS Block Trackers endpoint:doh-cli--dnslibredns-adsanalytics.google.comA0.0.0.0or provide your own DoH url:doh-cli--urlhttps://doh.libredns.gr/dns-querywww.example.comA93.184.216.34Notice: This option (--url) overrides the --dns option.ChangelogThis document tracks all notable changes to doh-cli, introduced on each release.v0.7 - 2022-10-29Argument url is overwriting dns argument with it's default value (fix bug).v0.6 - 2021-03-25Add support to request DNSSEC signaturesSupport handling multiple answer sections in a responseUse itertools to append multiple dns answersSimplify doh-cli plain/json usageEnhance code readabilityMake doh-cli module more independentUpdate README accordinglyv0.5 - 2021-03-05Add support for DNSKEY and DS RRsUpdate README with new RR examplesFix output bug on multiple answersv0.4 - 2021-03-02Update Documentation NotesAdd custom DoH endpoint --url optionAdd version option to doh-cliAdd cleanbrowsing & securedns DoH EndpointsVerbose option returns the rest DoH requestShow multiple DNS answers when existUse base64url for dns request messageDNS response should have "application/dns-message" headersUsing RequestException instead of generic ExceptionSplit module for readability and modularityv0.3 - 2020-04-12Swapping positional arguments (domain, RR) if neededCheck Response Status in case of a Server ErrorSwitched default output to plainDebug, Verbose & Query Time values are now part of plain/json outputv0.2 - 2020-04-08Support custom DoH endpointsMore verbose debug optionAllow user to use any RR typeAdd CIRA providerNew time option for query response timeExpand documentationNew verbose option for displaying DNS wirev0.1 - 2019-12-24Initial release