mirror of
https://github.com/littledivy/mimic.git
synced 2026-10-26 19:15:10 +00:00
The sources/__init__.py docstring promised "cURL/HAR paste" but HAR was never implemented. This adds it, so mimic works with browser devtools exports (Chrome, Firefox, Safari) and desktop proxies (Charles, Proxyman) with no mitmproxy or iPhone setup. - new mimic/sources/har.py parses HAR JSON into mimic's flow dicts, with inline request/response bodies (base64 decoded) for codegen - Session.from_har(path, host) constructor; host defaults to the most-requested one - --har flag on the hosts, learn, and gen commands - tests/test_har.py with a small fixture The HAR-to-flow conversion produces the same dict shape extract.py and codegen.py already consume, so those modules are untouched. Signed-off-by: ZhYGuoL <zguoliau@andrew.cmu.edu>
70 lines
2.0 KiB
JSON
70 lines
2.0 KiB
JSON
{
|
|
"log": {
|
|
"version": "1.2",
|
|
"creator": {"name": "mimic-test", "version": "1.0"},
|
|
"entries": [
|
|
{
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "https://api.example.com/v1/users?page=1",
|
|
"headers": [
|
|
{"name": "Authorization", "value": "Bearer token123"},
|
|
{"name": "User-Agent", "value": "Mozilla/5.0"},
|
|
{"name": "Host", "value": "api.example.com"}
|
|
]
|
|
},
|
|
"response": {
|
|
"status": 500,
|
|
"headers": [],
|
|
"content": {"mimeType": "application/json", "text": "{\"error\": \"boom\"}"}
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "https://api.example.com/v1/users?page=2",
|
|
"headers": [
|
|
{"name": "Authorization", "value": "Bearer token123"},
|
|
{"name": "Accept", "value": "application/json"}
|
|
]
|
|
},
|
|
"response": {
|
|
"status": 200,
|
|
"headers": [],
|
|
"content": {"mimeType": "application/json", "text": "{\"users\": []}"}
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"method": "POST",
|
|
"url": "https://api.example.com/v1/messages",
|
|
"headers": [
|
|
{"name": "Authorization", "value": "Bearer token123"},
|
|
{"name": "Content-Type", "value": "application/json"}
|
|
],
|
|
"postData": {"mimeType": "application/json", "text": "{\"to\": \"bob\"}"}
|
|
},
|
|
"response": {
|
|
"status": 201,
|
|
"headers": [],
|
|
"content": {"mimeType": "application/json", "encoding": "base64", "text": "eyJvayI6IHRydWV9"}
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"method": "GET",
|
|
"url": "https://cdn.example.com/img.png",
|
|
"headers": [
|
|
{"name": "Accept", "value": "image/png"}
|
|
]
|
|
},
|
|
"response": {
|
|
"status": 200,
|
|
"headers": [],
|
|
"content": {"mimeType": "image/png"}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|