{"id":13340978,"url":"https://github.com/turytsia/university-isa-DnsResolver","last_synced_at":"2025-03-11T19:31:02.079Z","repository":{"id":208976806,"uuid":"695329698","full_name":"turytsia/university-isa-DnsResolver","owner":"turytsia","description":"A simple DNS resolver, implemented in C, that performs the task of translating human-readable domain names into IP addresses.  It supports such query types as A, AAAA, PTR. And response type A, AAAA, PTR, CNAME and SOA.","archived":false,"fork":false,"pushed_at":"2023-11-17T10:39:23.000Z","size":470,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-24T06:30:49.028Z","etag":null,"topics":["dns","dns-resolver","ipv4","ipv6","vut"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/turytsia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-22T21:47:29.000Z","updated_at":"2024-08-21T11:57:02.000Z","dependencies_parsed_at":"2023-11-24T10:42:15.186Z","dependency_job_id":"838646f4-9237-4083-bdad-ba6fd8f80c0f","html_url":"https://github.com/turytsia/university-isa-DnsResolver","commit_stats":null,"previous_names":["turytsia/vut-dns-resolver","turytsia/university-isa-dnsresolver"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turytsia%2Funiversity-isa-DnsResolver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turytsia%2Funiversity-isa-DnsResolver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turytsia%2Funiversity-isa-DnsResolver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/turytsia%2Funiversity-isa-DnsResolver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/turytsia","download_url":"https://codeload.github.com/turytsia/university-isa-DnsResolver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243098703,"owners_count":20236076,"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":["dns","dns-resolver","ipv4","ipv6","vut"],"created_at":"2024-07-29T19:25:07.308Z","updated_at":"2025-03-11T19:31:02.074Z","avatar_url":"https://github.com/turytsia.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DNS Resolver\n\n**Author**: Oleksandr Turytsia \u003cbr /\u003e\n**Created at**: 11/17/2023\n\nA simple DNS resolver, implemented in C, that performs the task of translating human-readable domain names into IP addresses.\n\nIt supports such query types as `A`, `AAAA`, `PTR`. And response type `A`, `AAAA`, `PTR`, `CNAME` and `SOA`.\n\n## Files\nSource code for this project is located at `src/` folder. I should contain following files:\n- args.c = Source file, that contains functions to parse input arguments\n- args.h = Header file for `args.c`\n- dns.c = Source file of a program. Main is located here.\n- dns.h = Header file for `dns.h`\n- error.c = Source file, that contains error handling function\n- error.h = Header file for `error.c`\n- libs.h = Header file with all the libs\n- utils.c = Source file, that contains common functions for multiple source files\n- utils.h = Header file for `utils.c`\n \n## Prerequisites\nBefore using the DNS resolver, make sure you have the following prerequisites installed:\n- GCC (Testing was done for the version 10.5.0)\n- Unix-based system (Testing was done on FreeBSD)\n\n## Installation\nAll the source code is located at src folder. Run following command in order to compile the project:\n```bash\nmake\n```\n\nAfter the project is compiled, you can run following command to run a quick test:\n```bash\n./dns -r -s dns.google www.github.com\n```\n\n## Usage \n```bash\n./dns [−r] [−x] [−h] [−t] [−6] −s server [−p port] address\n```\n- `-r`: Recursion Desired (Recursion Desired = 1), otherwise no recursion.\n- `-6`: Query type AAAA instead of the default A.\n- `-x`: Reverse query instead of direct query. Note, user can specify here ipv6 or ipv4 address without specifying `-6` option to make a reverse query.\n- `-s server`: IP address or domain name of the server to which the query should be sent. Note, user can specify `server` by its domain or ipv6 address.\n- `-p port`: The port number to send the query to, default is set to 53.\n- `-h`: Display help info.\n- `-t`: Enables testing mode (TTL is set to 0).\n- `address`: The address to be queried\n\n## Output\nThe program will construct dns query based on user’s input and send packet over udp to a specified dns server. Dns response may have following format:\n\n```bash\nAuthoritative: Yes/No, Recursive: Yes/No, Truncated: Yes/No\nQuestion section (1)\n[ADDRESS], [QTYPE], [QCLASS]\nAnswer section (N)\n[ADDRESS], [TYPE], [CLASS], [TTL], [RDATA]\n...\nAuthority section (N)\n[ADDRESS], [TYPE], [CLASS], [TTL], [RDATA]\n...\nAdditional section (N)\n[ ADDRESS ], [TYPE], [CLASS], [TTL], [RDATA]\n...\n```\n\nFirst line displays response header flags (RD, TC, AA) followed by request response (RR) sections\n\n## Error codes\nDNS resolver is also suitable to be used as a part of a script, because it provides distinctive exit error codes, which can help potential programmers validate results\n\n- Arguments parser error codes:\n    - 1 - Unknown option\n    - 2 - Invalid port\n    - 3 - Port is missing\n    - 4 - Source address is missing\n    - 5 - Target address is missing\n    - 6 - Option already specified\n- Sending query error codes:\n    - 10 - Socket creation error\n    - 11 - Sending query error\n    - 12 - Timeout\n    - 13 - Recieving response error\n- DNS header error codes (By subtracting 30 it is possible to get error\ncodes that correspond RFC 1035 documentation):\n    - 31 - Format error\n    - 32 - Server fail\n    - 33 - Name error\n    - 34 - Not implemented\n    - 35 - Refused\n- Other errors:\n    - 20 - perror code\n    - 21 - other errors\n    - 22 - Family is not supported\n\n## Bibliography\n\n[RFC 1035](https://datatracker.ietf.org/doc/html/rfc1035)\n[RFC 3596](https://datatracker.ietf.org/doc/html/rfc3596)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fturytsia%2Funiversity-isa-DnsResolver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fturytsia%2Funiversity-isa-DnsResolver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fturytsia%2Funiversity-isa-DnsResolver/lists"}