mattcg / har-to-curl Goto Github PK
View Code? Open in Web Editor NEWConvert a HAR (HTTP Archive) object to a cURL command using JavaScript.
Home Page: http://mattcg.github.io/har-to-curl/
Convert a HAR (HTTP Archive) object to a cURL command using JavaScript.
Home Page: http://mattcg.github.io/har-to-curl/
Right now i'm using this "hack":
var line = curl_line.replace("curl ", "curl -s -o out"+index+".png ");
Hi!
The tool is great, but postData with a text
field only is supported.
According to the HAR 1.2 specs parameters may be specified in params
array instead of text
.
POST data is included in the curl commands, but it seems that backslashes are removed along the way. So what should be posted as
curl -d "{\"id\":1002,\"shares\":[{\"id\":2,\"share\":0.9},{\"id\":3,\"share\":0.1}]}" ....
comes out as
curl -d "{"id":1002,"shares":[{"id":2,"share":0.9},{"id":3,"share":0.1}]}"
Double Quotes in values are not escaped properly in the curl command line that is presented. Example:
{
"log": {
"version": "1.2",
"pages": [
{
"startedDateTime": "2023-08-02T10:52:21.439Z",
"id": "page_1",
"title": "https://example.com/"
}
],
"entries": [
{
"_initiator": {
"type": "other"
},
"request": {
"method": "GET",
"url": "https://example.com/",
"httpVersion": "http/2.0",
"headers": [
{
"name": "user-agent",
"value": "Mozilla/5.0 iPh\";echo HALLO; sleep 5; \" "
}
],
"cookies": [],
"queryString": [],
"headersSize": -1,
"bodySize": 0
}
}
]
}
}
creates the command
curl -X GET -H "user-agent: Mozilla/5.0 iPh";echo HALLO; sleep 5; " " https://example.com/
which will execute curl, echo and sleep 5, but not fetch any URLs.
suggested fix: Use single quotes ('
) to escape all strings, replace existing single quotes with '\''
, i.e. one single quote, followed by a backslash and two more single quotes.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.