Skip to content

barzin144/Zus

Repository files navigation

Zus Zus CLI Tool

NuGet Package: zus Mutation Build Test

Table of Contents

Installation

dotnet tool install --global zus

Send Request

Get

zus send get https://example.com/posts/1
Options Description example
-a, --auth Authentication Bearer Token zus send get https://example.com/posts/1 -a eyJhbGciOi==
-n, --name Name for saving the request zus send get https://example.com/posts/1 -n posts
-s, --save-response Save response zus send get https://example.com/posts/1 -s
-h, --header Add header to request, format: Key:Value,Key:Value and wrap your data in single or double quote. zus send get https://example.com/posts/1 -h 'api-key:abc'
-p, --pre-request Pre-request name zus send get https://example.com/posts/1 -p login
-f, --force Overwrite the existing request with same name zus send get https://example.com/posts/1 -n posts -f

Post

zus send post http://example/api/Account/Login -x -d "username:zus,password:123456" //form-urlencoded format
zus send post http://example/api/Account/Login -j -d "username:zus,password:123456" //json format
zus send post http://example/api/Account/Login -d '{"username": "zus", "password": "123456"}' //string format
Options Description
-d, --data Data format: Key:Value,Key:Value and wrap your data in single or double quote. Data will be sent in string format by default. By adding -x flag change format to form-urlencoded or -j for Json format
-a, --auth Authentication Bearer Token
-n, --name Name for saving the request
-s, --save-response Save response
-h, --header Add header to request, format: Key:Value,Key:Value and wrap your data in single quote or double quote.
-x, --form-format Convert Key:Value data to form-urlencoded format
-j, --json-format Convert Key:Value data to json format
-p, --pre-request Pre-request name
-f, --force Overwrite the existing request with same name

Pre-Request

zus send post http://example/api/Account/Login -n login -d "username:zus,password:123456"
//response: { "accessToken": "eyJhbGciOiJI..." }

zus send post http://example/api/Account/UpdateProfile -p login -a "{pr.accessToken}" -j -d "name:zus-tool"

zus send get http://example/api/Product/1 -n product
//response: { "id": "ABC123", name: "PC" }
zus send post http://example/api/Product/Update -p product -j -d "product_id:{pr.id},name:laptop"

zus send post http://example/api/Account/GetToken -n get-token -j -d "username:zus,password:123456"
//response: "eyJhbGciOiJI..."

zus send post http://example/api/Account/UpdateProfile -p get-token -a "{pr.$}" -j -d "name:zus-tool"

zus send post http://example/api/Account/UpdateProfile -p get-token -d "name:{var.name}"

{pr.KEY_OF_RESPONSE_OBJECT} will be replaced with Pre-request response data.(If Pre-request response data is Json)

{pr.$} will be replaced with Pre-request response data.(If Pre-request response data is String)

{var.VARIABLE_NAME} will be replaced with value of saved variable.

Resend

Send a saved request.

zus resend login

Variable

Manage variables.

List

zus var list

Delete

zus var delete SAVED_NAME

Request

Access to saved requests.

List

zus request list

Delete

zus request delete SAVED_NAME

Base64

Encode

zus base64 my_text
zus base64 -f FILE_PATH

output: bXlfdGV4dA==

Decode

zus dbase64 bXlfdGV4dA==
zus dbase64 -f bXlfdGV4dA== //store decoded data into txt file

output: my_text

SHA256

zus sha256 my_text

output: wK5CFkMfgStqjLvxe/h7zaqzNISGyy2xWP9dN893UEI=

GUID

zus guid

output: c4a3bb74-bc13-4cfc-8487-8eefe7912c54

JWT Decoder

image

With Secret

zus djwt eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ilp1cyBDTEkgVG9vbCIsImlhdCI6MTUxNjIzOTAyMn0.9BmMva7XRwYtaNkvmobWNNQX8lHyGnSyVRuzgCjEcIY my_secret
{
  "alg": "HS256",
  "typ": "JWT"
}
{
  "sub": "1234567890",
  "name": "Zus CLI Tool",
  "iat": 1516239022
}
Signature Verified

Without Secret

zus djwt eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6Ilp1cyBDTEkgVG9vbCIsImlhdCI6MTUxNjIzOTAyMn0.9BmMva7XRwYtaNkvmobWNNQX8lHyGnSyVRuzgCjEcIY
{
  "alg": "HS256",
  "typ": "JWT"
}
{
  "sub": "1234567890",
  "name": "Zus CLI Tool",
  "iat": 1516239022
}
Invalid Signature