Signs API calls to SberCloud.Advanced with AK/SK

Overview

sbercloud-api-aksk

Signs API calls to SberCloud.Advanced with AK/SK

This script is a courtesy of @sadpdtchr

Description

Sometimes there is a need to manuall call SberCloud.Advanced API of a certain cloud service.
According to the documentation, a request can be authenticated either by a temporary security token or by Access Key and Secret Key (AK/SK).
This script implements the second option: it signs the request with AK/SK. It uses the standard Python SDK for that available here.

Usage

$ python3 api_ak_sk.py -h
usage: api_ak_sk.py [-h] --uri URI --method METHOD --ak AK --sk SK [--content CONTENT] [--xdomainid XDOMAINID]

Makes SberCloud.Advanced API call signed by AK and SK.

Arguments:
 -h, --help   show this help message and exit
 --uri URI   URI for the call. Includes cloud service endpoint and URI. May include Project ID for some calls
 --method METHOD   REST method, see API description for your cloud service
 --ak AK   Access Key
 --sk SK   Secret Key
 --content CONTENT   File with request content in JSON format, optional
 --xdomainid XDOMAINID   Root account id (X-Domain-Id), optional

Examples

Example 1: GET call to get list of ELB (Elastic Load Balancer)

You don't need any request body for this GET request, so you can omit the content parameter. You don't need the xdomainid parameter as well.

$ python3 api_ak_sk.py --ak Your_AK_here --sk Your_SK_here --method GET --uri https://elb.ru-moscow-1.hc.sbercloud.ru/v2/Your_Project_ID_here/elb/loadbalancers

This is how your request should look like:

$ python3 api_ak_sk.py --ak A5...CL --sk mn...gj --method GET --uri https://elb.ru-moscow-1.hc.sbercloud.ru/v2/07...ef/elb/loadbalancers

Example 2: POST call to create new ECS

Here you need to provide the request body, which will describe your ECS:

$ python3 api_ak_sk.py --ak Your_AK_here --sk Your_SK_here --method POST --uri https://ecs.ru-moscow-1.hc.sbercloud.ru/v1/Your_Project_ID_here/cloudservers --content ecs.json

Example 3: POST call to create new custom IAM policy

This very call (as well as some other IAM-related calls) requires you to provide the domain id of your root account, even if you execute this call from under the root account itself. Thus you must add the xdomainid parameter:

$ python3 api_ak_sk.py --ak Your_AK_here --sk Your_SK_here --method POST --uri https://iam.ru-moscow-1.hc.sbercloud.ru/v3.0/OS-ROLE/roles --content policy.json --xdomainid Your_Domain_ID_here

Dependencies

The script requires python3 with the following modules:

  • typing
  • requests
  • argparse
  • json
  • pprint
  • apig_sdk (you get this one from here)

Installation

Just clone the repo. Install apig_sdk. Then execute the script as shown earlier:

$ python3 api_ak_sk.py -h

Or, you could make it executable:

$ chmod u+x api_ak_sk.py
$ ./api_ak_sk.py -h

Owner
Peter Predtechensky
Peter Predtechensky
A management system designed for the employees of MIRAS (Art Gallery). It is used to sell/cancel tickets, book/cancel events and keeps track of all upcoming events.

Art-Galleria-Management-System Its a management system designed for the employees of MIRAS (Art Gallery). Backend : Python Frontend : Django Database

Areesha Tahir 8 Nov 30, 2022
GTK3-based panel for sway window manager

nwg-panel I have been using sway since 2019 and find it the most comfortable working environment, but... Have you ever missed all the graphical bells

Piotr Miller 290 Jan 07, 2023
Simple python program to execute terminal commands on telegram chats directly.

Small python code which can be handy when using telegram and you don't want to use VPS again and again. By configuring the code in your VPS, You can execute commands and get your output within telegr

Veshraj Ghimire 34 Dec 05, 2022
A delivery protection and notification system

DeliveryProtect This project builds a delivery protection and notification system, based on integration of Arduino Uno and Raspberry Pi 4. The codes a

2 Dec 13, 2021
A simple discord tool that translates english to either spanish, german or french and sends it. Free to rework but please give me credit.

discord-translator A simple discord tool that translates english to either spanish, german or french and sends it. Free to rework but please give me c

