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
Discord Webhook Spammer (fastest)

Discord Webhook Spammer A simple fast asynchronous webhook spammer. Spammer Features Fast message spamming. Controllable speed. Noob friendly. Usage N

Varient 2 Apr 22, 2022
A Python API For Questionnaire

Инструкция по разворачиванию приложения Окружение проекта: python 3.8 Django 2.2.10 djangorestframework Склонируйте репозиторий с помощью git: git clo

2 Feb 14, 2022
A Discord Self-Bot in Python

👨‍💻 Discord Self Bot 👨‍💻 A Discord Self-Bot in Python by natrix Installation Run: selfbot.bat Python: version : 3.8 Modules

natrix_dev 3 Oct 02, 2022
This is a starter template of discord.py project

Template Discord.py This is a starter template of discord.py project (Supports Slash commands!). 👀 Getting Started First, you need to install Python

1 Dec 22, 2021
Posts locally saved videos to the desired subreddit

redditvideoposter posts locally saved videos to the desired subreddit ================================================================= STEPS: pip ins

Kyrus 2 Dec 01, 2021
A Python Library to Make Quote Images

Quote2Image A Python Library to Make Quote Images How To Use? Download The Latest Package From Releases Extract The Zip File And Place Every File In I

Secrets 28 Dec 30, 2022
Telegram Bot to Filter posts in Bot Inline search

Inline-Filter-Bot A Telegram Bot for filter in Inline Features Unlimited Filters Supports all type of filters Supports Alert Button Using Common Marku

Code X Botz 67 Dec 26, 2022
A Python library for PagerDuty.

Pygerduty Python Library for PagerDuty's REST API and Events API. This library was originally written to support v1 and is currently being updated to

Dropbox 164 Dec 20, 2022
Reverse engineering the dengue virus (under development construction)

Reverse engineering the dengue virus (under development 🚧 ) What is dengue? Dengue is a viral infection transmitted to humans through the bite of inf

kjain 4 Feb 09, 2022
This code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user

max_tweeted_word This code is for a bot which will find a Twitter user's most tweeted word and tweet that word, tagging said user The program uses twe

Yasho Bapat 1 Nov 29, 2021
This is a tool to help people to make a bot for labelling images for machine learning projects.

labeller_images_python_telegramBOT This is a bot to help collect data for any machine learning project. It was developed using the python-telegram-bot

Diego Silveira 2 Nov 13, 2021
❤️ DaisyX 2.0 ❤️ A Powerful, Smart And Simple Group Manager ... Written with AioGram , Pyrogram and Telethon...

❤️ DaisyX 2.0 ❤️ A Powerful, Smart And Simple Group Manager ... Written with AioGram , Pyrogram and Telethon... ⭐️ Thanks to everyone who starred Dais

TeamOfDaisyX 44 Oct 06, 2022
A Telegram Bot Written In Python

TelegraphUploader A Telegram Bot Written In Python DEPLOY Local Machine Clone the repository Install requirements: pip3 install -r requirements.txt e

Wahyusaputra 2 Dec 29, 2021
BLYRIC is a Twitter bot that tweets a song lyric every night.

BLYRIC BLYRIC, a bot that tweets a song lyric every night. Follow on Twitter: @blyric_ Overview BLYRIC is a Twitter bot that tweets a song quote every

Bruno Kenzo Hyodo 6 Oct 05, 2022
A python package to easy the integration with Direct Online Pay (Mpesa, TigoPesa, AirtelMoney, Card Payments)

python-dpo A python package to easy the integration with Direct Online Pay (DPO) which easily allow you easily integrate with payment options once wit

NEUROTECH 15 Oct 08, 2022
Discord Custom Playing Status Redirecting

Discord-Custom-Playing-Status-Redirecting THINGS TO DO :- - Create an application from https://discord.com/developers/applications give it ur desired

WarLorD oP 1 Oct 30, 2021
An Advanced Python Playing Card Module that makes creating playing card games simple and easy!

playingcards.py An Advanced Python Playing Card Module that makes creating playing card games simple and easy! Features Easy to Understand Class Objec

Blake Potvin 5 Aug 30, 2022
Python Telegram bot api.

pyTelegramBotAPI A simple, but extensible Python implementation for the Telegram Bot API. Getting started. Writing your first bot Prerequisites A simp

FrankWang 6.4k Jan 09, 2023
Python client for Invidious' JSON API

Python project template A template for new Python projects. Features Automatically builds PDoc documentation & uploads package to PyPI on new GitHub r

Kevo 2 Jun 05, 2022
Astro Bot With Golang

Astro-Bot Features: Astronomy Picture of the day Horoscope People In Space How we built it Our team was broken, one person didn't do anything the othe

Vaarun Sinha 1 Nov 21, 2021