CLI Cheat Sheet [old]
General
Section titled “General”View help:
# root commandnightvision --help
# subcommandnightvision scan --helpThis will
Log in with the CLI:
nightvision loginProject
Section titled “Project”nightvision scan --help🔑 Login
Section titled “🔑 Login”nightvision login🖨️ Print NightVision token
Section titled “🖨️ Print NightVision token”This can be helpful if you are trying to print a token that you can put in GitHub Actions, for example.
nightvision token createCreate Project
Section titled “Create Project”This can be helpful if you want to create a new project instead of the default project created by NightVision, for example.
nightvision project create project-nameSet a Project
Section titled “Set a Project”This can be helpful if you want to set a project as your default project in the CLI so that you don’t have to pass “-p” flag with the other commands.
nightvision project set project-nameNote: After setting a project as default, all the apps/targets/auths will be created under it. To reference a different project, use the “-p project-name” or “-P project-id” flag to the relevant commands.
Create Application
Section titled “Create Application”This can be helpful if you want to create a new application instead of the default application created by NightVision, for example.
nightvision app create $APPScanning
Section titled “Scanning”⚡️ Scan a Web App
Section titled “⚡️ Scan a Web App”nightvision app create testphpnightvision target create testphp http://testphp.vulwneb.comnightvision scan testphp -t testphp⚡️ Scan an API
Section titled “⚡️ Scan an API”### Using an extracted Swagger specgit clone https://github.com/vulnerable-apps/javaspringvulny.gitcd javaspringvulny
# create app and targetURL="https://localhost:9000"# In this example we will reuse the same name. You may use different names on your own objects.APP="javaspringvulny-api"TARGET="javaspringvulny-api"nightvision app create $APPnightvision target create $TARGET $URL --type api
# Extract the docsnightvision swagger extract ./ -t $TARGET --lang spring
# Run the scan. It will automatically select the Swagger specnightvision scan $TARGET -a $APPListing Resources
Section titled “Listing Resources”📃 List Credentials
Section titled “📃 List Credentials”nightvision token list📃 List Issues for a Given Scan
Section titled “📃 List Issues for a Given Scan”# List Issuesnightvision scan issues -s scan-idAPI Extraction
Section titled “API Extraction”🔪 Extract API Documentation
Section titled “🔪 Extract API Documentation”# Clone an example appgit clone https://github.com/vulnerable-apps/javaspringvulny.git
# create app and targetURL="https://localhost:9000"APP="javaspringvulny-web"TARGET="javaspringvulny-web"# we will create the target and auth with same name. You can provide different names.nightvision app create $APPnightvision target create $TARGET $URL --type api
# Extract the docsnightvision swagger extract ./ -t ${TARGET} --lang spring🔍 Compare Two API Specs
Section titled “🔍 Compare Two API Specs”# Compare paths between two OpenAPI spec files: new and oldnightvision swagger diff ./openapi-old.yaml ./generated-new.yamlRecording Authentication
Section titled “Recording Authentication”🔒 Record Authentication (Playwright)
Section titled “🔒 Record Authentication (Playwright)”URL="https://localhost:9000"APP="javaspringvulny-web"# we will create the target and auth with same name. You can provide different names.nightvision app create $APPnightvision target create $APP $URLnightvision auth playwright create $URL -n $APP🌐 Create a Cookie for Authentication
Section titled “🌐 Create a Cookie for Authentication”# Single Cookienightvision auth cookies create --name myapp-auth -H "Cookie: Authorization=jwtvalue"
# Multiple Cookiesnightvision auth cookies create --name myapp-auth2 -H "Cookie: Authorization=jwtvalue" -H "X-Header: value"🌐 Create a Header for Authentication
Section titled “🌐 Create a Header for Authentication”# Single Headernightvision auth header create --name myapp-auth -H "Authorization:Bearer TOKEN"
# Multiple Headersnightvision auth header create --name myapp-auth2 -H "Authorization:jwtvalue" -H "Key:value"Disable Telemetry
Section titled “Disable Telemetry”The NightVision CLI interacts with our Telemetry service to report metrics such as CLI version, languages analyzed, scan IDs, and crash logs. This helps our team prioritize bug fixes and make feature and roadmap decisions. Additionally, if you reach out to our team for support, you can just provide a UUID printed with the crash logs, and our team will be better equipped to assist you with your problem.
If you want to disable this behavior, you can set this environment variable.
export NIGHTVISION_DISABLE_TELEMETRY=1