Module: PWN::SAST::Port
- Defined in:
- lib/pwn/sast/port.rb
Overview
SAST Module used to identify port declarations and network connections within source code to get a sense around appropriate secure network communications in place.
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
-
0day Inc.
-
.help ⇒ Object
Display Usage for this Module.
-
.scan(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::SAST::Port.scan( dir_path: ‘optional path to dir defaults to .’ git_repo_root_uri: ‘optional http uri of git repo scanned’ ).
-
.security_references ⇒ Object
Used primarily to map NIST 800-53 Revision 4 Security Controls web.nvd.nist.gov/view/800-53/Rev4/impact?impactName=HIGH to PWN Exploit & Static Code Anti-Pattern Matching Modules to Determine the level of Testing Coverage w/ PWN.
Class Method Details
.authors ⇒ Object
- Author(s)
-
0day Inc. <[email protected]>
62 63 64 65 66 |
# File 'lib/pwn/sast/port.rb', line 62 public_class_method def self. "AUTHOR(S): 0day Inc. <[email protected]> " end |
.help ⇒ Object
Display Usage for this Module
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/pwn/sast/port.rb', line 70 public_class_method def self.help puts "USAGE: sast_arr = #{self}.scan( dir_path: 'optional path to dir defaults to .', git_repo_root_uri: 'optional http uri of git repo scanned' ) #{self}.authors " end |
.scan(opts = {}) ⇒ Object
- Supported Method Parameters
-
PWN::SAST::Port.scan(
dir_path: 'optional path to dir defaults to .' git_repo_root_uri: 'optional http uri of git repo scanned')
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/pwn/sast/port.rb', line 19 public_class_method def self.scan(opts = {}) dir_path = opts[:dir_path] git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub test_case_filter = %( grep -niE \ -e "localhost:\\d" \ -e ":\/\/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?):([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])" \ -e "port\\s=\\s([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])" \ -e "port=([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])" \ -e "port:([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])" \ -e "port:\\s([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])" {PWN_SAST_SRC_TARGET} 2> /dev/null ) PWN::SAST::TestCaseEngine.execute( test_case_filter: test_case_filter, security_references: security_references, dir_path: dir_path, git_repo_root_uri: git_repo_root_uri ) rescue StandardError => e raise e end |
.security_references ⇒ Object
Used primarily to map NIST 800-53 Revision 4 Security Controls web.nvd.nist.gov/view/800-53/Rev4/impact?impactName=HIGH to PWN Exploit & Static Code Anti-Pattern Matching Modules to Determine the level of Testing Coverage w/ PWN.
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/pwn/sast/port.rb', line 48 public_class_method def self.security_references { sast_module: self, section: 'TRANSMISSION CONFIDENTIALITY AND INTEGRITY', nist_800_53_uri: 'https://csrc.nist.gov/projects/cprt/catalog#/cprt/framework/version/SP_800_53_5_1_1/home?element=SC-08', cwe_id: '319', cwe_uri: 'https://cwe.mitre.org/data/definitions/319.html' } rescue StandardError => e raise e end |