-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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 4 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| id: ssh-auth-methods | ||
|
|
||
| info: | ||
| name: SSH Auth Methods - Detection | ||
| author: Ice3man543 | ||
| severity: info | ||
| description: | | ||
| SSH (Secure Shell) authentication modes are methods used to verify the identity of users and ensure secure access to remote systems. Common SSH authentication modes include password-based authentication, which relies on a secret passphrase, and public key authentication, which uses cryptographic keys for a more secure and convenient login process. Additionally, multi-factor authentication (MFA) can be employed to enhance security by requiring users to provide multiple forms of authentication, such as a password and a one-time code. | ||
| reference: | ||
| - https://nmap.org/nsedoc/scripts/ssh-auth-methods.html | ||
| metadata: | ||
| max-request: 1 | ||
| shodan-query: product:"OpenSSH" | ||
| tags: js,detect,ssh,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: "222,22" | ||
|
|
||
| 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.
Critical: Templates without Port won't execute.
When
getPorts()returns an empty slice (no Port specified in template args), the loop doesn't execute and the function returns immediately. This breaks existing JavaScript templates that don't specify a Port argument.Apply this diff to execute once with an empty port when no ports are specified:
func (request *Request) ExecuteWithResults(target *contextargs.Context, dynamicValues, previous output.InternalEvent, callback protocols.OutputEventCallback) error { // Get default port(s) if specified in template ports := request.getPorts() + if len(ports) == 0 { + ports = []string{""} + } for _, port := range ports { err := request.executeWithResults(port, target, dynamicValues, previous, callback) if err != nil { return err } } return nil }📝 Committable suggestion
🤖 Prompt for AI Agents