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

feat(hooks): explicit output type yield in static hooks #439

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions secator/tasks/cariddi.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class cariddi(HttpCrawler):
@staticmethod
def on_json_loaded(self, item):
url_item = {k: v for k, v in item.items() if k != 'matches'}
yield Url(**url_item)
url = url_item[URL]
yield url_item
matches = item.get('matches', {})
params = matches.get('parameters', [])
errors = matches.get('errors', [])
Expand All @@ -62,25 +62,24 @@ def on_json_loaded(self, item):
param_name = param['name']
for attack in param['attacks']:
extra_data = {'param': param_name, 'source': 'url'}
parameter = {
'name': attack + ' param',
'match': url,
'extra_data': extra_data
}
yield parameter
yield Tag(
name=f'{attack} param',
match=url,
extra_data=extra_data
)

for error in errors:
match = error['match']
match = (match[:1000] + '...TRUNCATED') if len(match) > 1000 else match # truncate as this can be a very long match
error['extra_data'] = {'error': match, 'source': 'body'}
error['match'] = url
yield error
yield Tag(**error)

for secret in secrets:
match = secret['match']
secret['extra_data'] = {'secret': match, 'source': 'body'}
secret['match'] = url
yield secret
yield Tag(**secret)

for info in infos:
CARIDDI_IGNORE_LIST = ['BTC address'] # TODO: make this a config option
Expand All @@ -89,4 +88,4 @@ def on_json_loaded(self, item):
match = info['match']
info['extra_data'] = {'info': match, 'source': 'body'}
info['match'] = url
yield info
yield Tag(**info)
Loading