Skip to content

Instantly share code, notes, and snippets.

View brandonwmichael's full-sized avatar

Brandon Michael brandonwmichael

View GitHub Profile
# Dateadded (UTC),URL,URL_status,Threat,Host,IPaddress,ASnumber,Country
"2022-06-17 08:58:04","http://194.230.107.25:33508/mozi.m","online","malware_download","194.230.107.25","194.230.107.25","6730","CH"
"2022-06-16 11:00:05","http://179.43.155.137/fjgD555c3/Plugins/cred.dll","online","malware_download","179.43.155.137","179.43.155.137","51852","CH"
"2022-06-15 18:19:05","http://179.43.175.187/yjqf/gdk.exe","online","malware_download","179.43.175.187","179.43.175.187","51852","CH"
".xyz"
".ci"
".mw"
".surf"
".sx"
".cn"
".top"
".gq"
".ml"
".cf"
# ------------------------
# 1. Dictionary Creation
# ------------------------
# Method 1: Literal syntax
person = {"name": "Alice", "age": 30}
# Method 2: Using dict constructor
person = dict(name="Bob", age=25)
import httpx
from abc import ABC, abstractmethod
class APIClient(ABC):
def __init__(self, base_url: str, client_id: str, client_secret: str):
self.base_url = base_url
self.client_id = client_id
self.client_secret = client_secret
self.token = None
@brandonwmichael
brandonwmichael / argparse_1.py
Created June 20, 2025 14:18
Python Argparse examples
import argparse
# Initialize parser
parser = argparse.ArgumentParser(description="Example argument parser")
# Add arguments
parser.add_argument("--name", type=str, help="Your name")
parser.add_argument("--age", type=int, help="Your age", required=True)
parser.add_argument("--verbose", action="store_true", help="Enable verbose mode")
def write_raw_markdown(markdown_content: str, file_path: str) -> None:
"""Writes a string of raw markdown directly to a file.
This function takes a pre-formatted markdown string and saves it to
the specified file path. It will overwrite the file if it already
exists.
Args:
markdown_content (str): The raw markdown string to be written.
file_path (str): The full path for the output markdown file.
@brandonwmichael
brandonwmichael / create_folder_if_not_exists.py
Created July 7, 2025 19:39
Creates a folder within a specified root directory if it doesn't already exist.
import os
import errno
from pathlib import Path
from typing import Union
def create_folder_if_not_exists(root_folder: Union[str, Path], new_folder_name: str) -> Path:
"""
Creates a folder within a specified root directory if it doesn't already exist.
This function is designed to be safe and idempotent. It first checks for the
@brandonwmichael
brandonwmichael / list_files_in_directory.py
Created July 7, 2025 19:45
Recursively finds all files in a directory and returns them in a dictionary.
import os
import shutil
from pathlib import Path
from typing import Union, List, Dict, Optional
def list_files_in_directory(
root_folder: Union[str, Path],
file_extensions: Optional[List[str]] = None
) -> Dict[str, str]:
"""

A Strategic Analysis of Threat Detection and Auditing in Azure DevOps Environments

Section 1: Introduction to the Azure DevOps Threat Landscape

1.1 The Evolving Role of CI/CD as a High-Value Target

In the modern enterprise, DevOps platforms such as Azure DevOps have evolved far beyond their initial role as simple software development and IT operations tools. They now represent the core of critical business infrastructure—the digital factory responsible for building, testing, and deploying an organization's most valuable applications and services. This central role has not gone unnoticed by malicious actors. The focus of sophisticated attacks has shifted from merely compromising production applications to targeting the very supply chain that creates them. By attacking the DevOps pipeline, adversaries can achieve objectives with a far greater blast radius, including the injection of malicious code, the theft of privileged credentials for lateral movement across an organization's cloud

Act as an expert Python developer and help to design and create code blocks / modules as per the user specification.
RULES:
- MUST provide clean, production-grade, high quality code.
- ASSUME the user is using python version 3.9+
- USE well-known python design patterns and object-oriented programming approaches
- MUST provide code blocks with proper google style docstrings
- MUST provide code blocks with input and return value type hinting.
- MUST use type hints
- PREFER to use F-string for formatting strings