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

Add subwords capability to ffuf_shortnames #2237

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from

Conversation

liquidsec
Copy link
Collaborator

Also adds ignore_case option to ffuf (useful for IIS where case doesn't matter)

Subwords uses python nltk (natural language toolkit) to try and find smaller words at the beginning of shortnames. If it does, it sends the remainder off to the predictor. This works well because web developers have a habit of making lots of "VerbAction" type two-word file names.

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 92.22222% with 7 lines in your changes missing coverage. Please review.

Project coverage is 93%. Comparing base (703a313) to head (b756df2).
Report is 25 commits behind head on dev.

Files with missing lines Patch % Lines
bbot/core/helpers/web/web.py 70% 4 Missing ⚠️
bbot/modules/deadly/ffuf.py 75% 2 Missing ⚠️
bbot/modules/ffuf_shortnames.py 98% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             dev   #2237   +/-   ##
=====================================
- Coverage     93%     93%   -0%     
=====================================
  Files        378     378           
  Lines      29363   29443   +80     
=====================================
+ Hits       27155   27227   +72     
- Misses      2208    2216    +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


from bbot.modules.deadly.ffuf import ffuf


class ffuf_shortnames(ffuf):
watched_events = ["URL_HINT"]
produced_events = ["URL_UNVERIFIED"]
deps_pip = ["numpy"]
deps_pip = ["numpy", "nltk"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there an advantage to using nltk over the builtin subword helper?

Copy link
Collaborator Author

@liquidsec liquidsec Feb 10, 2025

Choose a reason for hiding this comment

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

mainly just the size of the wordlist, which is massive, and should be well maintained being part of nltk

Also the functionality of that helper doesn't quite match the use, that finds all the subwords (as a list), whereas this is just checking for prefixes

self.debug("NLTK words data already present")
except LookupError:
self.debug("NLTK words data not found, downloading")
nltk.download("words", download_dir=self.nltk_dir, quiet=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

self.helpers.wordlist("https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/packages/corpora/words.zip")

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