{"id":26982700,"url":"https://github.com/povzayd/ptrex","last_synced_at":"2025-04-03T16:34:35.081Z","repository":{"id":284118699,"uuid":"953475904","full_name":"povzayd/ptrex","owner":"povzayd","description":"PTRex is a Bash script for performing reverse DNS (PTR) lookups on single IPs, CIDR ranges, or IP lists. It uses getent hosts, supports parallel execution for speed, and filters results to show only successful lookups.","archived":false,"fork":false,"pushed_at":"2025-03-24T08:21:06.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-24T09:32:13.792Z","etag":null,"topics":["dnsx-alternate","info-gathering","osint","ptr","ptr-analysis","ptr-lookup","website-pentesting"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/povzayd.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2025-03-23T13:10:41.000Z","updated_at":"2025-03-24T08:21:09.000Z","dependencies_parsed_at":"2025-03-24T09:32:33.254Z","dependency_job_id":"a2747d10-6a96-4230-b9bb-999b40d3b329","html_url":"https://github.com/povzayd/ptrex","commit_stats":null,"previous_names":["povzayd/ptrex"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/povzayd%2Fptrex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/povzayd%2Fptrex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/povzayd%2Fptrex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/povzayd%2Fptrex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/povzayd","download_url":"https://codeload.github.com/povzayd/ptrex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247037636,"owners_count":20873196,"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":["dnsx-alternate","info-gathering","osint","ptr","ptr-analysis","ptr-lookup","website-pentesting"],"created_at":"2025-04-03T16:34:34.458Z","updated_at":"2025-04-03T16:34:35.069Z","avatar_url":"https://github.com/povzayd.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"🔍 PTRex 🦖 Reverse DNS Lookup Script\nThis Bash script performs reverse DNS (PTR) lookups on a given IP, CIDR range, or a list of IPs from a file. It efficiently resolves hostnames using `getent hosts`, tracks progress, and runs queries in parallel for speed.\n\n🚀 Features\n✅ Accepts a single IP, CIDR range, or file with multiple IPs\n✅ Uses `getent hosts` for reverse DNS (PTR) lookups 🔄\n✅ Parallel execution (up to 50 requests at a time) for faster results ⚡\n✅ Tracks progress dynamically 📊\n✅ Filters and outputs only successful PTR lookups (hostnames only) 🛠\n\n🚀 Installation\nEnsure you have `prips` `git` installed for CIDR expansion:\n\n```\nbash\nsudo apt install prips git\ngit clone https://github.com/povzayd/ptrex.git\ncd ptrex \u0026\u0026 chmod +x *\n./ptrex\n```\n\n\n🚀 Usage\nRun the script and enter an IP, CIDR range, or a file path when prompted:\n\n```\nbash\n./ptrex\n```\n🚀 Global Package \nMaking this shell script global will alow you to execute this in any directory\nFor that just move the file `ptrex` to `bin` or `sbin`\n```\nbash\nmv ptrex /usr/bin\nor\nmv ptrex /usr/sbin\n```\n*📌 Example Inputs*\n1️⃣ Single IP: `8.8.8.8`\n2️⃣ CIDR Range: `192.168.1.0/24`\n3️⃣ File with IPs: `/path/to/ips.txt`\n\n*📜 Output Example*\n```\n[+] Processing IPs from file: ips.txt\n[+] Requests made: 12 / 100\n[+] Completed!\n✅ -\u003e example.com\n✅ -\u003e mail.google.com\n✅ -\u003e somehost.net\n```\n\n🔎 How It Works\n1️⃣ User Input\n\n- Prompts user to enter an IP, CIDR, or file path\n- Determines input type (single IP, CIDR, or file)\n\n2️⃣ IP Expansion (if CIDR)\n\n- Uses `prips` to generate a list of IPs from the CIDR range\n\n3️⃣ Parallel Reverse DNS Lookups\n\n- Uses `getent hosts` to fetch PTR records 🕵️\n- Runs up to 50 parallel lookups using `xargs -P 50`\n- Displays live progress updates\n\n4️⃣ Output Processing\n\n- Saves only successful hostname lookups 🎯\n- Hides IPs, displaying hostnames only\n\n5️⃣ Cleanup\n\n- Deletes temporary files after execution 🧹\n\n⚠️ Notes\n⚡ Only successful lookups (resolved hostnames) are displayed\n⚡ Parallel execution speeds up large queries\n⚡ If `prips` is missing, CIDR expansion will fail\n\n🔮 Future Improvements\n✨ Add logging for debugging\n✨ Implement timeouts for slow DNS responses\n✨ Support custom concurrency levels\n\nThis script is great for security assessments, network mapping, and passive reconnaissance when identifying hostnames associated with an IP range. 🌍\n---\n*PLEASE NOTE THAT THE SCRIPT GIVES OUTPUT IN THE FORM OF\n```\n-\u003e some.pointer.record.abc.com\n```\nIF YOU WANT TO REMOVE IT FROM YOUR TXT FILE JUST USE THE COMMAND \n```\nsed -i 's/-\u003e//g' file.txt\n```\nTHIS WILL REMOVE `-\u003e` FROM EACH \u0026 EVERY LINE OF YOUR FILE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpovzayd%2Fptrex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpovzayd%2Fptrex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpovzayd%2Fptrex/lists"}