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

code protocol: donot exit on non zero status code #4585

Merged
merged 1 commit into from
Jan 7, 2024

Conversation

tarunKoyalwar
Copy link
Member

@tarunKoyalwar tarunKoyalwar commented Jan 5, 2024

Proposed Changes

when writing code protocol templates . some exploits may return non-zero status code but current logic stops executing template in case on non-zero exit code which should not be the case

example template

id: py-code-snippet

info:
  name: py-code-snippet
  author: pdteam
  severity: info
  tags: code
  description: |
    py-code-snippet

self-contained: true

code:
  - engine:
      - sh
      - bash
    source: |
      nuclei -exy
    
    matchers:
      - type: word
        words:
          - "not defined"

    extractors:
      - type: dsl
        dsl:
          - '"nuclei -exy :"+ response'
# digest: 4a0a00473045022100a834da82e4af5b144f86397c4595a84cdb82336572a3f62b5074e3d4bdf1d47502207555875e3149bfb32f731e0fac16015d586d3bcc8b0811a1d5294cdbf2d861af:73812c4e0e52692225979bd2d5f05a3c

output

$ ./nuclei -t a.yaml -code -v      

                     __     _
   ____  __  _______/ /__  (_)
  / __ \/ / / / ___/ / _ \/ /
 / / / / /_/ / /__/ /  __/ /
/_/ /_/\__,_/\___/_/\___/_/   v3.1.4-dev

		projectdiscovery.io

[VER] Started metrics server at localhost:9092
[INF] Current nuclei version: v3.1.4-dev (development)
[INF] Current nuclei-templates version: v9.7.2 (latest)
[WRN] Scan results upload to cloud is disabled.
[INF] New templates added in latest release: 61
[INF] Templates loaded for current scan: 1
[INF] Executing 1 signed templates from tarun
[VER] [py-code-snippet] Executed code on local machine 
[py-code-snippet] [code] [info]  [nuclei -exy :flag provided but not defined: -exy]

@tarunKoyalwar tarunKoyalwar self-assigned this Jan 5, 2024
@tarunKoyalwar tarunKoyalwar marked this pull request as ready for review January 5, 2024 21:24
@ehsandeep ehsandeep merged commit 056073d into dev Jan 7, 2024
12 checks passed
@ehsandeep ehsandeep deleted the issue-code-protocol-stderr branch January 7, 2024 21:57
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.

Code protocol exits on non zero exit code
2 participants