Skip to content
KitploitKITPLOIT
OutilsBlog
Soumettre
OutilsBlog
Soumettre

Outils de Hacking, PenTest et Cybersécurité pour votre Arsenal de Sécurité !

Kitploit est un répertoire d'outils de hacking, de cybersécurité et de pentesting. Découvrez les dernières mises à jour des projets pour trouver des vulnérabilités, analyser des systèmes, automatiser les tests et renforcer votre sécurité.

··Flux·Contact·Confidentialité·© 2026 Kitploit

Répertoire d'outils

Catégories

Voir toutes les catégories
Loading categories
sj — Un outil d'audit des endpoints définis dans des fichiers de définition Swagger/OpenAPI exposés. | Kitploit
Outils/GitHubGitHub/bishopfox/sj
Scanners de VulnérabilitésTests de Sécurité des APISécurité WebTests d'Intrusion
GitHubbishopfox/sj

sj

Un outil d'audit des endpoints définis dans des fichiers de définition Swagger/OpenAPI exposés.

Voir le dépôt
867113il y a 29 joursVérifié par Kitploit

Populaires

Voir tout →

Découvrez les outils les plus utilisés par notre communauté.

Explorer tous les outils

Parcourez notre collection d'outils

Voir tous les outils →
Partager

sj (Swagger Jacker)

sj est un outil en ligne de commande conçu pour faciliter l'audit des fichiers de définition Swagger/OpenAPI exposés, en vérifiant les points de terminaison API associés pour une authentification faible. Il fournit également des modèles de commandes pour les tests de vulnérabilité manuels.

Pour ce faire, il analyse le fichier de définition pour trouver les chemins, paramètres et méthodes acceptées, puis utilise les résultats avec l'une des cinq sous-commandes :

  • automate - Fabrique une série de requêtes et analyse le code de statut de la réponse.
  • prepare - Génère une liste de commandes à utiliser pour les tests manuels.
  • endpoints - Génère une liste de routes API brutes. Les valeurs des chemins ne seront pas remplacées par des données de test.
  • brute - Envoie une série de requêtes à une cible pour trouver des définitions d'opérations basées sur des chemins de fichiers couramment utilisés.
  • convert - Convertit un fichier de définition de la version v2 vers la version v3.

Build

Pour compiler à partir des sources, assurez-vous d'avoir Go version >= 1.22.5 installé et exécutez go build depuis le dépôt :

root@kitploit:~
$ git clone https://github.com/BishopFox/sj.git
$ cd sj/
$ go build .

Installer

Pour installer la dernière version de l'outil, exécutez :

root@kitploit:~
$ go install github.com/BishopFox/sj@latest

# Remarque : vous devrez peut-être aussi placer le chemin vers vos binaires Go dans votre variable d'environnement PATH :
$ export PATH=$PATH:~/go/bin

Utilisation

Utilisez la commande automate pour envoyer une série de requêtes à chaque point de terminaison défini et analyser le code de statut de chaque réponse.

root@kitploit:~
$ sj automate -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080               

Gathering API details.
Title: Swagger Petstore
Description: This is a sample server Petstore server.  You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).  For this sample, you can use the api key `special-key` to test the authorization filters.
✓  GET  200  /v2/pet/findByStatus
✓  GET  200  /v2/user/logout
⚠  POST  400  /v2/user/createWithArray
⚠  POST  400  /v2/store/order
✗  GET  404  /v2/store/order/1
⚠  POST  400  /v2/pet
⚠  PUT  415  /v2/pet
⚠  POST  400  /v2/user/createWithList
✗  GET  404  /v2/user/bishopfox
⚠  PUT  415  /v2/user/bishopfox
⚠  POST  400  /v2/user
⚠  POST  415  /v2/pet/1/uploadImage
✓  GET  200  /v2/pet/findByTags
✗  GET  404  /v2/pet/1
⚠  POST  415  /v2/pet/1
✓  GET  200  /v2/store/inventory
✓  GET  200  /v2/user/login

Vous pouvez utiliser l'indicateur --replay-proxy pour rejouer les requêtes correspondantes via un proxy séparé (par exemple, Burp Suite). Cela vous permet d'acheminer tout le trafic via un proxy (ou directement) tout en envoyant uniquement les résultats intéressants à votre proxy d'interception :

root@kitploit:~
$ sj automate -u https://petstore.swagger.io/v2/swagger.json -qi --replay-proxy http://127.0.0.1:8080

Vous pouvez également le combiner avec --proxy pour acheminer le trafic de scan via un proxy différent tout en rejouant les correspondances vers Burp :

