From f8f1e6c0760997875fe416486aa72fca7652c278 Mon Sep 17 00:00:00 2001 From: HugoPBrito Date: Tue, 12 Nov 2024 15:03:36 +0100 Subject: [PATCH] feat: basic PoC script basic repo info retrieval --- prowler/providers/github/PoC.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 prowler/providers/github/PoC.py diff --git a/prowler/providers/github/PoC.py b/prowler/providers/github/PoC.py new file mode 100644 index 0000000000..27ebdab61c --- /dev/null +++ b/prowler/providers/github/PoC.py @@ -0,0 +1,32 @@ +import json + +import requests + +TOKEN = "token" +ENDPOINT = "https://api.github.com/graphql" + +headers = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"} + +query = """ +{ + user(login: "HugoPBrito") { + login + twoFactorAuthentication { + enabled + } + } +} +""" + +response = requests.post(ENDPOINT, headers=headers, json={"query": query}) + +if response.status_code == 200: + print(json.dumps(response.json(), indent=2)) + + data = response.json() + two_factor_authentication = data["data"]["user"]["twoFactorAuthentication"][ + "enabled" + ] + print(two_factor_authentication) +else: + print(f"Error {response.status_code}: {response.text}")