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 custom field #225

Merged
merged 12 commits into from
Jan 5, 2023
Merged

add custom field #225

merged 12 commits into from
Jan 5, 2023

Conversation

ShubhamRasal
Copy link
Contributor

@ShubhamRasal ShubhamRasal commented Dec 6, 2022

  • add custom field with regex to parse
  • create default custom field file
  • add flag to accept the custom field file
- name: title
  type: regex
  group: 1
  regex:
  - '(?im)<\s*title.*>(.*?)<\s*/\s*title>'
./katana -h flc
Katana is a fast crawler focused on execution in automation
pipelines offering both headless and non-headless crawling.

Usage:
  ./katana [flags]

Flags:
   -flc, -field-config string  path to custom field configuration file

eg

./katana -u https://projectdiscovery.io/#/  -f email -v  -d 2 -sf email

@ShubhamRasal ShubhamRasal self-assigned this Dec 6, 2022
@ShubhamRasal ShubhamRasal added the Status: Review Needed The issue has a PR attached to it which needs to be reviewed label Dec 6, 2022
@ShubhamRasal ShubhamRasal linked an issue Dec 6, 2022 that may be closed by this pull request
Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

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

For now, http headers are not accessible; similar to nuclei, part needs to be supported for field config.

part attribute can have 3 values, response which is default and have access to http response headers + body, header, and body as is additional options and can be used for specific needs.

- name: title
  type: regex
  part: body
  group: 1
  regex:
  - '(?im)<\s*title.*>(.*?)<\s*/\s*title>'

@ShubhamRasal let's not make any changes in JSON output, we will track it as a separate issue for changes in the JSON output.

@tarunKoyalwar tarunKoyalwar removed their request for review December 29, 2022 19:17
@ShubhamRasal
Copy link
Contributor Author

  • added support for part option
# field-config.yaml
- name: email
  type: regex
  part: response
  regex:
  - ([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)

- name: server
  type: regex
  part: header
  regex:
  - ECS
  - "Server: cloudflare"

output:

./katana -f server -u https://example.com  -silent 
ECS
-----------------------------------------------------------------------------
./katana -f server -u https://projectdiscovery.io  -silent 
Server: cloudflare
Server: cloudflare
Server: cloudflare
-----------------------------------------------------------------------------
./katana -f email -u https://projectdiscovery.io  -silent 
[email protected]
[email protected]
[email protected]

Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

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

@ShubhamRasal

  • JOSN output fields update
  • part: response should be used (implicitly) if not defined.

@ehsandeep ehsandeep merged commit b7b8820 into dev Jan 5, 2023
@ehsandeep ehsandeep deleted the issue-92-add-custom-field branch January 5, 2023 16:26
@ehsandeep ehsandeep removed the Status: Review Needed The issue has a PR attached to it which needs to be reviewed label Jan 5, 2023
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.

Custom field support with config file
3 participants