Skip to main content

Export request to cURL

ยท 3 min read
Creator of Spider

After a short poll with users, I've added cURL export to HTTP communications panel.

You may, directly from the UI, generate and export cURL commands to replay a selected requests.
The cURL command is generated on the UI and copied in your clipboard.

Optionsโ€‹

You have these options:

  • Export as binary

Spider fetches the request body as it was transmitted over the network, encodes it as base64 and provides it as binary to cURL.

  • Export as text

Spider fetches the request body as text (or tries to), beautifies it if its content-type matches a known JSON or XML Mime, and provides it as text to cURL.
This mode is easier if you want to do changes ๐Ÿ˜‰

  • Export original

If x-forwarded-* headers are present, Spider tries to rebuild the original query (that was made to the reverse proxy).

  • Export as captured

Spider provides the request as it has been captured by the Whisperer.

note

Please note that:

  • Headers are lower cased
  • If filters are set up on the parsing configuration, Spider will only fetched the saved headers

UIโ€‹

The export button is as the top of the Global tab for HTTP communications.

cURL.png

Export samplesโ€‹

Samples of exported cURL commands in binary and text:

Original, binary
echo H4sIAAAAAAAAA5WQwUrEMBRF/yXrJrRpmrbZSkFBXMyMLhQXafOGKaZNJ0kZBvHfTUAFR7DTTXg87n3knJd3dDDOj3IAJNAJWmxBKty1XcUKzhUuj6NXxE29Aovd2XkYyGQU6fQcZku06aRGCeqn0M9SwigJTx42Wjr/OCnp42Wa0hynNaZ8l9WCcsFKwgr2HHL73jq/BRj/j8Vzf1M0FQUNQZLlZUx5s7Oye0PC2xkSNFnQRipQtwHye+nPU/zSttk8NZvYiQ1QSOyldvCR/FIymLH3xuKT7T1gXlZVVdctK7A/HMd2rZisWiHmOuIr9V2I+XJwc3/XPOwWHIyz1pccyxg1SXO+iFGEVLWM8XNsHcbrJxaDhRDfAgAA | base64 -d | \
curl -X POST \
-H 'content-length: 285' \
-H 'content-encoding: gzip' \
-H 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1doaXNwZXJlciI6dHJ1ZSwiaXNBZG1pbiI6ZmFsc2UsIndoaXNwZXJlciI6InFDQzRUcHZ5VGhpYzZGVkFZZjJWVHciLCJpc0VwaGVtZXJhbCI6ZmFsc2UsImluc3RhbmNlSWQiOiJ3ZWItcmVhZC1jYmM4NDU2NmQtN3FudGQiLCJpYXQiOjE2OTU3NTYzOTYsImV4cCI6MTY5NTg0Mjc5NiwiaXNzIjoiaHR0cDovL3NwaWRlci5zcGlkZXIuaW8iLCJzdWIiOiJ3aHNwOnFDQzRUcHZ5VGhpYzZGVkFZZjJWVHcifQ.tVCG_KAlEQrMdXVBQtAkTd6pZZmBEqzV8tytRLFkQ9YAzyElc1SstkOjbHcDLrCXEkieDz7cI4BDt2cG9C_e3QccICnbrZuKh4lqtyB27t5rHdkcglg-N5vDASK56xHPrO-f4HPT8rOkKmu4lkoCQxhC91sZrmTcq6lTDZrWFk0' \
-H 'x-real-ip: 10.42.0.1' \
-H 'host: spider.spider.io' \
-H 'content-type: application/json' \
-H 'accept-encoding: gzip, deflate' \
"http://spider.spider.io/hosts/v1/hosts/forWhisperer/qCC4TpvyThic6FVAYf2VTw/" \
--data-binary @-
As captured, text
curl -X POST \
-H 'content-length: 285' \
-H 'x-forwarded-proto: http' \
-H 'content-encoding: gzip' \
-H 'x-forwarded-port: 80' \
-H 'x-forwarded-for: 10.42.0.1, 10.42.0.5' \
-H 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc1doaXNwZXJlciI6dHJ1ZSwiaXNBZG1pbiI6ZmFsc2UsIndoaXNwZXJlciI6InFDQzRUcHZ5VGhpYzZGVkFZZjJWVHciLCJpc0VwaGVtZXJhbCI6ZmFsc2UsImluc3RhbmNlSWQiOiJ3ZWItcmVhZC1jYmM4NDU2NmQtN3FudGQiLCJpYXQiOjE2OTU3NTYzOTYsImV4cCI6MTY5NTg0Mjc5NiwiaXNzIjoiaHR0cDovL3NwaWRlci5zcGlkZXIuaW8iLCJzdWIiOiJ3aHNwOnFDQzRUcHZ5VGhpYzZGVkFZZjJWVHcifQ.tVCG_KAlEQrMdXVBQtAkTd6pZZmBEqzV8tytRLFkQ9YAzyElc1SstkOjbHcDLrCXEkieDz7cI4BDt2cG9C_e3QccICnbrZuKh4lqtyB27t5rHdkcglg-N5vDASK56xHPrO-f4HPT8rOkKmu4lkoCQxhC91sZrmTcq6lTDZrWFk0' \
-H 'x-real-ip: 10.42.0.1' \
-H 'x-forwarded-server: gateway-998447ffb-zrfsr' \
-H 'x-forwarded-host: spider.spider.io' \
-H 'x-forwarded-prefix: /hosts/' \
-H 'host: spider.spider.io' \
-H 'content-type: application/json' \
-H 'accept-encoding: gzip, deflate' \
"http://10.42.0.48:3000/v1/hosts/forWhisperer/qCC4TpvyThic6FVAYf2VTw/" \
--data \
'[
{
"hostname": "web-read-cbc84566d-7qntd.spider-system.pod.cluster.local",
"ip": "10.42.0.43",
"lastUpdate": "2023-09-26T19:26:47.454Z",
"firstSeen": "2023-09-26T19:26:47.454Z",
"lastSeen": "2023-09-26T20:52:26.137Z",
"toTrack": true,
"preloadedHost": true,
"type": "SERVER",
"tracked": false
},
{
"hostname": "monitor-write-6788899b45-thqnb.spider-system.pod.cluster.local",
"ip": "10.42.0.18",
"lastUpdate": "2023-09-26T19:26:47.454Z",
"lastSeen": "2023-09-26T20:52:26.137Z",
"firstSeen": "2023-09-26T19:26:47.454Z",
"toTrack": true,
"type": "CLIENT",
"tracked": false
},
{
"hostname": null,
"ip": "10.42.0.1",
"lastUpdate": "2023-09-26T19:26:49.036Z",
"lastSeen": "2023-09-26T20:52:25.038Z",
"firstSeen": "2023-09-26T19:26:49.036Z",
"toTrack": true,
"type": "CLIENT",
"tracked": false
}
]'

Side changeโ€‹

I also took the opportunity to move the Download Pcap icon from the top of the details panel to a more 'standard' button.
For HTTP, TCP and Packets resources.

cURLandPcap.png

Cheers,
Thibaut