root@kitploit:~
$ sj automate -u https://petstore.swagger.io/v2/swagger.json -qi -p http://proxy:9090 --replay-proxy http://127.0.0.1:8080

Vous pouvez également demander une sortie détaillée pour voir la réponse partielle (ou complète) :

root@kitploit:~
$ sj automate -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080 -v           

Gathering API details.
Title: Swagger Petstore
Description: This is a sample server Petstore server.  You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).  For this sample, you can use the api key `special-key` to test the authorization filters.
✗  GET  404  /v2/user/bishopfox
   {"code":1,"type":"error","message":"User not found
⚠  PUT  415  /v2/user/bishopfox
   {"code":415,"type":"unknown","message":"com.sun.je
✓  GET  200  /v2/user/logout
   {"code":200,"type":"unknown","message":"ok"}
⚠  POST  400  /v2/user/createWithArray
   {"code":400,"type":"unknown","message":"bad input"
⚠  POST  400  /v2/user/createWithList
   {"code":400,"type":"unknown","message":"bad input"
✗  GET  404  /v2/pet/1
   {"code":1,"type":"error","message":"Pet not found"
⚠  POST  415  /v2/pet/1
   {"code":415,"type":"unknown"}
✓  GET  200  /v2/store/inventory
   {"sold":117,"string":26,"invalidStatus":1,"-1":1,"
⚠  POST  400  /v2/store/order
   {"code":400,"type":"unknown","message":"bad input"
✓  GET  200  /v2/user/login
   {"code":200,"type":"unknown","message":"logged in 
⚠  POST  400  /v2/pet
   {"code":400,"type":"unknown","message":"bad input"
⚠  PUT  415  /v2/pet
   {"code":415,"type":"unknown","message":"com.sun.je
✓  GET  200  /v2/pet/findByStatus
   []
✓  GET  200  /v2/pet/findByTags
   []
✗  GET  404  /v2/store/order/1
   {"code":1,"type":"error","message":"Order not foun
⚠  POST  400  /v2/user
   {"code":400,"type":"unknown","message":"bad input"
⚠  POST  415  /v2/pet/1/uploadImage
   {"code":415,"type":"unknown"}

Utilisez la commande prepare pour préparer une liste de commandes pour les tests manuels. Prend actuellement en charge curl et sqlmap. Vous devrez probablement les modifier légèrement.

root@kitploit:~
$ sj prepare -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080      

INFO[0000] Gathering API details.
                      
Title: Swagger Petstore
Description: This is a sample server Petstore server.  You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).  For this sample, you can use the api key `special-key` to test the authorization filters.
$ curl -X POST "https://petstore.swagger.io/v2/pet/{petId}"
$ curl -X GET "https://petstore.swagger.io/v2/pet/{petId}"
$ curl -X GET "https://petstore.swagger.io/v2/store/inventory"
$ curl -X POST "https://petstore.swagger.io/v2/user/createWithList" -d 'body=1'
$ curl -X GET "https://petstore.swagger.io/v2/user/logout"
$ curl -X POST "https://petstore.swagger.io/v2/user/createWithArray" -d 'body=1'
$ curl -X GET "https://petstore.swagger.io/v2/pet/findByStatus"
$ curl -X GET "https://petstore.swagger.io/v2/pet/findByTags"
$ curl -X POST "https://petstore.swagger.io/v2/store/order" -d 'petId=1&quantity=1&shipDate=bishopfox&status=bishopfox&complete=1&id=1&body='
$ curl -X POST "https://petstore.swagger.io/v2/pet/{petId}/uploadImage"
$ curl -X POST "https://petstore.swagger.io/v2/pet" -d 'photoUrls=1&tags=1&status=bishopfox&id=1&category=&name=doggie&body='
$ curl -X PUT "https://petstore.swagger.io/v2/pet" -d 'id=1&category=&name=doggie&photoUrls=1&tags=1&status=bishopfox&body='
$ curl -X GET "https://petstore.swagger.io/v2/user/{username}"
$ curl -X PUT "https://petstore.swagger.io/v2/user/{username}" -d 'email=bishopfox&password=bishopfox&phone=bishopfox&userStatus=1&id=1&username=bishopfox&firstName=bishopfox&lastName=bishopfox&body='
$ curl -X GET "https://petstore.swagger.io/v2/user/login"
$ curl -X POST "https://petstore.swagger.io/v2/user" -d 'phone=bishopfox&userStatus=1&id=1&username=bishopfox&firstName=bishopfox&lastName=bishopfox&email=bishopfox&password=bishopfox&body='
$ curl -X GET "https://petstore.swagger.io/v2/store/order/{orderId}"

Utilisez la commande endpoints pour générer une liste de points de terminaison bruts à partir du fichier de définition fourni.

root@kitploit:~
$ sj endpoints -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080

INFO[0000] Gathering endpoints.
                        
/v2/store/inventory
/v2/store/order/{orderId}
/v2/pet
/v2/pet
/v2/store/order
/v2/user/createWithList
/v2/pet/{petId}/uploadImage
/v2/pet/findByTags
/v2/pet/{petId}
/v2/pet/{petId}
/v2/user/{username}
/v2/user/{username}
/v2/user/createWithArray
/v2/pet/findByStatus
/v2/user/login
/v2/user/logout
/v2/user

Utilisez la commande brute pour envoyer une série de requêtes dans le but de trouver un fichier de définition sur la cible.

root@kitploit:~
$ sj brute -u https://petstore.swagger.io -qi -p http://127.0.0.1:8080 -e
INFO[0000] Sending 2173 requests. This could take a while... 
Request: 343
INFO[0033] Definition file found: https://petstore.swagger.io/v2/swagger 

Utilisez la commande convert pour convertir un fichier de définition de la version 2 à la version 3.

root@kitploit:~
$ sj convert -u https://petstore.swagger.io/v2/swagger.json -qi -p http://127.0.0.1:8080 -o openapi.json

INFO[0000] Gathering API details.
                      
INFO[0000] Wrote file to /current/directory/openapi.json 

Aide

Une liste complète des commandes est accessible via l'indicateur --help :

root@kitploit:~
$ sj --help
The process of reviewing and testing exposed API definition files is often tedious and requires a large investment of time for a thorough review.

sj (swaggerjacker) is a CLI tool that can be used to perform an initial check of API endpoints identified through exposed Swagger/OpenAPI definition files. 
Once you determine what endpoints require authentication and which do not, you can use the "prepare" command to generate command templates for further (manual) testing.

Example usage:

Perform a quick check of endpoints which require authentication:
$ sj automate -u https://petstore.swagger.io/v2/swagger.json

Generate a list of commands to use for manual testing:
$ sj prepare -u https://petstore.swagger.io/v2/swagger.json

Generate a list of raw API routes for use with custom scripts:
$ sj endpoints -u https://petstore.swagger.io/v2/swagger.json

Perform a brute-force attack against the target to identify hidden definition files:
$ sj brute -u https://petstore.swagger.io

Convert a Swagger (v2) definition file to an OpenAPI (v3) definition file:
$ sj convert -u https://petstore.swagger.io/v2/swagger.json -o openapi.json

Usage:
  sj [flags]
  sj [command]

Available Commands:
  automate    Sends a series of automated requests to the discovered endpoints.
  brute       Sends a series of automated requests to discover hidden API operation definitions.
  convert     Converts a Swagger definition file to an OpenAPI v3 definition file.
  endpoints   Prints a list of endpoints from the target.
  help        Help about any command
  prepare     Prepares a set of commands for manual testing of each endpoint.

Flags:
  -A, --agent string            Set the User-Agent string. (default "Swagger Jacker (github.com/BishopFox/sj)")
  -b, --base-path string        Set the API base path if not defined in the definition file (i.e. /V2/).
  -f, --format string           Declare the format of the definition file (json/yaml/yml/js). (default "json")
  -H, --headers stringArray     Add custom headers, separated by a colon ("Name: Value"). Multiple flags are accepted.
  -h, --help                    help for sj
  -i, --insecure                Ignores server certificate validation.
  -l, --local-file string       Loads the documentation from a local file.
  -o, --outfile string          Output the results to a file. Only supported for the 'automate' and 'brute' commands at this time.
  -p, --proxy string            Proxy host and port. Example: http://127.0.0.1:8080 (default "NOPROXY")
  -q, --quiet                   Do not prompt for user input - uses default values for all requests.
      --replay-proxy string     Replay matched requests using this proxy.
      --randomize-user-agent    Randomizes the user agent string. Default is 'false'.
  -s, --safe-word stringArray   Avoids 'dangerous word' check for the specified word(s). Multiple flags are accepted.
  -T, --target string           Manually set a target for the requests to be made if separate from the host the documentation resides on.
  -t, --timeout int             Set the request timeout period. (default 30)
  -u, --url string              Loads the documentation file from a URL
  -v, --version                 version for sj

Use "sj [command] --help" for more information about a command.
Télécharger l’outil