Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip writing empty hosts to output file #27

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

sshbounty
Copy link

Description

This PR fixes an issue where empty lines were being written to the output file when using the -o flag. If there is no result returned for the current domain it writes empty line to the output.

Changes Made

  • Added checks in writePlainHost and writePlainHostIP to skip empty hosts
  • Prevents writing empty lines to output files
➜  urlfinder git:(dev) ✗ urlfinder -d list -o lists.txt

  __  _____  __   _____         __
 / / / / _ \/ /  / __(_)__  ___/ /__ ____
/ /_/ / , _/ /__/ _// / _ \/ _  / -_) __/
\____/_/|_/____/_/ /_/_//_/\_,_/\__/_/

                projectdiscovery.io

[INF] Current urlfinder version v0.0.1 (latest)
[INF] Loading provider config from /home/hisham/.config/urlfinder/provider-config.yaml
[INF] Enumerating urls for example.hackerone.com

[INF] Found 1 urls for example.hackerone.com in 1 second 716 milliseconds
[INF] Enumerating urls for nodomain.hackerone.com

[INF] Found 1 urls for nodomain.hackerone.com in 876 milliseconds 382 microseconds
[INF] Enumerating urls for api.hackerone.com
https://api.hackerone.com/assets/images/home-active-icon-4456efcf.svg
https://api.hackerone.com/assets/images/reference-active-icon-0c7da4a9.svg
https://api.hackerone.com/main-4d664bd1abb44a687600.js
https://api.hackerone.com/main-e8d9a7ae1d6552d8246b.css
https://api.hackerone.com/assets/images/getting-started-icon-8e568c9c.svg
https://api.hackerone.com/assets/fonts/effra-medium-d33322a0.woff
https://api.hackerone.com/assets/fonts/slate-7b7da4fe.ttf?-syv14m
https://api.hackerone.com/customer-customer-reference
https://api.hackerone.com/customer-resources/
https://api.hackerone.com/getting-started-hacker-api/
https://api.hackerone.com/sitemap.xml
https://api.hackerone.com/use-cases/
http://api.hackerone.com/.well-known/dnt-policy.txt
https://api.hackerone.com/assets/fonts/roboto-mono-regular-5d9f74e5.ttf
https://api.hackerone.com/assets/fonts/slate-cfc9d06b.eot?-syv14m
https://api.hackerone.com/assets/images/logo-b8de4ab7.svg
https://api.hackerone.com/assets/images/navbar-cad8cdcb.png
https://api.hackerone.com/assets/stylesheets/screen-fb7fa378.css
https://api.hackerone.com/docs/v1
https://api.hackerone.com/getting-started/
http://api.hackerone.com/.well-known/openid-configuration
http://api.hackerone.com/robots.txt
http://api.hackerone.com/v1/reports
https://api.hackerone.com/main-c3878c632ee65dcdc7a8.js
https://api.hackerone.com/assets/fonts/slate-e55b8307.svg?-syv14m
https://api.hackerone.com/favicon.ico
https://api.hackerone.com/main-5bd806ac677ea57eea5b.js
https://api.hackerone.com/main-96b79e99b3217578218b.css
https://api.hackerone.com/v1
http://api.hackerone.com/ads.txt
https://api.hackerone.com/assets/fonts/effra-regular-7ebee9e1.woff
https://api.hackerone.com/assets/javascripts/google_analytics-d319b720.js
https://api.hackerone.com/main-4d664bd1abb44a687600.css
https://api.hackerone.com/main-bf0e790bffe7dc2e208b.css
https://api.hackerone.com/reference/
http://api.hackerone.com/.well-known/assetlinks.json
http://api.hackerone.com/.well-known/security.txt
https://api.hackerone.com/assets/fonts/slate-cfc9d06b.eot
https://api.hackerone.com/assets/images/home-icon-e212aeb8.svg
https://api.hackerone.com/assets/images/rss-feed-icon-565f423d.svg
https://api.hackerone.com/assets/stylesheets/screen-bee96dd6.css

https://api.hackerone.com/assets/stylesheets/screen-0540c09c.css
https://api.hackerone.com/assets/stylesheets/screen-176a6d12.css
https://api.hackerone.com/main-71b11a887fec26ab0ef8.css
https://api.hackerone.com/assets/stylesheets/print-c3fe4d09.css
https://api.hackerone.com/assets/fonts/slate-33847ce5.woff?-syv14m
https://api.hackerone.com/assets/images/reference-icon-740a9c21.svg
https://api.hackerone.com/assets/images/rss-feed-active-icon-54a5ccb1.svg
http://api.hackerone.com/.well-known/ai-plugin.json
http://api.hackerone.com/.well-known/nodeinfo
http://api.hackerone.com/.well-known/trust.txt
https://api.hackerone.com/core-resources/
https://api.hackerone.com/main-71b11a887fec26ab0ef8.js
https://api.hackerone.com/
https://api.hackerone.com/assets/images/webhooks-icon-b2932429.svg
https://api.hackerone.com/main-96b79e99b3217578218b.js
http://api.hackerone.com/v1/reports?filter
http://api.hackerone.com/.well-known/gpc.json
https://api.hackerone.com/assets/images/favicon.ico
https://api.hackerone.com/assets/images/resources-icon-eb571889.svg
https://api.hackerone.com/assets/images/webhooks-active-icon-6fb884a3.svg
https://api.hackerone.com/assets/javascripts/all-3193d32d.js
https://api.hackerone.com/customer-reference/
https://api.hackerone.com/main-5bd806ac677ea57eea5b.css
http://api.hackerone.com/app-ads.txt
https://api.hackerone.com/assets/images/resources-active-icon-8f1980c4.svg
https://api.hackerone.com/assets/images/use-cases-active-icon-f422508f.svg
https://api.hackerone.com/assets/javascripts/all-55afcf84.js
https://api.hackerone.com/webhooks
https://api.hackerone.com/assets/images/getting-started-active-icon-8c622cd1.svg
https://api.hackerone.com/main-e8d9a7ae1d6552d8246b.js
https://api.hackerone.com/assets/stylesheets/print-3db2b047.css
https://api.hackerone.com/assets/stylesheets/screen-4e8bb72e.css
https://api.hackerone.com/hacker-resources/
https://api.hackerone.com/main-c3878c632ee65dcdc7a8.css
https://api.hackerone.com/assets/images/use-cases-icon-27cdd84f.svg
https://api.hackerone.com/changelog.rss
https://api.hackerone.com/assets/javascripts/all-cc9d7a50.js
https://api.hackerone.com/assets/stylesheets/print-2da1ecc5.css
https://api.hackerone.com/assets/stylesheets/screen-9606ca24.css
https://api.hackerone.com/hacker-reference/
https://api.hackerone.com/assets/fonts/slate-33847ce5.woff2?-syv14m
[INF] Found 83 urls for api.hackerone.com in 1 second 725 milliseconds
[INF] Enumerating urls for noexist.hackerone.com

[INF] Found 1 urls for noexist.hackerone.com in 1 second 302 milliseconds
➜  urlfinder git:(dev) ✗ cat list
example.hackerone.com
nodomain.hackerone.com
api.hackerone.com
noexist.hackerone.com

@@ -87,6 +87,10 @@ func writePlainHostIP(_ string, results map[string]resolve.Result, writer io.Wri
sb := &strings.Builder{}

for _, result := range results {
if result.Host == "" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dogancanbakir
Copy link
Member

@sshbounty Thanks for the PR -left a comment for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants