Skip to content

Instantly share code, notes, and snippets.

View tonybaloney's full-sized avatar

Anthony Shaw tonybaloney

View GitHub Profile
[[[[[[[[[[[[[[[����������������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[����������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[[[[[[[����������������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[����������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[��������������������������[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[��[[[���������������������������������������[[[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[��������������������������[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[��[[[���������������������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[������������������������[[[[[[[[[[[[[[[������������[[[[[[[[��������������[[[[[[[[[[[[[[[[[��������������������������[[[[[[���������������������������o de][���� ss2", ]]
@tonybaloney
tonybaloney / grype_print.py
Last active August 24, 2022 01:59
Grype results printer
"""
Requirements --
- orjson
- rich
Usage:
> grype /path/to/scan -o json > output.json
> python grype_print.py output.json
or
@tonybaloney
tonybaloney / tasks.json
Last active December 6, 2021 22:08
Pip audit task
{
"version": "2.0.0",
"tasks": [
{
"label": "Pip Audit",
"type": "shell",
"command": "${command:python.interpreterPath}",
"args": ["-m", "pip_audit"],
"isBackground": true,
"group": "none",
@tonybaloney
tonybaloney / brute_token.py
Created December 1, 2021 20:32
Brute force a admin login and 2FA endpoint with token ranges 100,000 - 1,000,000
import asyncio
import aiohttp
from itertools import islice, chain
LOGIN_FORM = 'http://asd.sdfsdf/admin'
LOGIN_URL = 'http://asd.fsdfsdf/admin'
TWOFA_FORM = 'http://asda.asdas/doAdminTwoFactor.action'
INVALID_MESSAGE = 'Invalid token, please try again'
def batch(iterable, size):
"""
Usage:
>>> tracer.add_span_processor(BatchSpanProcessor(RichSpanExporter()))
"""
import datetime
import typing
from typing import Optional
import opentelemetry.trace
@tonybaloney
tonybaloney / app.py
Last active March 25, 2024 23:52
FastAPI with OpenTelemetry
from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from opentelemetry.context import get_current as get_current_context
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
from opentelemetry.sdk.trace import TracerProvider, _Span
from opentelemetry.sdk.trace.export import (BatchSpanProcessor,
ConsoleSpanExporter,
SimpleSpanProcessor)
from starlette.exceptions import HTTPException as StarletteHTTPException
@tonybaloney
tonybaloney / main.py
Last active August 18, 2021 17:21
PyInstrument with FastAPI
from fastapi import FastAPI, Request
from fastapi.responses import HTMLResponse
from profiler import FastApiProfiler
app = FastAPI()
import .routes # NOQA
PROFILING = True # Put this in Settings when you're ready
{
// Put this in .vscode/launch.json
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch python",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/python",
"args": ["-X", "dev"],
print("""
BBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBB
BB[38;2