Skip to content

Instantly share code, notes, and snippets.

View monperrus's full-sized avatar

Martin Monperrus monperrus

View GitHub Profile
@monperrus
monperrus / trace.json
Created December 1, 2025 14:15
mab.xyz analysis for approve 0x02f9026d011d832c53c7842c26dc2383055
{
"status": "DANGEROUS",
"details": [
{
"address": "0x91480c26C598CD8231951Fc9beE6e48DE2Fb683F",
"first_time": true,
"verification": {
"address": "0x91480c26c598cd8231951fc9bee6e48de2fb683f",
"verification": "verified",
"verifiedAt": "N/A",
@monperrus
monperrus / trace.json
Created December 1, 2025 14:15
mab.xyz trace for swapOwner 0x02f9028d011d834c22948451286234....
{
"status": "DANGEROUS",
"details": [
{
"address": "0x91480c26C598CD8231951Fc9beE6e48DE2Fb683F",
"first_time": true,
"verification": {
"address": "0x91480c26c598cd8231951fc9bee6e48de2fb683f",
"verification": "verified",
"verifiedAt": "N/A",
@monperrus
monperrus / Challenge04.sol
Created November 26, 2025 08:18
Programmable Society 2025
contract Challenge04 {
struct Data {
bytes32 tx_challenge01;
bytes32 tx_challenge02;
address contract_challenge03;
address contract_challenge04;
}
mapping(address => Data) public data;
@monperrus
monperrus / terms.txt
Created October 19, 2025 08:08
Immunefi – Security Researchers Terms & Conditions Oct 19 2025
Immunefi -- Security Researchers Terms & Conditions (Clickwrap
Agreement)
As a condition of your participation in Immunefi's Bug Bounty Programs,
including the submission of bug reports, you agree to be bound by the
following terms and conditions.  If you do not agree to these terms and
conditions you should not submit any bug report or access the Immunefi
Platform for any purpose.
1. Definitions
@monperrus
monperrus / colors.py
Created March 20, 2025 14:27
a python program that outputs a colored loren ipsum with ASC II color sequences.
import random
def get_random_color_code():
"""Generate a random ANSI color code between 31-36 (red, green,
yellow, blue, magenta, cyan)"""
return random.randint(31, 36)
def colorize_text(text, color_code):
"""Apply ANSI color code to text"""
return f"\033[{color_code}m{text}\033[0m"
@monperrus
monperrus / document_file.py
Created March 16, 2025 10:30
write a python program that parses another python program, summarizes the full file, replace the module docstring and rewrite the program
import ast
import astor
class DocstringReplacer(ast.NodeTransformer):
"""AST Node Transformer to replace module docstring."""
def visit_Module(self, node):
"""Visit Module node and replace docstring."""
# Replace docstring
@monperrus
monperrus / pace.py
Created March 16, 2025 10:30
a python program to compute pace min/kilo from a tcx file
import xml.etree.ElementTree as ET
from datetime import datetime
import math
import sys
def parse_tcx_file(tcx_file):
"""Parse TCX file and return trackpoints with time and distance"""
# Create namespace dictionary for TCX format
ns = {'ns': 'http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2'}
@monperrus
monperrus / merge-laps.py
Created March 16, 2025 10:30
a python script to merge all activities in a tcx file
import xml.etree.ElementTree as ET
from datetime import datetime, timedelta
import sys
def merge_tcx_activities(input_file, output_file):
# Parse the input TCX file
tree = ET.parse(input_file)
root = tree.getroot()
nspace = root.tag.split('}')[0].strip('{')
@monperrus
monperrus / in_canada.py
Created March 16, 2025 10:30
go over all tx files, if the tcx coordinates are in canada, print the file name
import os
import xml.etree.ElementTree as ET
import glob
def is_in_canada(lat, lon):
# Rough boundaries for Canada
# Latitude: Between 41.7° and 83.1° N
# Longitude: Between -141.0° and -52.6° W
return (41.7 <= float(lat) <= 83.1) and (-141.0 <= float(lon) <= -52.6)
@monperrus
monperrus / repos.py
Created March 16, 2025 10:30
iterate over all repos of a github organization in python
from github import Github
# First create a Github instance using an access token
g = Github("98b9ad24ffc7df18d14c9943eef3700e1b3958c5")
# Then get the organization by its name
org = g.get_organization("chains-project")
# Then iterate over all repos in the organization
for repo in org.get_repos():