-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Javascript Multi-Port Support #6501
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
6a6de38
Multi Port Support Added - JS
pussycat0x 7e04181
minor -changes
pussycat0x ae61257
Merge branch 'dev' into multiport-js
Mzack9999 0759026
restoring basic sequential multiport support
Mzack9999 8c56052
better error handling
Mzack9999 9b37f1b
adding test case
Mzack9999 c746a8f
lint
Mzack9999 232de93
removing unused check
Mzack9999 761c7c0
adding multiport template
Mzack9999 4e8843a
Merge branch 'dev' into multiport-js
Mzack9999 3ea8dc2
refactor test
Mzack9999 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| id: multi-ports | ||
|
|
||
| info: | ||
| name: Multi Ports - Detection | ||
| author: pdteam | ||
| severity: info | ||
| description: | | ||
| Multi Ports template for testing | ||
| metadata: | ||
| max-request: 1 | ||
| tags: js,detect,multi-ports,enum,network | ||
|
|
||
| javascript: | ||
| - pre-condition: | | ||
| isPortOpen(Host,Port); | ||
| code: | | ||
| var m = require("nuclei/ssh"); | ||
| var c = m.SSHClient(); | ||
| var response = c.ConnectSSHInfoMode(Host, Port); | ||
| Export(response); | ||
| args: | ||
| Host: "{{Host}}" | ||
| Port: "2222,22" # Port 22 should match | ||
|
|
||
| extractors: | ||
| - type: json | ||
| json: | ||
| - '.UserAuth' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple issues with executor implementation.
The
javascriptMultiPortsSSHexecutor has several problems that deviate from the established pattern:Line 175: Checks
sshResourceinstead ofmultiPortsSShResource, which creates inconsistency with the declared variable at line 28.Line 176: Copy-paste error in comment—says "redis" but should say "SSH" or "multi-port SSH".
Line 179: Uses hardcoded
"scanme.sh"instead of extracting a port from a Docker resource like all other executors (see lines 50-51, 82-83, 114-115, 147-148). This breaks the established pattern of testing against local Docker containers.Missing
defer purge(): Unlike all other executors (lines 52, 84, 116, 149), this executor doesn't clean up the Docker resource, potentially causing resource leaks.Apply this diff to align with the established pattern (assuming you want to use the existing
sshResource):func (j *javascriptMultiPortsSSH) Execute(filePath string) error { if sshResource == nil || pool == nil { - // skip test as redis is not running + // skip test as ssh is not running return nil } - finalURL := "scanme.sh" + tempPort := sshResource.GetPort("2222/tcp") + finalURL := "localhost:" + tempPort + defer purge(sshResource) errs := []error{}Alternatively, if the test genuinely needs to target the external
scanme.shservice (which seems inconsistent with an integration test suite using Docker), please clarify the intent and consider whether this should be a separate test type.