TrolledTooHard 2 Oct 04, 2021
This repository will be a draft of a package about the latest total marine fish production in Indonesia. Data will be collected from PIPP (Pusat Informasi Pelabuhan Perikanan).

indomarinefish This package will give us information about the latest total marine fish production in Indonesia. The Name of the fish is written in In

1 Oct 13, 2021
Framework for creating and running trading strategies. Blatantly stolen copy of qtpylib to make it work for Indian markets.

_• Kinetick Trade Bot Kinetick is a framework for creating and running trading strategies without worrying about integration with broker and data str

Vinay 41 Dec 31, 2022
🔍 Google Search unofficial API for Python with no external dependencies

Python Google Search API Unofficial Google Search API for Python. It uses web scraping in the background and is compatible with both Python 2 and 3. W

Avi Aryan 204 Dec 28, 2022
A simple telegram bot to help you to remove forward tag from post from any messages . Maded in python3 using @Pyrogram . Developed by @Kunal-Diwan

Frwd-Tag-Remover Telegram Bot to Remove forward tag from any Post . If you need any more modes in repo or If you find out any bugs, mention in @Develo

Kunal Diwan 2 Oct 14, 2022
Repositorio dedicado a contener los archivos fuentes del bot de discord "Lector de Ejercicios".

Lector de Ejercicios Este bot de discord está pensado para usarse únicamente en el discord de la materia Algoritmos y Programación I, de la Facultad d

Franco Lighterman Reismann 3 Sep 17, 2022
Python async SDK for betsapi.com

Python async SDK for betsapi.com

1 Dec 21, 2021
A simple python bot that serves to send some notifications about GitHub events to Slack.

github alerts slack bot 🤖 What is it? 🔍 This is a simple bot that serves to send some notifications about GitHub events to Slack channels. These are

Jackson Alves 10 Dec 10, 2022
A project that alerts me when there's a dog outside so I can go look at it.

Dog Detector A project that alerts me when there's a dog outside so I can go look at it. Tech Specs This script uses the YOLOv3 object detection model

rydercalmdown 58 Jul 29, 2022
Fastest Pancakeswap Sniper BOT TORNADO CASH 2022-V1 (MAC WINDOWS ANDROID LINUX)

Fastest Pancakeswap Sniper BOT TORNADO CASH 2022-V1 (MAC WINDOWS ANDROID LINUX) ⭐️ AUTO BUY TOKEN ON LAUNCH AFTER ADD LIQUIDITY ⭐️ ⭐️ Support Uniswap

Crypto Trader 7 Jan 31, 2022
Telegram bot to trim and download videos from youtube.

Inline-YouTube-Trim-Bot Telegram bot to trim and download youtube videos Deploy You can deploy this bot anywhere. Demo - YouTubeBot Required Variables

SUBIN 56 Dec 11, 2022
python script to buy token from pancakeswap

pancakeswapBot python script to buy token from pancakeswap Change your privatekey!!! on line 58 (signed_txn = web3.eth.account.sign_transaction(pancak

206 Dec 31, 2022
Auslesen, entschlüsseln und parsen von Smart Meter Telegrammen

Netz-NÖ SmartMeter-P1-Reader https://www.netz-noe.at/Download-(1)/Smart-Meter/218_9_SmartMeter_Kundenschnittstelle_lektoriert_14.aspx Dieses Skript en

3 Jan 14, 2022
修改自SharpNoPSExec的基于python的横移工具 A Lateral Movement Tool Learned From SharpNoPSExec -- Twitter: @juliourena

PyNoPSExec A Lateral Movement Tool Learned From SharpNoPSExec -- Twitter: @juliourena 根据@juliourena大神的SharpNOPsExec项目改写的横向移动工具 Platform(平台): Windows 1

<a href=[email protected]"> 23 Nov 09, 2022
GG Dorking is a tool to generate GitHub and Google dorking for pentesters and bug bounty hunters.

GG-Dorking GG Dorking is a python tool to generate GitHub and Google dorking links for pentesters and bug bounty hunters. It will help you to find imp

Eslam Akl 80 Nov 24, 2022
The easiest way to deploy this Bot

How To Host The easiest way to deploy this Bot Update Channe

Isekai Reszz 1 Jan 23, 2022