cookieproxy

command module
v0.1.0-beta4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2021 License: MIT Imports: 17 Imported by: 0

README

CookieProxy

Patrick Wagstrom <patrick@wagstrom.net>

February 2021

Overview

This was made for a very niche use case of needing to use telegraf with a remote API that required cookies and non-standard authentication method to get those cookies. Using this tool you can proxy through those requests with the appropriate cookies.

Usage

While CookieProxy works without a CookieJar, you'll first want to create a CookieJar for maximum awesomeness.

./cookieproxy -cookiejar ~/cookies.txt

You'll see that CookieProxy has started on port 8675 and is ready to proxy requests:

curl http://localhost:8675/p/?target=http://foo.com/bar.png
Advanced Usage

I recently added support for querying a host to grab the cookies. This is particularly useful for my main use case of acting as an authenticated proxy to a Tesla Powerwall. When using it in this way you don't need to specify the -cookiejar argument, but instead pass a JSON object as a string to the -request argument.

./cookieproxy -request '{"url": "https://powerwall/api/login/Basic", "headers": {"Content-Type": "application/json"}, "body": "{\\"username\\":\\"customer\\",\\"password\\":\\"YOUR_POWERWALL_PASSWORD\\",\\"force_sm_off\\":false}", "method": "POST"}'

Then you can easily validate it with the following command:

curl "http://localhost:8675/p/?target=https://powerwall/api/meters/aggregates"

License

Copyright © 2021 Patrick Wagstrom

Licensed under terms of the MIT License

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL