@js-recon/js-recon 1.4.3 → 2.0.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-sync/sync.sh +1 -1
- package/.github/workflows/build-and-prettify.yaml +55 -25
- package/.github/workflows/codeql.yml +33 -0
- package/.github/workflows/exploit-smoke-test.yaml +160 -0
- package/.github/workflows/framework-detection-smoke-test.yaml +135 -0
- package/.github/workflows/plumber.yml +20 -0
- package/.github/workflows/promote-js-recon.yml +5 -3
- package/.github/workflows/publish-js-recon.yml +6 -1
- package/.github/workflows/rules-smoke-test.yaml +15 -7
- package/.nvmrc +1 -0
- package/.plumber.yaml +151 -0
- package/CHANGELOG.md +54 -0
- package/CONTRIBUTING.md +32 -0
- package/Dockerfile +1 -0
- package/README.md +55 -2
- package/SECURITY.md +1 -1
- package/build/analyze/engine/astEngine.js +10 -9
- package/build/analyze/engine/astEngine.js.map +1 -1
- package/build/analyze/engine/csMastSEngine.js +6 -6
- package/build/analyze/engine/csMastSEngine.js.map +1 -1
- package/build/analyze/engine/index.js +1 -1
- package/build/analyze/engine/index.js.map +1 -1
- package/build/analyze/engine/requestEngine.js +6 -6
- package/build/analyze/engine/requestEngine.js.map +1 -1
- package/build/analyze/helpers/determineCompatibleVersion.js +70 -0
- package/build/analyze/helpers/determineCompatibleVersion.js.map +1 -0
- package/build/analyze/helpers/engineHelpers/findMemberExpressionAssignment.js +9 -3
- package/build/analyze/helpers/engineHelpers/findMemberExpressionAssignment.js.map +1 -1
- package/build/analyze/helpers/initRules.js +42 -24
- package/build/analyze/helpers/initRules.js.map +1 -1
- package/build/analyze/helpers/outputHelper.js +3 -3
- package/build/analyze/helpers/outputHelper.js.map +1 -1
- package/build/analyze/helpers/schemas.js +1 -0
- package/build/analyze/helpers/schemas.js.map +1 -1
- package/build/analyze/helpers/validate.js +9 -5
- package/build/analyze/helpers/validate.js.map +1 -1
- package/build/analyze/index.js +26 -16
- package/build/analyze/index.js.map +1 -1
- package/build/cliProgram.js +710 -0
- package/build/cliProgram.js.map +1 -0
- package/build/completion/index.js +245 -339
- package/build/completion/index.js.map +1 -1
- package/build/completion/introspect.js +17 -0
- package/build/completion/introspect.js.map +1 -0
- package/build/config/applicationConfig.js +494 -0
- package/build/config/applicationConfig.js.map +1 -0
- package/build/cs_mast/index.js +18 -17
- package/build/cs_mast/index.js.map +1 -1
- package/build/endpoints/gen_report/gen_json.js +2 -2
- package/build/endpoints/gen_report/gen_json.js.map +1 -1
- package/build/endpoints/gen_report/utility/iterate_n_store.js +1 -1
- package/build/endpoints/gen_report/utility/iterate_n_store.js.map +1 -1
- package/build/endpoints/index.js +12 -12
- package/build/endpoints/index.js.map +1 -1
- package/build/endpoints/next_js/client_jsFilesHref.js +3 -3
- package/build/endpoints/next_js/client_jsFilesHref.js.map +1 -1
- package/build/endpoints/next_js/client_jsonParse.js +4 -4
- package/build/endpoints/next_js/client_jsonParse.js.map +1 -1
- package/build/endpoints/next_js/client_mappedJsonFile.js +6 -6
- package/build/endpoints/next_js/client_mappedJsonFile.js.map +1 -1
- package/build/endpoints/next_js/client_subsequentRequests.js +5 -5
- package/build/endpoints/next_js/client_subsequentRequests.js.map +1 -1
- package/build/exploit/angular/cve-2026-68945.js +61 -0
- package/build/exploit/angular/cve-2026-68945.js.map +1 -0
- package/build/exploit/index.js +60 -0
- package/build/exploit/index.js.map +1 -0
- package/build/exploit/next/cve-2025-29927.js +65 -0
- package/build/exploit/next/cve-2025-29927.js.map +1 -0
- package/build/exploit/next/cve-2026-64645.js +51 -0
- package/build/exploit/next/cve-2026-64645.js.map +1 -0
- package/build/exploit/nuxt/cve-2026-71315.js +47 -0
- package/build/exploit/nuxt/cve-2026-71315.js.map +1 -0
- package/build/exploit/nuxt/cve-2026-71320.js +114 -0
- package/build/exploit/nuxt/cve-2026-71320.js.map +1 -0
- package/build/exploit/react/cve-2025-55182.js +116 -0
- package/build/exploit/react/cve-2025-55182.js.map +1 -0
- package/build/exploit/registry/cveRegistry.js +115 -0
- package/build/exploit/registry/cveRegistry.js.map +1 -0
- package/build/exploit/types.js +2 -0
- package/build/exploit/types.js.map +1 -0
- package/build/exploit/utility/compareResponses.js +29 -0
- package/build/exploit/utility/compareResponses.js.map +1 -0
- package/build/exploit/utility/outputHelper.js +22 -0
- package/build/exploit/utility/outputHelper.js.map +1 -0
- package/build/exploit/utility/rawRequest.js +54 -0
- package/build/exploit/utility/rawRequest.js.map +1 -0
- package/build/exploit/utility/sandboxRce.js +49 -0
- package/build/exploit/utility/sandboxRce.js.map +1 -0
- package/build/exploit/utility/toEngineOutput.js +28 -0
- package/build/exploit/utility/toEngineOutput.js.map +1 -0
- package/build/exploit/utility/wsClient.js +78 -0
- package/build/exploit/utility/wsClient.js.map +1 -0
- package/build/exploit/vite/cve-2025-30208.js +44 -0
- package/build/exploit/vite/cve-2025-30208.js.map +1 -0
- package/build/exploit/vite/cve-2026-39363.js +60 -0
- package/build/exploit/vite/cve-2026-39363.js.map +1 -0
- package/build/fingerprint/index.js +11 -21
- package/build/fingerprint/index.js.map +1 -1
- package/build/globalConfig.js +2 -2
- package/build/globalConfig.js.map +1 -1
- package/build/index.js +16 -555
- package/build/index.js.map +1 -1
- package/build/lazyLoad/angular/angular_getFromPageSource.js +3 -3
- package/build/lazyLoad/angular/angular_getFromPageSource.js.map +1 -1
- package/build/lazyLoad/downloadFilesUtil.js +51 -40
- package/build/lazyLoad/downloadFilesUtil.js.map +1 -1
- package/build/lazyLoad/downloadQueue.js +154 -50
- package/build/lazyLoad/downloadQueue.js.map +1 -1
- package/build/lazyLoad/downloadResponse.js +113 -0
- package/build/lazyLoad/downloadResponse.js.map +1 -0
- package/build/lazyLoad/generic/generic_crawlPages.js +186 -0
- package/build/lazyLoad/generic/generic_crawlPages.js.map +1 -0
- package/build/lazyLoad/generic/generic_downloadFiles.js +81 -0
- package/build/lazyLoad/generic/generic_downloadFiles.js.map +1 -0
- package/build/lazyLoad/generic/generic_extractLinks.js +79 -0
- package/build/lazyLoad/generic/generic_extractLinks.js.map +1 -0
- package/build/lazyLoad/generic/generic_getScriptTags.js +152 -0
- package/build/lazyLoad/generic/generic_getScriptTags.js.map +1 -0
- package/build/lazyLoad/generic/generic_importMapDiscovery.js +87 -0
- package/build/lazyLoad/generic/generic_importMapDiscovery.js.map +1 -0
- package/build/lazyLoad/generic/generic_resolveScope.js +61 -0
- package/build/lazyLoad/generic/generic_resolveScope.js.map +1 -0
- package/build/lazyLoad/generic/generic_scanAttributesForJs.js +122 -0
- package/build/lazyLoad/generic/generic_scanAttributesForJs.js.map +1 -0
- package/build/lazyLoad/generic/generic_stringsDiscovery.js +103 -0
- package/build/lazyLoad/generic/generic_stringsDiscovery.js.map +1 -0
- package/build/lazyLoad/generic/generic_webpackChunkPaths.js +56 -0
- package/build/lazyLoad/generic/generic_webpackChunkPaths.js.map +1 -0
- package/build/lazyLoad/globals.js +35 -0
- package/build/lazyLoad/globals.js.map +1 -1
- package/build/lazyLoad/index.js +311 -175
- package/build/lazyLoad/index.js.map +1 -1
- package/build/lazyLoad/methodFilter.js +2 -0
- package/build/lazyLoad/methodFilter.js.map +1 -1
- package/build/lazyLoad/next_js/NextJsCrawler.js +39 -14
- package/build/lazyLoad/next_js/NextJsCrawler.js.map +1 -1
- package/build/lazyLoad/next_js/next_GetJSScript.js +3 -3
- package/build/lazyLoad/next_js/next_GetJSScript.js.map +1 -1
- package/build/lazyLoad/next_js/next_GetLazyResourcesBuildManifestJs.js +4 -4
- package/build/lazyLoad/next_js/next_GetLazyResourcesBuildManifestJs.js.map +1 -1
- package/build/lazyLoad/next_js/next_GetLazyResourcesWebpackJs.js +21 -20
- package/build/lazyLoad/next_js/next_GetLazyResourcesWebpackJs.js.map +1 -1
- package/build/lazyLoad/next_js/next_SubsequentRequests.js +100 -99
- package/build/lazyLoad/next_js/next_SubsequentRequests.js.map +1 -1
- package/build/lazyLoad/next_js/next_bruteForceJsFiles.js +1 -1
- package/build/lazyLoad/next_js/next_bruteForceJsFiles.js.map +1 -1
- package/build/lazyLoad/next_js/next_buildId.js +2 -2
- package/build/lazyLoad/next_js/next_buildId.js.map +1 -1
- package/build/lazyLoad/next_js/next_getClientSidePaths.js +2 -2
- package/build/lazyLoad/next_js/next_getClientSidePaths.js.map +1 -1
- package/build/lazyLoad/next_js/next_parseLayoutJs.js +6 -6
- package/build/lazyLoad/next_js/next_parseLayoutJs.js.map +1 -1
- package/build/lazyLoad/next_js/next_promiseResolve.js +1 -1
- package/build/lazyLoad/next_js/next_promiseResolve.js.map +1 -1
- package/build/lazyLoad/next_js/next_routerStateForge.js +341 -0
- package/build/lazyLoad/next_js/next_routerStateForge.js.map +1 -0
- package/build/lazyLoad/next_js/next_scriptTagsSubsequentRequests.js +1 -1
- package/build/lazyLoad/next_js/next_scriptTagsSubsequentRequests.js.map +1 -1
- package/build/lazyLoad/next_js/next_serverActionIdScan.js +77 -0
- package/build/lazyLoad/next_js/next_serverActionIdScan.js.map +1 -0
- package/build/lazyLoad/nuxt_js/nuxt_astParse.js +15 -13
- package/build/lazyLoad/nuxt_js/nuxt_astParse.js.map +1 -1
- package/build/lazyLoad/nuxt_js/nuxt_getBuildsManifest.js +2 -2
- package/build/lazyLoad/nuxt_js/nuxt_getBuildsManifest.js.map +1 -1
- package/build/lazyLoad/nuxt_js/nuxt_getFromPageSource.js +3 -3
- package/build/lazyLoad/nuxt_js/nuxt_getFromPageSource.js.map +1 -1
- package/build/lazyLoad/nuxt_js/nuxt_stringAnalysisJSFiles.js +2 -2
- package/build/lazyLoad/nuxt_js/nuxt_stringAnalysisJSFiles.js.map +1 -1
- package/build/lazyLoad/outputPath.js +92 -0
- package/build/lazyLoad/outputPath.js.map +1 -0
- package/build/lazyLoad/react/react_followImports.js +15 -5
- package/build/lazyLoad/react/react_followImports.js.map +1 -1
- package/build/lazyLoad/react/react_getScriptTags.js +11 -6
- package/build/lazyLoad/react/react_getScriptTags.js.map +1 -1
- package/build/lazyLoad/react/react_sourcemapUrls.js +3 -2
- package/build/lazyLoad/react/react_sourcemapUrls.js.map +1 -1
- package/build/lazyLoad/react/react_webpackChunkPaths.js +12 -203
- package/build/lazyLoad/react/react_webpackChunkPaths.js.map +1 -1
- package/build/lazyLoad/researchUtils.js +15 -0
- package/build/lazyLoad/researchUtils.js.map +1 -0
- package/build/lazyLoad/shared/webpackChunkParsers.js +218 -0
- package/build/lazyLoad/shared/webpackChunkParsers.js.map +1 -0
- package/build/lazyLoad/stagnation/stagnationMonitor.js +63 -0
- package/build/lazyLoad/stagnation/stagnationMonitor.js.map +1 -0
- package/build/lazyLoad/svelte/svelte_discoverPagesFromJs.js +1 -0
- package/build/lazyLoad/svelte/svelte_discoverPagesFromJs.js.map +1 -1
- package/build/lazyLoad/svelte/svelte_getFromPageSource.js +5 -5
- package/build/lazyLoad/svelte/svelte_getFromPageSource.js.map +1 -1
- package/build/lazyLoad/svelte/svelte_getVersionJson.js +2 -2
- package/build/lazyLoad/svelte/svelte_getVersionJson.js.map +1 -1
- package/build/lazyLoad/svelte/svelte_recursivePageCrawl.js +6 -6
- package/build/lazyLoad/svelte/svelte_recursivePageCrawl.js.map +1 -1
- package/build/lazyLoad/svelte/svelte_stringAnalysisJSFiles.js +2 -2
- package/build/lazyLoad/svelte/svelte_stringAnalysisJSFiles.js.map +1 -1
- package/build/lazyLoad/techDetect/checkAngularJS.js +1 -1
- package/build/lazyLoad/techDetect/checkAngularJS.js.map +1 -1
- package/build/lazyLoad/techDetect/checkNuxtJS.js +3 -3
- package/build/lazyLoad/techDetect/checkNuxtJS.js.map +1 -1
- package/build/lazyLoad/techDetect/checkSvelte.js +0 -1
- package/build/lazyLoad/techDetect/checkSvelte.js.map +1 -1
- package/build/lazyLoad/techDetect/checkVueJS.js +6 -6
- package/build/lazyLoad/techDetect/checkVueJS.js.map +1 -1
- package/build/lazyLoad/techDetect/index.js +106 -60
- package/build/lazyLoad/techDetect/index.js.map +1 -1
- package/build/lazyLoad/vue/vue_RuntimeJs.js +20 -15
- package/build/lazyLoad/vue/vue_RuntimeJs.js.map +1 -1
- package/build/lazyLoad/vue/vue_SingleJsFileOnHome.js +10 -5
- package/build/lazyLoad/vue/vue_SingleJsFileOnHome.js.map +1 -1
- package/build/lazyLoad/vue/vue_discoverJsFiles.js +20 -17
- package/build/lazyLoad/vue/vue_discoverJsFiles.js.map +1 -1
- package/build/lazyLoad/vue/vue_getClientSidePaths.js +70 -46
- package/build/lazyLoad/vue/vue_getClientSidePaths.js.map +1 -1
- package/build/lazyLoad/vue/vue_jsImports.js +3 -2
- package/build/lazyLoad/vue/vue_jsImports.js.map +1 -1
- package/build/lazyLoad/vue/vue_pageSrc.js +3 -2
- package/build/lazyLoad/vue/vue_pageSrc.js.map +1 -1
- package/build/lazyLoad/vue/vue_reconstructSourceMaps.js +6 -5
- package/build/lazyLoad/vue/vue_reconstructSourceMaps.js.map +1 -1
- package/build/lazyLoad/vue/vue_recursiveClientSidePathDownload.js +10 -21
- package/build/lazyLoad/vue/vue_recursiveClientSidePathDownload.js.map +1 -1
- package/build/lazyLoad/vue/vue_severalJsFilesHome.js +5 -4
- package/build/lazyLoad/vue/vue_severalJsFilesHome.js.map +1 -1
- package/build/lazyLoad/vue/vue_stringJsFiles.js +28 -25
- package/build/lazyLoad/vue/vue_stringJsFiles.js.map +1 -1
- package/build/lazyLoad/vue/vue_viteMapDeps.js +8 -2
- package/build/lazyLoad/vue/vue_viteMapDeps.js.map +1 -1
- package/build/load/index.js +8 -7
- package/build/load/index.js.map +1 -1
- package/build/map/angular_js/getAngularConnections.js +6 -6
- package/build/map/angular_js/getAngularConnections.js.map +1 -1
- package/build/map/graphql/resolveGraphql.js +6 -6
- package/build/map/graphql/resolveGraphql.js.map +1 -1
- package/build/map/index.js +17 -17
- package/build/map/index.js.map +1 -1
- package/build/map/interactive-mode/commandHandler.js +278 -0
- package/build/map/interactive-mode/commandHandler.js.map +1 -0
- package/build/map/interactive-mode/commandHelpers.js +189 -0
- package/build/map/interactive-mode/commandHelpers.js.map +1 -0
- package/build/map/interactive-mode/esqueryGen.js.map +1 -0
- package/build/map/interactive-mode/helpMenu.js +11 -0
- package/build/map/interactive-mode/helpMenu.js.map +1 -0
- package/build/map/interactive-mode/inputPatch.js.map +1 -0
- package/build/map/interactive-mode/interactive.js +71 -0
- package/build/map/interactive-mode/interactive.js.map +1 -0
- package/build/map/interactive-mode/keybindings.js.map +1 -0
- package/build/map/interactive-mode/printer.js.map +1 -0
- package/build/map/interactive-mode/ui.js.map +1 -0
- package/build/map/next_js/getAxiosInstances.js +5 -5
- package/build/map/next_js/getAxiosInstances.js.map +1 -1
- package/build/map/next_js/getExports.js +4 -4
- package/build/map/next_js/getExports.js.map +1 -1
- package/build/map/next_js/getFetchInstances.js +10 -10
- package/build/map/next_js/getFetchInstances.js.map +1 -1
- package/build/map/next_js/getTurbopackConnections.js +8 -8
- package/build/map/next_js/getTurbopackConnections.js.map +1 -1
- package/build/map/next_js/getWebpackConnections.js +27 -16
- package/build/map/next_js/getWebpackConnections.js.map +1 -1
- package/build/map/next_js/interactive.js +3 -65
- package/build/map/next_js/interactive.js.map +1 -1
- package/build/map/next_js/interactive_helpers/commandHandler.js +38 -290
- package/build/map/next_js/interactive_helpers/commandHandler.js.map +1 -1
- package/build/map/next_js/interactive_helpers/commandHelpers.js +0 -184
- package/build/map/next_js/interactive_helpers/commandHelpers.js.map +1 -1
- package/build/map/next_js/interactive_helpers/helpMenu.js +2 -10
- package/build/map/next_js/interactive_helpers/helpMenu.js.map +1 -1
- package/build/map/next_js/resolveAxios.js +6 -6
- package/build/map/next_js/resolveAxios.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/findAxiosClients.js +4 -4
- package/build/map/next_js/resolveAxiosHelpers/findAxiosClients.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/findAxiosInstance.js +2 -2
- package/build/map/next_js/resolveAxiosHelpers/findAxiosInstance.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/findCrossChunkParams.js +5 -5
- package/build/map/next_js/resolveAxiosHelpers/findCrossChunkParams.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/handleAxiosCreate.js +10 -10
- package/build/map/next_js/resolveAxiosHelpers/handleAxiosCreate.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/handleZDotCreate.js +13 -9
- package/build/map/next_js/resolveAxiosHelpers/handleZDotCreate.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/processAxiosCall.js +12 -8
- package/build/map/next_js/resolveAxiosHelpers/processAxiosCall.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/processDirectAxiosCall.js +12 -8
- package/build/map/next_js/resolveAxiosHelpers/processDirectAxiosCall.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/processExportedEndpoints.js +11 -11
- package/build/map/next_js/resolveAxiosHelpers/processExportedEndpoints.js.map +1 -1
- package/build/map/next_js/resolveAxiosHelpers/traceAxiosInstanceExports.js +16 -16
- package/build/map/next_js/resolveAxiosHelpers/traceAxiosInstanceExports.js.map +1 -1
- package/build/map/next_js/resolveFetch.js +23 -23
- package/build/map/next_js/resolveFetch.js.map +1 -1
- package/build/map/next_js/resolveNewRequest.js +10 -10
- package/build/map/next_js/resolveNewRequest.js.map +1 -1
- package/build/map/next_js/resolveServerActions.js +4 -4
- package/build/map/next_js/resolveServerActions.js.map +1 -1
- package/build/map/next_js/utils.js +8 -2
- package/build/map/next_js/utils.js.map +1 -1
- package/build/map/react_js/getReactConnections.js +21 -14
- package/build/map/react_js/getReactConnections.js.map +1 -1
- package/build/map/svelte_js/interactive.js +3 -54
- package/build/map/svelte_js/interactive.js.map +1 -1
- package/build/map/vue_js/getViteConnections.js +23 -16
- package/build/map/vue_js/getViteConnections.js.map +1 -1
- package/build/map/vue_js/interactive.js +3 -63
- package/build/map/vue_js/interactive.js.map +1 -1
- package/build/map/vue_js/interactive_helpers/commandHandler.js +34 -283
- package/build/map/vue_js/interactive_helpers/commandHandler.js.map +1 -1
- package/build/map/vue_js/interactive_helpers/helpMenu.js +2 -10
- package/build/map/vue_js/interactive_helpers/helpMenu.js.map +1 -1
- package/build/map/vue_js/taint_utils.js +1 -1
- package/build/map/vue_js/taint_utils.js.map +1 -1
- package/build/map/vue_js/vue_resolveFetch.js +12 -12
- package/build/map/vue_js/vue_resolveFetch.js.map +1 -1
- package/build/map/vue_js/vue_resolveHttpClient.js +18 -18
- package/build/map/vue_js/vue_resolveHttpClient.js.map +1 -1
- package/build/map/vue_js/vue_resolveXhr.js +11 -11
- package/build/map/vue_js/vue_resolveXhr.js.map +1 -1
- package/build/mcp/chatOneShot.js +7 -7
- package/build/mcp/chatOneShot.js.map +1 -1
- package/build/mcp/claudeCodeCreds.js +5 -5
- package/build/mcp/claudeCodeCreds.js.map +1 -1
- package/build/mcp/cli.js +36 -35
- package/build/mcp/cli.js.map +1 -1
- package/build/mcp/config.js +4 -4
- package/build/mcp/config.js.map +1 -1
- package/build/mcp/index.js +7 -7
- package/build/mcp/index.js.map +1 -1
- package/build/mcp/mcpServer.js +3 -2
- package/build/mcp/mcpServer.js.map +1 -1
- package/build/mcp/skills.js +1 -0
- package/build/mcp/skills.js.map +1 -1
- package/build/mcp/tools.js +5 -4
- package/build/mcp/tools.js.map +1 -1
- package/build/proxy/checkFeasibility.js +8 -4
- package/build/proxy/checkFeasibility.js.map +1 -1
- package/build/proxy/checkFireWallBlocking.js +23 -13
- package/build/proxy/checkFireWallBlocking.js.map +1 -1
- package/build/proxy/detectBlockedResponse.js +205 -0
- package/build/proxy/detectBlockedResponse.js.map +1 -0
- package/build/proxy/genReq.js +434 -127
- package/build/proxy/genReq.js.map +1 -1
- package/build/proxy/index.js +3 -3
- package/build/proxy/index.js.map +1 -1
- package/build/proxy/oxylabsFallback.js +110 -0
- package/build/proxy/oxylabsFallback.js.map +1 -0
- package/build/proxy/proxyFeasibilityRequest.js +11 -9
- package/build/proxy/proxyFeasibilityRequest.js.map +1 -1
- package/build/refactor/index.js +83 -79
- package/build/refactor/index.js.map +1 -1
- package/build/refactor/next/index.js +69 -26
- package/build/refactor/next/index.js.map +1 -1
- package/build/refactor/next/transform.js +11 -4
- package/build/refactor/next/transform.js.map +1 -1
- package/build/refactor/next/validator.js +7 -7
- package/build/refactor/next/validator.js.map +1 -1
- package/build/refactor/react/index.js +13 -13
- package/build/refactor/react/index.js.map +1 -1
- package/build/refactor/react/validator.js +7 -7
- package/build/refactor/react/validator.js.map +1 -1
- package/build/refactor/react-vite/index.js +3 -3
- package/build/refactor/react-vite/index.js.map +1 -1
- package/build/refactor/remote/hf-client.js +1 -0
- package/build/refactor/remote/hf-client.js.map +1 -1
- package/build/refactor/remote/version-detect.js +12 -12
- package/build/refactor/remote/version-detect.js.map +1 -1
- package/build/refactor/vue/index.js +6 -6
- package/build/refactor/vue/index.js.map +1 -1
- package/build/refactor/vue/vite.js +6 -6
- package/build/refactor/vue/vite.js.map +1 -1
- package/build/report/index.js +30 -8
- package/build/report/index.js.map +1 -1
- package/build/report/swaggerJacker.js +63 -0
- package/build/report/swaggerJacker.js.map +1 -0
- package/build/report/utility/genHtml.js +7 -7
- package/build/report/utility/genHtml.js.map +1 -1
- package/build/report/utility/populateDb/populateAnalysisFindings.js +2 -2
- package/build/report/utility/populateDb/populateAnalysisFindings.js.map +1 -1
- package/build/report/utility/populateDb/populateEndpoints.js +3 -3
- package/build/report/utility/populateDb/populateEndpoints.js.map +1 -1
- package/build/report/utility/populateDb/populateMappedJson.js +2 -2
- package/build/report/utility/populateDb/populateMappedJson.js.map +1 -1
- package/build/report/utility/populateDb/populateMappedOpenapi.js +3 -3
- package/build/report/utility/populateDb/populateMappedOpenapi.js.map +1 -1
- package/build/run/bundler-detect.js +45 -9
- package/build/run/bundler-detect.js.map +1 -1
- package/build/run/cancellableStep.js +27 -0
- package/build/run/cancellableStep.js.map +1 -0
- package/build/run/dashboard/dashboardHtml.js +150 -0
- package/build/run/dashboard/dashboardHtml.js.map +1 -0
- package/build/run/dashboard/fsBrowser.js +43 -0
- package/build/run/dashboard/fsBrowser.js.map +1 -0
- package/build/run/dashboard/server.js +123 -0
- package/build/run/dashboard/server.js.map +1 -0
- package/build/run/dashboard/state.js +97 -0
- package/build/run/dashboard/state.js.map +1 -0
- package/build/run/index.js +239 -204
- package/build/run/index.js.map +1 -1
- package/build/run/interruptHandler.js +18 -0
- package/build/run/interruptHandler.js.map +1 -1
- package/build/run/outputDirectory.js +377 -0
- package/build/run/outputDirectory.js.map +1 -0
- package/build/sourcemaps/index.js +116 -29
- package/build/sourcemaps/index.js.map +1 -1
- package/build/strings/index.js +38 -28
- package/build/strings/index.js.map +1 -1
- package/build/strings/openapi.js +4 -4
- package/build/strings/openapi.js.map +1 -1
- package/build/strings/permutate.js +4 -4
- package/build/strings/permutate.js.map +1 -1
- package/build/strings/secrets.js +1 -0
- package/build/strings/secrets.js.map +1 -1
- package/build/strings/trufflehog.js +66 -19
- package/build/strings/trufflehog.js.map +1 -1
- package/build/strings/trufflehogConfig.js +36 -0
- package/build/strings/trufflehogConfig.js.map +1 -0
- package/build/strings/trufflehogDownload.js +115 -0
- package/build/strings/trufflehogDownload.js.map +1 -0
- package/build/utility/ai.js +33 -4
- package/build/utility/ai.js.map +1 -1
- package/build/utility/banner.js +4 -3
- package/build/utility/banner.js.map +1 -1
- package/build/utility/configureSandbox.js +2 -2
- package/build/utility/configureSandbox.js.map +1 -1
- package/build/utility/downloadProgress.js +99 -0
- package/build/utility/downloadProgress.js.map +1 -0
- package/build/utility/globals.js +19 -11
- package/build/utility/globals.js.map +1 -1
- package/build/utility/heap.js +2 -1
- package/build/utility/heap.js.map +1 -1
- package/build/utility/makeReq.js +490 -257
- package/build/utility/makeReq.js.map +1 -1
- package/build/utility/openapiGenerator.js +2 -2
- package/build/utility/openapiGenerator.js.map +1 -1
- package/build/utility/printMsg.js +53 -0
- package/build/utility/printMsg.js.map +1 -0
- package/build/utility/progressLog.js +68 -7
- package/build/utility/progressLog.js.map +1 -1
- package/build/utility/resolvePath.js +2 -1
- package/build/utility/resolvePath.js.map +1 -1
- package/build/utility/ruleVersionMap.js +73 -0
- package/build/utility/ruleVersionMap.js.map +1 -0
- package/build/utility/targetInputs.js +177 -0
- package/build/utility/targetInputs.js.map +1 -0
- package/build/utility/urlUtils.js +37 -1
- package/build/utility/urlUtils.js.map +1 -1
- package/config.dist.yaml +251 -0
- package/contributing/testing.md +106 -0
- package/eslint.config.js +24 -0
- package/package.json +22 -5
- package/scripts/exploit-smoke-test.js +82 -0
- package/scripts/framework-detect-smoke-test.js +64 -0
- package/scripts/postinstall-completion.mjs +40 -0
- package/scripts/smoke-test.js +12 -0
- package/build/lazyLoad/downloadLoadedJsUtil.js +0 -98
- package/build/lazyLoad/downloadLoadedJsUtil.js.map +0 -1
- package/build/map/next_js/interactive_helpers/esqueryGen.js.map +0 -1
- package/build/map/next_js/interactive_helpers/inputPatch.js.map +0 -1
- package/build/map/next_js/interactive_helpers/keybindings.js.map +0 -1
- package/build/map/next_js/interactive_helpers/printer.js.map +0 -1
- package/build/map/next_js/interactive_helpers/ui.js.map +0 -1
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/esqueryGen.js +0 -0
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/inputPatch.js +0 -0
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/keybindings.js +0 -0
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/printer.js +0 -0
- /package/build/map/{next_js/interactive_helpers → interactive-mode}/ui.js +0 -0
package/build/index.js
CHANGED
|
@@ -8,30 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import { program } from "commander";
|
|
12
|
-
import lazyLoad from "./lazyLoad/index.js";
|
|
13
|
-
import { FRAMEWORK_METHODS, VALID_METHODS } from "./lazyLoad/methodFilter.js";
|
|
14
|
-
import endpoints from "./endpoints/index.js";
|
|
15
|
-
import CONFIG from "./globalConfig.js";
|
|
16
|
-
import strings from "./strings/index.js";
|
|
17
|
-
import proxy from "./proxy/index.js";
|
|
18
|
-
import configureProxy from "./utility/configureProxy.js";
|
|
19
|
-
import map from "./map/index.js";
|
|
20
|
-
import * as globalsUtil from "./utility/globals.js";
|
|
21
|
-
import refactor from "./refactor/index.js";
|
|
22
|
-
import run from "./run/index.js";
|
|
23
11
|
import chalk from "chalk";
|
|
24
|
-
import
|
|
25
|
-
import report from "./report/index.js";
|
|
26
|
-
import configureSandbox from "./utility/configureSandbox.js";
|
|
27
|
-
import mcp from "./mcp/index.js";
|
|
28
|
-
import load from "./load/index.js";
|
|
29
|
-
import fingerprint from "./fingerprint/index.js";
|
|
30
|
-
import { applyHeapLimit } from "./utility/heap.js";
|
|
31
|
-
import csMast from "./cs_mast/index.js";
|
|
32
|
-
import sourcemaps from "./sourcemaps/index.js";
|
|
12
|
+
import { buildProgram } from "./cliProgram.js";
|
|
33
13
|
import { printBanner } from "./utility/banner.js";
|
|
34
|
-
import
|
|
14
|
+
import { ApplicationConfigError } from "./config/applicationConfig.js";
|
|
15
|
+
import { OxylabsFallbackConfigurationError } from "./proxy/oxylabsFallback.js";
|
|
16
|
+
import { TargetInputError } from "./utility/targetInputs.js";
|
|
17
|
+
import { RunOutputDirectoryError } from "./run/outputDirectory.js";
|
|
35
18
|
const args = process.argv.slice(2);
|
|
36
19
|
const isVersionFlag = args.length === 1 && (args[0] === "-V" || args[0] === "--version");
|
|
37
20
|
const isCompletionCmd = args[0] === "completion";
|
|
@@ -42,542 +25,20 @@ if (!isVersionFlag && !isCompletionCmd) {
|
|
|
42
25
|
* Main CLI application entry point for js-recon tool.
|
|
43
26
|
* Sets up command-line interface with various modules for JavaScript reconnaissance.
|
|
44
27
|
*/
|
|
45
|
-
|
|
46
|
-
program
|
|
47
|
-
|
|
48
|
-
styleCommandText: (str) => chalk.bold(str),
|
|
49
|
-
styleCommandDescription: (str) => chalk.dim(str),
|
|
50
|
-
styleDescriptionText: (str) => chalk.dim(str),
|
|
51
|
-
styleOptionText: (str) => chalk.yellow(str),
|
|
52
|
-
styleArgumentText: (str) => chalk.green(str),
|
|
53
|
-
styleSubcommandText: (str) => chalk.cyan(str),
|
|
54
|
-
styleOptionTerm: (str) => {
|
|
55
|
-
// Color flags yellow, <required> args magenta, [optional] args cyan
|
|
56
|
-
return str
|
|
57
|
-
.split(" ")
|
|
58
|
-
.map((word) => {
|
|
59
|
-
if (word.startsWith("<") && word.endsWith(">"))
|
|
60
|
-
return chalk.magenta(word);
|
|
61
|
-
if (word.startsWith("[") && word.endsWith("]"))
|
|
62
|
-
return chalk.cyan(word);
|
|
63
|
-
return chalk.yellow(word);
|
|
64
|
-
})
|
|
65
|
-
.join(" ");
|
|
66
|
-
},
|
|
67
|
-
styleOptionDescription: (str) => str.replace(/(\(default:[^)]*\))/g, chalk.dim.italic("$1")),
|
|
68
|
-
});
|
|
69
|
-
/** Valid AI options for analysis modules */
|
|
70
|
-
const validAiOptions = ["description"];
|
|
71
|
-
/**
|
|
72
|
-
* Validates a timeout string and updates the global request timeout.
|
|
73
|
-
* @param timeoutValue Timeout value provided via CLI.
|
|
74
|
-
*/
|
|
75
|
-
function parseMaxHeapMb(rawValue) {
|
|
76
|
-
const parsed = parseInt(rawValue !== null && rawValue !== void 0 ? rawValue : "0", 10);
|
|
77
|
-
if (!Number.isInteger(parsed) || parsed < 0) {
|
|
78
|
-
console.error(chalk.red(`[!] Invalid --max-heap value: ${rawValue}. Use 0 or a positive integer (MB).`));
|
|
79
|
-
process.exit(1);
|
|
80
|
-
}
|
|
81
|
-
return parsed;
|
|
28
|
+
try {
|
|
29
|
+
const program = buildProgram();
|
|
30
|
+
await (() => __awaiter(void 0, void 0, void 0, function* () { return program.parseAsync(process.argv); }))();
|
|
82
31
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
32
|
+
catch (error) {
|
|
33
|
+
if (error instanceof ApplicationConfigError ||
|
|
34
|
+
error instanceof OxylabsFallbackConfigurationError ||
|
|
35
|
+
error instanceof TargetInputError ||
|
|
36
|
+
error instanceof RunOutputDirectoryError) {
|
|
37
|
+
console.error(chalk.red(`[!] ${error.message}`));
|
|
38
|
+
process.exitCode = 1;
|
|
88
39
|
}
|
|
89
40
|
else {
|
|
90
|
-
|
|
41
|
+
throw error;
|
|
91
42
|
}
|
|
92
43
|
}
|
|
93
|
-
program
|
|
94
|
-
.command("lazyload")
|
|
95
|
-
.description("Run lazy load module")
|
|
96
|
-
.option("-u, --url <url/file>", "Target URL or a file containing a list of URLs (one per line)")
|
|
97
|
-
.option("-o, --output <directory>", "Output directory", "output")
|
|
98
|
-
.option("--strict-scope", "Download JS files from only the input URL domain", false)
|
|
99
|
-
.option("-s, --scope <scope>", "Download JS files from specific domains (comma-separated)", "*")
|
|
100
|
-
.option("-t, --threads <threads>", "Number of threads to use", "1")
|
|
101
|
-
.option("--subsequent-requests", "Download JS files from subsequent requests (Next.JS only)", false)
|
|
102
|
-
.option("--urls-file <file>", "Input JSON file containing URLs", "extracted_urls.json")
|
|
103
|
-
.option("--proxy-config <file>", "Proxy config file (generated via the `proxy` module)", ".proxy_config.json")
|
|
104
|
-
.option("--ignore-proxy-env", "Skip JS_RECON_* proxy environment variables during resolution", false)
|
|
105
|
-
.option("--cache-file <file>", "File to store response cache", ".resp_cache.json")
|
|
106
|
-
.option("--disable-cache", "Disable response caching", false)
|
|
107
|
-
.option("--cache-only", "Only use the response cache; never make network requests", false)
|
|
108
|
-
.option("-y, --yes", "Auto-approve executing JS code from the target", false)
|
|
109
|
-
.option("--timeout <timeout>", "Request timeout in ms", "30000")
|
|
110
|
-
.option("-k, --insecure", "Disable SSL certificate verification", false)
|
|
111
|
-
.option("--no-sandbox", "Disable browser sandbox")
|
|
112
|
-
.option("--build-id", "Get the buildId from the Next.js app", false)
|
|
113
|
-
.option("--sourcemap-dir <directory>", "Directory to write source maps", "extracted")
|
|
114
|
-
.option("--research", "Enable research mode", false)
|
|
115
|
-
.option("--research-output <file>", "Output file for research mode", "research.json")
|
|
116
|
-
.option("--max-iterations <iterations>", "Maximum number of recursive crawl iterations", "10")
|
|
117
|
-
.option("--max-js-size <mb>", "Maximum JS file size in MB to parse (Vue only)", "2")
|
|
118
|
-
.option("--lazyload-timeout <minutes>", "Hard timeout for the lazyload module in minutes (0 = no timeout)", "30")
|
|
119
|
-
.option("--detection-timeout <seconds>", "Timeout for front-end framework detection in seconds (0 = no timeout)", "30")
|
|
120
|
-
.option("--max-pages <pages>", "Maximum HTML pages to visit during Next.js crawl (0 = unlimited)", "200")
|
|
121
|
-
.option("--include-methods <methods>", "Comma-separated method names to run (whitelist). Use --list-methods to see valid names.")
|
|
122
|
-
.option("--exclude-methods <methods>", "Comma-separated method names to skip (blacklist). Use --list-methods to see valid names.")
|
|
123
|
-
.option("--list-methods [framework]", "Print available method names grouped by framework and exit. Optionally filter by framework (next_js, vue, nuxt_js, svelte, angular, react).")
|
|
124
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
-
// handle --list-methods before any network work
|
|
126
|
-
if (cmd.listMethods !== undefined) {
|
|
127
|
-
const filter = typeof cmd.listMethods === "string" ? cmd.listMethods : null;
|
|
128
|
-
const frameworkKeys = Object.keys(FRAMEWORK_METHODS);
|
|
129
|
-
if (filter && !frameworkKeys.includes(filter)) {
|
|
130
|
-
console.error(chalk.red(`[!] Unknown framework: "${filter}". Valid frameworks: ${frameworkKeys.join(", ")}`));
|
|
131
|
-
process.exit(1);
|
|
132
|
-
}
|
|
133
|
-
const keys = filter ? [filter] : frameworkKeys;
|
|
134
|
-
for (const fw of keys) {
|
|
135
|
-
console.log(chalk.cyan(`\n[${fw}]`));
|
|
136
|
-
for (const method of FRAMEWORK_METHODS[fw]) {
|
|
137
|
-
console.log(chalk.green(` - ${method}`));
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
process.exit(0);
|
|
141
|
-
}
|
|
142
|
-
// parse and validate method filter lists
|
|
143
|
-
const includeMethods = cmd.includeMethods
|
|
144
|
-
? cmd.includeMethods
|
|
145
|
-
.split(",")
|
|
146
|
-
.map((m) => m.trim())
|
|
147
|
-
.filter(Boolean)
|
|
148
|
-
: [];
|
|
149
|
-
const excludeMethods = cmd.excludeMethods
|
|
150
|
-
? cmd.excludeMethods
|
|
151
|
-
.split(",")
|
|
152
|
-
.map((m) => m.trim())
|
|
153
|
-
.filter(Boolean)
|
|
154
|
-
: [];
|
|
155
|
-
const allMethods = [...includeMethods, ...excludeMethods];
|
|
156
|
-
const invalid = allMethods.filter((m) => !VALID_METHODS.includes(m));
|
|
157
|
-
if (invalid.length > 0) {
|
|
158
|
-
console.error(chalk.red(`[!] Invalid method name(s): ${invalid.join(", ")}`));
|
|
159
|
-
console.error(chalk.yellow(`[i] Valid methods: ${VALID_METHODS.join(", ")}`));
|
|
160
|
-
process.exit(22);
|
|
161
|
-
}
|
|
162
|
-
if (!cmd.url) {
|
|
163
|
-
console.error(chalk.red("[!] Missing required option: -u, --url <url/file>"));
|
|
164
|
-
process.exit(1);
|
|
165
|
-
}
|
|
166
|
-
configureProxy(cmd);
|
|
167
|
-
globalsUtil.setDisableCache(cmd.disableCache);
|
|
168
|
-
globalsUtil.setRespCacheFile(cmd.cacheFile);
|
|
169
|
-
globalsUtil.setCacheOnly(cmd.cacheOnly);
|
|
170
|
-
globalsUtil.setYes(cmd.yes);
|
|
171
|
-
validateAndSetTimeout(cmd.timeout);
|
|
172
|
-
configureSandbox(cmd);
|
|
173
|
-
yield lazyLoad(cmd.url, cmd.output, cmd.strictScope, cmd.scope.split(","), Number(cmd.threads), cmd.subsequentRequests, cmd.urlsFile, cmd.insecure, cmd.buildId, cmd.sourcemapDir, cmd.research, cmd.researchOutput, Number(cmd.maxIterations), Number(cmd.maxJsSize), Number(cmd.lazyloadTimeout) * 60 * 1000, Number(cmd.maxPages), includeMethods, excludeMethods, Number(cmd.detectionTimeout) * 1000);
|
|
174
|
-
}));
|
|
175
|
-
program
|
|
176
|
-
.command("endpoints")
|
|
177
|
-
.description("Extract client-side endpoints")
|
|
178
|
-
.option("-u, --url <url>", "Target Base URL (will be used to resolve relative paths)")
|
|
179
|
-
.option("-d, --directory <directory>", "Directory containing JS files")
|
|
180
|
-
.option("-o, --output <filename>", "Output filename (without file extension)", "endpoints")
|
|
181
|
-
.option("--output-format <format>", "Output format for the results comma-separated (available: json)", "json")
|
|
182
|
-
.option("-t, --tech <tech>", "Technology used in the JS files (run with -l/--list to see available options)")
|
|
183
|
-
.option("-l, --list", "List available technologies", false)
|
|
184
|
-
.option("--mapped-json <file>", "Mapped JSON file (for Next.JS)")
|
|
185
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
186
|
-
yield endpoints(cmd.url, cmd.directory, cmd.output, cmd.outputFormat.split(","), cmd.tech, cmd.list, cmd.mappedJson);
|
|
187
|
-
}));
|
|
188
|
-
program
|
|
189
|
-
.command("strings")
|
|
190
|
-
.description("Extract strings from JS files")
|
|
191
|
-
.requiredOption("-d, --directory <directory>", "Directory containing JS files")
|
|
192
|
-
.option("-o, --output <file>", "JSON file to save the strings", "strings.json")
|
|
193
|
-
.option("-e, --extract-urls", "Extract URLs from strings", false)
|
|
194
|
-
.option("--extracted-url-path <file>", "Output file for extracted URLs and paths (without extension)", "extracted_urls")
|
|
195
|
-
.option("-p, --permutate", "Permutate URLs and paths found", false)
|
|
196
|
-
.option("--openapi", "Generate OpenAPI specification from the paths found", false)
|
|
197
|
-
.option("-s, --scan-secrets", "Scan for secrets", false)
|
|
198
|
-
.option("--trufflehog", "Run TruffleHog secret scanner on the output directory", false)
|
|
199
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
200
|
-
yield strings(cmd.directory, cmd.output, cmd.extractUrls, cmd.extractedUrlPath, cmd.scanSecrets, cmd.permutate, cmd.openapi, cmd.trufflehog);
|
|
201
|
-
}));
|
|
202
|
-
program
|
|
203
|
-
.command("proxy")
|
|
204
|
-
.description("Manage proxy configuration (AWS API Gateway IP rotation, SOCKS/HTTP, Oxylabs)")
|
|
205
|
-
.option("-i, --init", "Initialize the config file (create API) [aws method]", false)
|
|
206
|
-
.option("-d, --destroy <id>", "Destroy API with the given ID [aws method]")
|
|
207
|
-
.option("--destroy-all", "Destroy all the API created by this tool in all regions [aws method]", false)
|
|
208
|
-
.option("-r, --region <region>", "AWS region (default: random region) [aws method]")
|
|
209
|
-
.option("--aws-access-key <key>", "AWS access key (if not provided, AWS_ACCESS_KEY_ID environment variable will be used) [aws method]")
|
|
210
|
-
.option("--aws-secret-key <key>", "AWS secret key (if not provided, AWS_SECRET_ACCESS_KEY environment variable will be used) [aws method]")
|
|
211
|
-
.option("-c, --config <config>", "Name of the config file", ".proxy_config.json")
|
|
212
|
-
.option("-l, --list", "List all the API created by this tool [aws method]", false)
|
|
213
|
-
.option("--feasibility", "Check whether a firewall/WAF blocks the target directly and, if so, whether the proxy method (--proxy-method, or the one already configured via -i/--init) bypasses it", false)
|
|
214
|
-
.option("--feasibility-url <url>", "URL to check feasibility of")
|
|
215
|
-
.option("--proxy-method <method>", "Proxy method to configure with -i/--init: aws, socks, http, or oxylabs (omit for an interactive prompt)")
|
|
216
|
-
.option("--proxy <url>", "SOCKS5/HTTP proxy URL for -i/--init (socks5://[user:pass@]host:port or http://[user:pass@]host:port)")
|
|
217
|
-
.option("--oxylabs-username <username>", "Oxylabs datacenter proxy username for -i/--init")
|
|
218
|
-
.option("--oxylabs-password <password>", "Oxylabs datacenter proxy password for -i/--init")
|
|
219
|
-
.option("--oxylabs-country <country>", "Oxylabs datacenter proxy country code for -i/--init")
|
|
220
|
-
.option("--oxylabs-city <city>", "Oxylabs datacenter proxy city for -i/--init (currently unsupported — no documented username-level city targeting)")
|
|
221
|
-
.option("--oxylabs-session-id <id>", "Oxylabs datacenter proxy sticky session id for -i/--init (currently unsupported via username — sessions are selected by port)")
|
|
222
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
223
|
-
try {
|
|
224
|
-
yield proxy({
|
|
225
|
-
init: cmd.init,
|
|
226
|
-
destroy: cmd.destroy,
|
|
227
|
-
destroyAll: cmd.destroyAll,
|
|
228
|
-
list: cmd.list,
|
|
229
|
-
region: cmd.region,
|
|
230
|
-
awsAccessKey: cmd.awsAccessKey,
|
|
231
|
-
awsSecretKey: cmd.awsSecretKey,
|
|
232
|
-
config: cmd.config,
|
|
233
|
-
feasibility: cmd.feasibility,
|
|
234
|
-
feasibilityUrl: cmd.feasibilityUrl,
|
|
235
|
-
proxyMethod: cmd.proxyMethod,
|
|
236
|
-
proxyUrl: cmd.proxy,
|
|
237
|
-
oxylabsUsername: cmd.oxylabsUsername,
|
|
238
|
-
oxylabsPassword: cmd.oxylabsPassword,
|
|
239
|
-
oxylabsCountry: cmd.oxylabsCountry,
|
|
240
|
-
oxylabsCity: cmd.oxylabsCity,
|
|
241
|
-
oxylabsSessionId: cmd.oxylabsSessionId,
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
catch (err) {
|
|
245
|
-
console.error(chalk.red(`[!] ${err.message}`));
|
|
246
|
-
process.exit(1);
|
|
247
|
-
}
|
|
248
|
-
}));
|
|
249
|
-
program
|
|
250
|
-
.command("map")
|
|
251
|
-
.description("Map all the functions")
|
|
252
|
-
.option("-d, --directory <directory>", "Directory containing JS files")
|
|
253
|
-
.option("-t, --tech <tech>", "Technology used in the JS files (run with -l/--list to see available options)")
|
|
254
|
-
.option("-l, --list", "List available technologies", false)
|
|
255
|
-
.option("-o, --output <file>", "Output file name (without extension)", "mapped")
|
|
256
|
-
.option("-f, --format <format>", "Output format for the results comma-separated (available: JSON)", "json")
|
|
257
|
-
.option("-i, --interactive", "Interactive mode", false)
|
|
258
|
-
.option("-c, --command <command>", "Run an interactive-mode command non-interactively. Can be passed multiple times, or chain several with `&&` inside a single value (e.g. -c 'list fetch && go to 1234'), to run several commands in sequence.", (val, prev) => [...prev, ...val.split(/\s*&&\s*/).filter((c) => c.length > 0)], [])
|
|
259
|
-
.option("--ai <options>", "Use AI to analyze the code (comma-separated; available: description)")
|
|
260
|
-
.option("--ai-threads <threads>", "Number of threads to use for AI", "5")
|
|
261
|
-
.option("--ai-provider <provider>", "Service provider to use for AI (available: openai, ollama)", "openai")
|
|
262
|
-
.option("--ai-endpoint <endpoint>", "Endpoint to use for AI service (for Ollama, etc)")
|
|
263
|
-
.option("--openai-api-key <key>", "OpenAI API key")
|
|
264
|
-
.option("--model <model>", "AI model to use", "gpt-4o-mini")
|
|
265
|
-
.option("--openapi", "Generate OpenAPI spec from the code", false)
|
|
266
|
-
.option("--openapi-output <file>", "Output file for OpenAPI spec", "mapped-openapi.json")
|
|
267
|
-
.option("--openapi-chunk-tag", "Add chunk ID tag to OpenAPI spec for each request found", false)
|
|
268
|
-
.option("--no-graphql", "Disable GraphQL operation extraction during OpenAPI generation")
|
|
269
|
-
.option("--ngql", "Alias for --no-graphql")
|
|
270
|
-
.option("--max-recursion-depth <n>", "Max recursion depth for HTTP-client URL fan-out and cross-file resolution (default 3)", "3")
|
|
271
|
-
.option("--max-heap <mb>", "V8 heap size cap in MB (0 = all available RAM)")
|
|
272
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
273
|
-
var _a, _b;
|
|
274
|
-
if (cmd.maxHeap !== undefined)
|
|
275
|
-
applyHeapLimit(parseMaxHeapMb(cmd.maxHeap));
|
|
276
|
-
globalsUtil.setAi(((_a = cmd.ai) === null || _a === void 0 ? void 0 : _a.split(",")) || []);
|
|
277
|
-
globalsUtil.setAiServiceProvider(cmd.aiProvider);
|
|
278
|
-
globalsUtil.setOpenapiChunkTag(cmd.openapiChunkTag);
|
|
279
|
-
globalsUtil.setOpenaiApiKey(cmd.openaiApiKey);
|
|
280
|
-
globalsUtil.setAiModel(cmd.model);
|
|
281
|
-
if (cmd.aiEndpoint)
|
|
282
|
-
globalsUtil.setAiEndpoint(cmd.aiEndpoint);
|
|
283
|
-
globalsUtil.setAiThreads(cmd.aiThreads);
|
|
284
|
-
globalsUtil.setOpenapi(cmd.openapi);
|
|
285
|
-
globalsUtil.setOpenapiOutputFile(cmd.openapiOutput);
|
|
286
|
-
// Commander's --no-graphql flips cmd.graphql to false; --ngql is an alias.
|
|
287
|
-
globalsUtil.setGraphqlEnabled(cmd.graphql !== false && !cmd.ngql);
|
|
288
|
-
// validate AI options
|
|
289
|
-
if (globalsUtil.getAi().length !== 0) {
|
|
290
|
-
for (const aiType of globalsUtil.getAi()) {
|
|
291
|
-
if (aiType !== "" && !validAiOptions.includes(aiType)) {
|
|
292
|
-
console.error(chalk.red(`[!] Invalid AI option: ${aiType}`));
|
|
293
|
-
process.exit(1);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
const maxRecursionDepth = parseInt((_b = cmd.maxRecursionDepth) !== null && _b !== void 0 ? _b : "3", 10);
|
|
298
|
-
if (!Number.isFinite(maxRecursionDepth) || maxRecursionDepth < 0) {
|
|
299
|
-
console.error(chalk.red(`[!] Invalid --max-recursion-depth: ${cmd.maxRecursionDepth}`));
|
|
300
|
-
process.exit(1);
|
|
301
|
-
}
|
|
302
|
-
globalsUtil.setMaxRecursionDepth(maxRecursionDepth);
|
|
303
|
-
yield map(cmd.directory, cmd.output, cmd.format.split(","), cmd.tech, cmd.list, cmd.interactive, cmd.command || []);
|
|
304
|
-
}));
|
|
305
|
-
program
|
|
306
|
-
.command("refactor")
|
|
307
|
-
.description("Refactor the code")
|
|
308
|
-
.option("-m, --mapped-json <file>", "Mapped JSON file", "mapped.json")
|
|
309
|
-
.option("-o, --output <directory>", "Output directory", "output_refactored")
|
|
310
|
-
.option("-t, --tech <tech>", "Technology used in the JS files (run with -l/--list to see available options)")
|
|
311
|
-
.option("-l, --list", "List available technologies", false)
|
|
312
|
-
.option("--collisions <file>", "Local path to a CS-MAST collisions.json (or directory). Overrides the default remote HuggingFace signatures.")
|
|
313
|
-
.option("--sq, --signature-quality <number>", "Minimum signature quality threshold (0–100). A signature is used only when (count/sample_size)*100 >= threshold.", "100")
|
|
314
|
-
.option("--refresh-cache", "Force refresh the remote file list cache", false)
|
|
315
|
-
.option("--skip-cache-checks", "Skip cache age and 404-triggered refresh checks", false)
|
|
316
|
-
.option("--no-remote", "Disable remote HuggingFace signature fetch; run without library stripping unless --collisions is provided")
|
|
317
|
-
.option("--remote-collisions <path>", "HuggingFace dataset path to load collision signatures from (e.g. react/vite/large-0.1.8). Overrides the automatic tech-to-branch mapping. Exits with code 25 if the path does not exist.")
|
|
318
|
-
.option("--scat <categories>", "Override the CS-MAST scat categories used for library signature matching. Comma-separated list of: lit,id,op,decl,loop,cond,name,val,op_name (e.g. --scat lit,decl,cond). Overrides the default lit-decl-loop-cond config.")
|
|
319
|
-
.option("--detect-version", "Detect the React version used in the bundle and use it in the refactored output's package.json (react-webpack and react-vite only).", false)
|
|
320
|
-
.option("--detect-version-config <config>", 'Scat configuration for version detection. Use "dynamic" (default) to auto-select reliable configs, or pass comma-separated scat categories for a fixed config (e.g. lit,decl,loop,cond). Exits with code 26 if the static config has empty signatures for any known React version.')
|
|
321
|
-
.option("--detect-version-dynamic-threshold <n>", "Number of scat configs to select in dynamic version detection mode (default: 3). Must be a positive integer.", "3")
|
|
322
|
-
.option("--detect-version-dynamic-conf-purge", "Purge the cached dynamic scat config selection (stored in ~/.js-recon/refactor/config.json) and recompute it on this run.", false)
|
|
323
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
324
|
-
var _a, _b;
|
|
325
|
-
const scat = cmd.scat
|
|
326
|
-
? cmd.scat
|
|
327
|
-
.split(",")
|
|
328
|
-
.map((s) => s.trim())
|
|
329
|
-
.filter(Boolean)
|
|
330
|
-
: undefined;
|
|
331
|
-
const detectVersionDynamicThreshold = Number((_a = cmd.detectVersionDynamicThreshold) !== null && _a !== void 0 ? _a : 3);
|
|
332
|
-
if (!Number.isInteger(detectVersionDynamicThreshold) || detectVersionDynamicThreshold < 1) {
|
|
333
|
-
console.error(`[!] --detect-version-dynamic-threshold must be a positive integer (got "${cmd.detectVersionDynamicThreshold}")`);
|
|
334
|
-
process.exit(1);
|
|
335
|
-
}
|
|
336
|
-
yield refactor(cmd.mappedJson, cmd.output, cmd.tech, cmd.list, cmd.collisions, {
|
|
337
|
-
signatureQuality: Number((_b = cmd.signatureQuality) !== null && _b !== void 0 ? _b : 100),
|
|
338
|
-
refreshCache: !!cmd.refreshCache,
|
|
339
|
-
skipCacheChecks: !!cmd.skipCacheChecks,
|
|
340
|
-
noRemote: cmd.remote === false,
|
|
341
|
-
remoteCollisions: cmd.remoteCollisions,
|
|
342
|
-
scat,
|
|
343
|
-
detectVersion: !!cmd.detectVersion,
|
|
344
|
-
detectVersionConfig: cmd.detectVersionConfig,
|
|
345
|
-
detectVersionDynamicThreshold,
|
|
346
|
-
detectVersionDynamicConfPurge: !!cmd.detectVersionDynamicConfPurge,
|
|
347
|
-
});
|
|
348
|
-
}));
|
|
349
|
-
program
|
|
350
|
-
.command("analyze")
|
|
351
|
-
.description("Analyze the code")
|
|
352
|
-
.option("-r, --rules <file/dir>", "Rules file or directory")
|
|
353
|
-
.option("-m, --mapped-json <file>", "Mapped JSON file", "mapped.json")
|
|
354
|
-
.option("-t, --tech <tech>", "Technology used in the JS files (run with -l/--list to see available options)")
|
|
355
|
-
.option("--openapi <file>", "Path to OpenAPI spec file")
|
|
356
|
-
.option("-l, --list", "List available technologies", false)
|
|
357
|
-
.option("--validate", "Validate the rules", false)
|
|
358
|
-
.option("-o, --output <file>", "Output JSON file name", "analyze.json")
|
|
359
|
-
.option("--disable-rules-version-check", "Skip the GitHub rules version check and use cached rules as-is", false)
|
|
360
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
361
|
-
yield analyze(cmd.rules, cmd.mappedJson, cmd.tech, cmd.list, cmd.openapi, cmd.validate, cmd.output, !!cmd.disableRulesVersionCheck);
|
|
362
|
-
}));
|
|
363
|
-
program
|
|
364
|
-
.command("report")
|
|
365
|
-
.description("Generate a report")
|
|
366
|
-
.option("-s, --sqlite-db <file>", "SQLite database file", "js-recon.db")
|
|
367
|
-
.option("-m, --mapped-json <file>", "Mapped JSON file")
|
|
368
|
-
.option("-a, --analyze-json <file>", "Analyze JSON file")
|
|
369
|
-
.option("-e, --endpoints-json <file>", "Endpoints JSON file")
|
|
370
|
-
.option("--map-openapi, --mapped-openapi-json <file>", "Mapped OpenAPI JSON file")
|
|
371
|
-
.option("-o, --output <file>", "Output file name (without the extension)", "report")
|
|
372
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
373
|
-
yield report(cmd.sqliteDb, cmd.mappedJson, cmd.analyzeJson, cmd.endpointsJson, cmd.mappedOpenapiJson, cmd.output);
|
|
374
|
-
}));
|
|
375
|
-
program
|
|
376
|
-
.command("run")
|
|
377
|
-
.description("Run all modules")
|
|
378
|
-
.option("-u, --url <url/file>", "Target URL or a file containing a list of URLs (one per line)")
|
|
379
|
-
.option("-r, --rules <file/dir>", "Rules file or directory (passed to analyze module)")
|
|
380
|
-
.option("--disable-rules-version-check", "Skip the GitHub rules version check and use cached rules as-is (passed to analyze module)", false)
|
|
381
|
-
.option("-c, --command <command>", "Run an interactive-mode command on the mapped chunks non-interactively (forwarded to the map step). Can be passed multiple times, or chain several with `&&` inside a single value (e.g. -c 'list fetch && go to 1234').", (val, prev) => [...prev, ...val.split(/\s*&&\s*/).filter((c) => c.length > 0)], [])
|
|
382
|
-
.option("-o, --output <directory>", "Output directory", "output")
|
|
383
|
-
.option("--output-overwrite", "Overwrite the output directory if it already exists instead of erroring out. Can also be set via the JS_RECON_OUTPUT_OVERWRITE=true environment variable.", false)
|
|
384
|
-
.option("--strict-scope", "Download JS files from only the input URL domain", false)
|
|
385
|
-
.option("-s, --scope <scope>", "Download JS files from specific domains (comma-separated)", "*")
|
|
386
|
-
.option("-t, --threads <threads>", "Number of threads to use", "1")
|
|
387
|
-
.option("--proxy-config <file>", "Proxy config file (generated via the `proxy` module)", ".proxy_config.json")
|
|
388
|
-
.option("--ignore-proxy-env", "Skip JS_RECON_* proxy environment variables during resolution", false)
|
|
389
|
-
.option("--proxy-waf-fallback", "Before each target, check whether the configured proxy is needed and can bypass a WAF/firewall (reuses the `proxy --feasibility` logic); skip the target if the proxy can't bypass it", false)
|
|
390
|
-
.option("--cache-file <file>", "File to store response cache", ".resp_cache.json")
|
|
391
|
-
.option("--disable-cache", "Disable response caching", false)
|
|
392
|
-
.option("--cache-only", "Only use the response cache; never make network requests", false)
|
|
393
|
-
.option("-y, --yes", "Auto-approve executing JS code from the target", false)
|
|
394
|
-
.option("--secrets", "Scan for secrets", false)
|
|
395
|
-
.option("--trufflehog", "Run TruffleHog secret scanner on the output directory", false)
|
|
396
|
-
.option("--ai <options>", "Use AI to analyze the code (comma-separated; available: description)")
|
|
397
|
-
.option("--ai-threads <threads>", "Number of threads to use for AI", "5")
|
|
398
|
-
.option("--ai-provider <provider>", "Service provider to use for AI (available: openai, ollama)", "openai")
|
|
399
|
-
.option("--ai-endpoint <endpoint>", "Endpoint to use for AI service (for Ollama, etc)")
|
|
400
|
-
.option("--openai-api-key <key>", "OpenAI API key")
|
|
401
|
-
.option("--model <model>", "AI model to use", "gpt-4o-mini")
|
|
402
|
-
.option("--map-openapi-chunk-tag", "Add chunk ID tag to OpenAPI spec for each request found (map module)", false)
|
|
403
|
-
.option("--no-graphql", "Disable GraphQL operation extraction during OpenAPI generation")
|
|
404
|
-
.option("--ngql", "Alias for --no-graphql")
|
|
405
|
-
.option("--timeout <timeout>", "Request timeout in ms", "30000")
|
|
406
|
-
.option("-k, --insecure", "Disable SSL certificate verification", false)
|
|
407
|
-
.option("--no-sandbox", "Disable browser sandbox")
|
|
408
|
-
.option("--sourcemap-dir <directory>", "Directory to write source maps", "extracted")
|
|
409
|
-
.option("--research", "Enable research mode", false)
|
|
410
|
-
.option("--research-output <file>", "Output file for research mode", "research.json")
|
|
411
|
-
.option("--max-iterations <iterations>", "Maximum number of recursive crawl iterations", "10")
|
|
412
|
-
.option("--max-js-size <mb>", "Maximum JS file size in MB to parse (Vue only)", "2")
|
|
413
|
-
.option("--lazyload-timeout <minutes>", "Hard timeout for each lazyload step in minutes (0 = no timeout)", "30")
|
|
414
|
-
.option("--detection-timeout <seconds>", "Timeout for front-end framework detection in seconds (0 = no timeout)", "30")
|
|
415
|
-
.option("--max-heap <mb>", "V8 heap size cap in MB (0 = all available RAM)")
|
|
416
|
-
.option("--max-pages <pages>", "Maximum HTML pages to visit during Next.js crawl (0 = unlimited)", "200")
|
|
417
|
-
.option("--include-methods <methods>", "Comma-separated lazyload method names to run (whitelist). Use --list-methods to see valid names.")
|
|
418
|
-
.option("--exclude-methods <methods>", "Comma-separated lazyload method names to skip (blacklist). Use --list-methods to see valid names.")
|
|
419
|
-
.option("--list-methods [framework]", "Print available lazyload method names grouped by framework and exit. Optionally filter by framework (next_js, vue, nuxt_js, svelte, angular, react).")
|
|
420
|
-
.option("--cs-mast-tech-detect-threshold <n>", "Minimum CS-MAST-S signature matches required to detect bundler for the refactor step (0 = skip refactor)", "50")
|
|
421
|
-
.option("--disable-refactor", "Skip the automatic refactor step after report", false)
|
|
422
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
423
|
-
var _a;
|
|
424
|
-
// handle --list-methods before any network work
|
|
425
|
-
if (cmd.listMethods !== undefined) {
|
|
426
|
-
const filter = typeof cmd.listMethods === "string" ? cmd.listMethods : null;
|
|
427
|
-
const frameworkKeys = Object.keys(FRAMEWORK_METHODS);
|
|
428
|
-
if (filter && !frameworkKeys.includes(filter)) {
|
|
429
|
-
console.error(chalk.red(`[!] Unknown framework: "${filter}". Valid frameworks: ${frameworkKeys.join(", ")}`));
|
|
430
|
-
process.exit(1);
|
|
431
|
-
}
|
|
432
|
-
const keys = filter ? [filter] : frameworkKeys;
|
|
433
|
-
for (const fw of keys) {
|
|
434
|
-
console.log(chalk.cyan(`\n[${fw}]`));
|
|
435
|
-
for (const method of FRAMEWORK_METHODS[fw]) {
|
|
436
|
-
console.log(chalk.green(` - ${method}`));
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
process.exit(0);
|
|
440
|
-
}
|
|
441
|
-
// parse and validate method filter lists
|
|
442
|
-
const includeMethods = cmd.includeMethods
|
|
443
|
-
? cmd.includeMethods
|
|
444
|
-
.split(",")
|
|
445
|
-
.map((m) => m.trim())
|
|
446
|
-
.filter(Boolean)
|
|
447
|
-
: [];
|
|
448
|
-
const excludeMethods = cmd.excludeMethods
|
|
449
|
-
? cmd.excludeMethods
|
|
450
|
-
.split(",")
|
|
451
|
-
.map((m) => m.trim())
|
|
452
|
-
.filter(Boolean)
|
|
453
|
-
: [];
|
|
454
|
-
const allMethods = [...includeMethods, ...excludeMethods];
|
|
455
|
-
const invalid = allMethods.filter((m) => !VALID_METHODS.includes(m));
|
|
456
|
-
if (invalid.length > 0) {
|
|
457
|
-
console.error(chalk.red(`[!] Invalid method name(s): ${invalid.join(", ")}`));
|
|
458
|
-
console.error(chalk.yellow(`[i] Valid methods: ${VALID_METHODS.join(", ")}`));
|
|
459
|
-
process.exit(22);
|
|
460
|
-
}
|
|
461
|
-
cmd._includeMethods = includeMethods;
|
|
462
|
-
cmd._excludeMethods = excludeMethods;
|
|
463
|
-
if (!cmd.url) {
|
|
464
|
-
console.error(chalk.red("[!] Missing required option: -u, --url <url/file>"));
|
|
465
|
-
process.exit(1);
|
|
466
|
-
}
|
|
467
|
-
if (cmd.maxHeap !== undefined)
|
|
468
|
-
applyHeapLimit(parseMaxHeapMb(cmd.maxHeap));
|
|
469
|
-
validateAndSetTimeout(cmd.timeout);
|
|
470
|
-
globalsUtil.setAi(((_a = cmd.ai) === null || _a === void 0 ? void 0 : _a.split(",")) || []);
|
|
471
|
-
globalsUtil.setOpenaiApiKey(cmd.openaiApiKey);
|
|
472
|
-
globalsUtil.setAiModel(cmd.model);
|
|
473
|
-
globalsUtil.setAiServiceProvider(cmd.aiProvider);
|
|
474
|
-
globalsUtil.setAiThreads(cmd.aiThreads);
|
|
475
|
-
if (cmd.aiEndpoint)
|
|
476
|
-
globalsUtil.setAiEndpoint(cmd.aiEndpoint);
|
|
477
|
-
globalsUtil.setOpenapiChunkTag(cmd.mapOpenapiChunkTag);
|
|
478
|
-
globalsUtil.setGraphqlEnabled(cmd.graphql !== false && !cmd.ngql);
|
|
479
|
-
globalsUtil.setDisableCache(cmd.disableCache);
|
|
480
|
-
globalsUtil.setRespCacheFile(cmd.cacheFile);
|
|
481
|
-
globalsUtil.setCacheOnly(cmd.cacheOnly);
|
|
482
|
-
configureSandbox(cmd);
|
|
483
|
-
// validate AI options
|
|
484
|
-
if (globalsUtil.getAi().length !== 0) {
|
|
485
|
-
for (const aiType of globalsUtil.getAi()) {
|
|
486
|
-
if (aiType !== "" && !validAiOptions.includes(aiType)) {
|
|
487
|
-
console.error(chalk.red(`[!] Invalid AI option: ${aiType}`));
|
|
488
|
-
process.exit(2);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
yield run(cmd);
|
|
493
|
-
}));
|
|
494
|
-
program
|
|
495
|
-
.command("load")
|
|
496
|
-
.description("Populate response cache from a Caido/Burp request history export")
|
|
497
|
-
.requiredOption("-c, --caido <file>", "Caido JSON export file")
|
|
498
|
-
.requiredOption("-u, --url <url>", "Target URL — only entries matching this host/port/scheme are loaded")
|
|
499
|
-
.option("--cache-file <file>", "Response cache file to write", ".resp_cache.json")
|
|
500
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
501
|
-
globalsUtil.setRespCacheFile(cmd.cacheFile);
|
|
502
|
-
yield load(cmd.caido, cmd.url);
|
|
503
|
-
}));
|
|
504
|
-
program
|
|
505
|
-
.command("fingerprint")
|
|
506
|
-
.description("Detect front-end frameworks across one or more URLs")
|
|
507
|
-
.requiredOption("-u, --url <url/file>", "Target URL or a file containing a list of URLs (one per line)")
|
|
508
|
-
.option("-o, --output <file>", "Output file to write results")
|
|
509
|
-
.option("-f, --format <formats>", "Output format(s): text, csv, json, jsonl (comma-separated)", "text")
|
|
510
|
-
.option("-t, --threads <threads>", "Number of concurrent detection workers", "5")
|
|
511
|
-
.option("--timeout <timeout>", "Request timeout in ms", "30000")
|
|
512
|
-
.option("-k, --insecure", "Disable SSL certificate verification", false)
|
|
513
|
-
.option("--no-sandbox", "Disable browser sandbox")
|
|
514
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
515
|
-
validateAndSetTimeout(cmd.timeout);
|
|
516
|
-
globalsUtil.setDisableCache(true);
|
|
517
|
-
globalsUtil.setYes(true);
|
|
518
|
-
configureSandbox(cmd);
|
|
519
|
-
yield fingerprint(cmd.url, cmd.output, cmd.format, Number(cmd.threads));
|
|
520
|
-
}));
|
|
521
|
-
program
|
|
522
|
-
.command("mcp")
|
|
523
|
-
.description("AI-powered CLI / one-shot chat / Model Context Protocol server for js-recon")
|
|
524
|
-
.option("--cli", "Start interactive CLI mode", false)
|
|
525
|
-
.option("--server", "Start a Model Context Protocol server over stdio", false)
|
|
526
|
-
.option("-c, --chat <prompt>", "Send a one-shot prompt to the AI agent non-interactively (can be passed multiple times)", (val, prev) => [...prev, val], [])
|
|
527
|
-
.option("--config <file>", "Path to MCP config file", undefined)
|
|
528
|
-
.option("--api-key <key>", "API key for the LLM provider")
|
|
529
|
-
.option("--model <model>", "AI model to use (e.g. gpt-4o-mini, claude-sonnet-4-20250514)")
|
|
530
|
-
.option("--provider <provider>", "LLM provider to use (openai, anthropic)")
|
|
531
|
-
.option("--no-refresh-claude-creds", "Do not auto-refresh Claude Code OAuth tokens; fail if expired")
|
|
532
|
-
.option("--claude-client-id <id>", "OAuth client ID used when refreshing Claude Code credentials")
|
|
533
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
534
|
-
yield mcp({
|
|
535
|
-
cli: cmd.cli,
|
|
536
|
-
server: cmd.server,
|
|
537
|
-
chat: cmd.chat,
|
|
538
|
-
configFile: cmd.config,
|
|
539
|
-
apiKey: cmd.apiKey,
|
|
540
|
-
model: cmd.model,
|
|
541
|
-
provider: cmd.provider,
|
|
542
|
-
refreshClaudeCreds: cmd.refreshClaudeCreds,
|
|
543
|
-
claudeClientId: cmd.claudeClientId,
|
|
544
|
-
});
|
|
545
|
-
}));
|
|
546
|
-
program
|
|
547
|
-
.command("cs-mast")
|
|
548
|
-
.description("Compute CS-MAST hashes for downloaded JS files and find structural collisions")
|
|
549
|
-
.option("-o, --output <directory>", "Output directory to scan for JS files", "output")
|
|
550
|
-
.option("--ct, --collision-table", "Find and display hash collisions", false)
|
|
551
|
-
.option("--min-collisions <n>", "Minimum times a hash must appear to be reported", "2")
|
|
552
|
-
.option("--co, --collision-output <file>", "Write collision results to a file")
|
|
553
|
-
.option("--cf, --collision-format <format>", "Output format for collision file: json or csv", "csv")
|
|
554
|
-
.option("--scat <categories>", "Comma-separated scat categories (e.g. lit,decl,loop,cond)", "lit,decl,loop,cond")
|
|
555
|
-
.option("--sinc <nodes>", "Comma-separated exact node types to include via sinc (e.g. IfStatement)", "")
|
|
556
|
-
.option("--all-scat-permutations", "Run all 511 non-empty scat permutations and save per-permutation collision files", false)
|
|
557
|
-
.option("--perm-output <dir>", "Output directory for per-permutation collision files (required with --all-scat-permutations)")
|
|
558
|
-
.option("--perm-concurrency <n>", "Number of parallel permutation workers (default: half of CPU count)", "0")
|
|
559
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
560
|
-
yield csMast(cmd.output, cmd.collisionTable, parseInt(cmd.minCollisions, 10), cmd.collisionOutput, cmd.collisionFormat, cmd.scat, cmd.sinc || "", cmd.allScatPermutations, cmd.permOutput, parseInt(cmd.permConcurrency, 10));
|
|
561
|
-
}));
|
|
562
|
-
program
|
|
563
|
-
.command("sourcemaps")
|
|
564
|
-
.description("Extract source files from .map sourcemap file(s)")
|
|
565
|
-
.requiredOption("-i, --input <path>", "Single .map file or directory containing .map files")
|
|
566
|
-
.option("-o, --output <directory>", "Output directory for extracted source files", "extracted")
|
|
567
|
-
.action((cmd) => __awaiter(void 0, void 0, void 0, function* () {
|
|
568
|
-
yield sourcemaps(cmd.input, cmd.output);
|
|
569
|
-
}));
|
|
570
|
-
program
|
|
571
|
-
.command("completion")
|
|
572
|
-
.description("Generate shell completion scripts for bash, zsh, or fish")
|
|
573
|
-
.argument("<shell>", "Shell type: bash, zsh, or fish")
|
|
574
|
-
.addHelpText("after", `
|
|
575
|
-
Examples:
|
|
576
|
-
eval "$(js-recon completion bash)" # Add to ~/.bashrc
|
|
577
|
-
eval "$(js-recon completion zsh)" # Add to ~/.zshrc
|
|
578
|
-
js-recon completion fish > ~/.config/fish/completions/js-recon.fish`)
|
|
579
|
-
.action((shell) => __awaiter(void 0, void 0, void 0, function* () {
|
|
580
|
-
completion(shell);
|
|
581
|
-
}));
|
|
582
|
-
program.parse(process.argv);
|
|
583
44
|
//# sourceMappingURL=index.js.map
|