{"id":22355594,"url":"https://github.com/zbo14/retweak","last_synced_at":"2025-03-26T13:12:52.708Z","repository":{"id":42878868,"uuid":"256612473","full_name":"zbo14/retweak","owner":"zbo14","description":"A CLI that tweaks and resends HTTP/S requests","archived":false,"fork":false,"pushed_at":"2023-01-05T11:00:23.000Z","size":659,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-19T10:09:41.420Z","etag":null,"topics":["bug-bounty","cli","http","https","pentesting"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zbo14.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-17T21:21:43.000Z","updated_at":"2020-05-13T17:53:06.000Z","dependencies_parsed_at":"2023-02-04T02:15:25.068Z","dependency_job_id":null,"html_url":"https://github.com/zbo14/retweak","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fretweak","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fretweak/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fretweak/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fretweak/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zbo14","download_url":"https://codeload.github.com/zbo14/retweak/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245659052,"owners_count":20651525,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bug-bounty","cli","http","https","pentesting"],"created_at":"2024-12-04T14:07:21.077Z","updated_at":"2025-03-26T13:12:52.688Z","avatar_url":"https://github.com/zbo14.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# retweak\n\nA CLI that tweaks and resends HTTP/S requests!\n\n`retweak` can modify request URLs, methods, headers, or data and report changes in responses.\n\n## But why?\n\nA common process in pentesting/bug bounties is web path enumeration. There are many tools to do this (e.g. [dirb](http://dirb.sourceforge.net/), [dirsearch](https://github.com/maurosoria/dirsearch), [gobuster](https://github.com/OJ/gobuster)). **Note:** `retweak` can do this but I wouldn't recommend it solely for this purpose since the aforementioned tools are better/faster.\n\n`retweak` comes in handy when you want to change *another* part of the request (e.g. URL query parameter, request body JSON) to see if/how the response changes. Rather than manually editing and resending the request in Firefox developer tools or replaying the request with a proxy, you can programmatically tweak and resend requests with `retweak`.\n\nThe way it works is you define a \"base request\" (URL, method, headers, data), tell `retweak` what part of the request to \"tweak\", and pass a list of values. Then `retweak` fires off a bunch of requests. Each request is derived from the \"base request\" and includes one of the values in the list. Each value is injected into the request at a location you specify.\n\n[Burp Repeater](https://portswigger.net/burp/documentation/desktop/tools/repeater) has a likeminded goal of modifying and resending HTTP/S requests (and it has a UI :)). My motivation for writing `retweak` was to create a CLI you could easily pull off the shelf to automate this process. It's especially useful if you have tens (or hundreds) of predefined modifications you'd like to test against an endpoint. If there are other tools you think I should know about or mention here, please [bring them up](#Contributing)!\n\n## Install\n\n`$ npm i retweak`\n\n## Usage\n\n`$ retweak -h`\n\n```\nUsage: retweak [options] [command] \u003curl\u003e\n\nOptions:\n  -V, --version                       output the version number\n  -d, --data \u003cdata/@file\u003e             request data to send\n  -H, --headers \u003cheaders/@file\u003e       request headers to send\n  -i, --ignore-headers \u003cnames/@file\u003e  don't report changes in these headers\n  -j, --json                          write JSON responses to file (only if -o)\n  -k, --insecure                      allow insecure TLS connection\n  -l, --list \u003cvalues/@file\u003e           list of values to try\n  -m, --max-data \u003csize\u003eB/KB           don't report data when it's over this size\n  -o, --output \u003cfile\u003e                 write all responses to file\n  -p, --parallel                      send requests in parallel\n  -q, --quiet                         don't show banner and debugging info\n  -t, --tweak \u003cpart\u003e                  part of the request to tweak [\"url\",\"method\",\"header\",\"data\"]\n  -X, --method \u003cmethod\u003e               request method\n  -h, --help                          output usage information\n\nCommands:\n  hosts \u003curl\u003e                         test a bunch of values for the Host header\n  methods \u003curl\u003e                       test all HTTP methods\n  origins \u003curl\u003e                       test a bunch of values for the Origin header\n  urlencodings \u003curl\u003e                  test different URL encodings\n```\n\n`retweak` searches for an asterisk (\"\\*\") in the part of the request you'd like to tweak (unless you're tweaking the request method). Then it injects each value in `-l, --list` at that location and sends a request for each \"injection\".\n\nIf you'd like to review *all* responses in their entirety, you can write them to a file with the `-o, --output` option. The responses are plaintext by default, but you can specify `-j, --json` if you'd like the responses in JSON format.\n\nThe CLI adopts some options from [curl](https://curl.haxx.se/) that take a literal value *or* filename as an argument. If you'd like to pass a filename, make sure to prepend it with \"@\" so the CLI knows you meant to pass a filename! **Note:** for output the argument can *only* be a filename so there's no need to prepend with a \"@\".\n\n`retweak` tries to assume sensible defaults when options aren't specified. If you provide `-d, --data` but don't specify `-m, --method`, the latter defaults to POST. Otherwise, method defaults to GET. If the method's POST, PUT, or PATCH, `-t, --tweak` defaults to \"data\", otherwise it defaults to \"url\".\n\n## Examples\n\n### URL query param\n\nThe following sends 3 requests with different values for the query parameter, \"id\".\n\n```\n$ retweak -l \"1,2,3\" -t url \"https://\u003cdomain\u003e/a/b/c?id=*\"\n```\n\n`retweak` has a subcommand for testing different URL encodings.\n\n```\n$ retweak urlencodings \"https://\u003cdomain\u003e/a/b/c?id=*\"\n```\n\n### HTTP method\n\nThe following sends 3 requests with different HTTP methods.\n\n```\n$ retweak -l \"POST,PUT,PATCH\" -t method \u003curl\u003e\n```\n\n`retweak` has a subcommand for testing *all* HTTP methods.\n\n```\n$ retweak methods \u003curl\u003e\n```\n\n### Header\n\nThe following sends 3 requests with different Host headers.\n\n```\n$ retweak -H \"Host: *\" -l \"foo.com,bar.foo.com,baz.foo.com\" \u003curl\u003e\n```\n\n`retweak` has a subcommand for injecting a bunch of values in the Host header.\n\n```\n$ retweak hosts \u003curl\u003e\n```\n\n**Note:** you can use `-l, --list` if you have a list of hosts, otherwise `retweak` will use its own.\n\n### Cookie\n\nThe following sends 3 requests with different values for the \"a\" cookie.\n\n```\n$ retweak -H \"Cookie: a=*;expires=sometime\" -l \"1,2,3\" \u003curl\u003e\n```\n\n### Request data\n\nThe following sends 3 requests with different values for the \"foo\" key in the JSON payload.\n\n```\n$ retweak -d '{\"foo\": \"*\"}' -l \"bar,baz,bam\" \u003curl\u003e\n```\n\n## Test\n\n`$ npm test`\n\n## Contributing\n\nPlease do!\n\nIf you find a bug, want to add a feature, or have a question, feel free to [open an issue](https://github.com/zbo14/retweak/issues/new).\n\nYou're also welcome to [create a pull request](https://github.com/zbo14/retweak/compare/develop...) addressing an issue. You should push your changes to a feature branch and request merge to `develop`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbo14%2Fretweak","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzbo14%2Fretweak","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbo14%2Fretweak/lists"}