Skip to content

Instantly share code, notes, and snippets.

@xybytes
xybytes / oauth_client_credentials_flow.py
Created February 27, 2025 21:14
Retrieve an OAuth 2.0 access token using Client Credentials Flow and call Microsoft Graph API
import argparse
import requests
# Configure Argument Parser
parser = argparse.ArgumentParser(
description="Retrieve an OAuth 2.0 access token using Client Credentials Flow and call Microsoft Graph API."
)
parser.add_argument("--tenant-id", required=True, help="Azure AD Tenant ID")
parser.add_argument("--client-id", required=True, help="Azure AD Application (Client) ID")
@xybytes
xybytes / badsectorlabs_scraper.py
Created July 16, 2025 00:36
A Python script that scrapes the Last Week in Security blog by Bad Sector Labs, follows all archive pages, and searches for posts containing a specific keyword (e.g., Azure).
import requests
from bs4 import BeautifulSoup
from datetime import datetime
import argparse
BASE_URL = "https://blog.badsectorlabs.com/"
START_PAGE = "index.html"
def get_posts_from_page(url):
"""Extract posts (date, title, link) from an index page."""