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 options to specify User-Agent in headless template #1638

Merged
merged 1 commit into from
Mar 1, 2022

Conversation

parrasajad
Copy link
Contributor

@parrasajad parrasajad commented Feb 24, 2022

Proposed changes

user_agent: random | off | default | custom

example template:

id: extract-urls

info:
  name: Extract URLs from HTML attributes
  author: dwisiswant0
  severity: info
  tags: headless,extractor

headless:
  - steps:
      - args:
          url: "{{BaseURL}}"
        action: navigate
      - action: waitload
      - action: script
        name: extract
        args:
          code: |
            '\n' + [...new Set(Array.from(document.querySelectorAll('[src], [href], [url], [action]')).map(i => i.src || i.href || i.url || i.action))].join('\r\n') + '\n'

    user_agent: custom
    custom_user_agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36

    extractors:
      - type: kval
        part: extract
        kval:
          - extract

Checklist

  • Pull request is created against the dev branch
  • All checks passed (lint, unit/integration/regression tests etc.) with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@parrasajad parrasajad linked an issue Feb 24, 2022 that may be closed by this pull request
@sonarcloud
Copy link

sonarcloud bot commented Feb 24, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@ehsandeep ehsandeep merged commit a7849ce into dev Mar 1, 2022
@ehsandeep ehsandeep deleted the custom-user-agent branch March 1, 2022 17:19
@ehsandeep ehsandeep restored the custom-user-agent branch March 1, 2022 17:28
@ehsandeep ehsandeep deleted the custom-user-agent branch March 1, 2022 17:29
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.

Customizable headless User-Agent
4 participants