Skip to content

Instantly share code, notes, and snippets.

View princeleonal's full-sized avatar
🎯
Focusing

leo princeleonal

🎯
Focusing
View GitHub Profile
@princeleonal
princeleonal / setup-duti.sh
Created June 7, 2025 02:08 — forked from PaulRBerg/setup-duti.sh
Script to set Cursor as the default editor for all development file extensions on macOS using duti: https://github.com/moretension/duti/
#!/usr/bin/env zsh
# Set up the default application for file types.
# Strict mode: https://gist.github.com/vncsna/64825d5609c146e80de8b1fd623011ca
set -euo pipefail
# grab Cursor's bundle-ID
BUNDLE_ID=$(osascript -e 'id of app "Cursor"')
# Extensions in alphabetical order
EXTENSIONS=(
@princeleonal
princeleonal / block_hash_oracle.vy
Created May 8, 2025 15:53 — forked from pcaversaccio/block_hash_oracle.vy
Historical block hashes oracle Vyper contract.
# pragma version ~=0.4.1
"""
@title Historical Block Hashes Oracle
@custom:contract-name block_hash_oracle
@license GNU Affero General Public License v3.0 only
@author pcaversaccio
@notice The contract function `block_hash` can be used to access the
historical block hashes beyond the default 256-block limit.
We use the EIP-2935 (https://eips.ethereum.org/EIPS/eip-2935)
history contract, which maintains a ring buffer of the last

NSLOC stands for 'Normalized Source Code', which is a custom measurement we use (among others) when evaluating the complexity of a codebase.

To get the NSLOC count of a file:

  1. For all functions, reduce any multiline function declarations to a single line.
  2. Remove all comments
  3. Remove all empty lines
  4. Count the remaining lines

Example:

@princeleonal
princeleonal / cronos-reentrancy.md
Created March 25, 2024 14:39 — forked from fatherGoose1/cronos-reentrancy.md
Bug report of Tectonic (Cronos) reentrancy to mint tokens at 100x actual rate.

Bug Description

There is a reentrancy vulnerability in TectonicStakingPoolV3.sol (https://cronoscan.com/address/0xE165132FdA537FA89Ca1B52A647240c2B84c8F89).

The issue arises due to the function performConversionForTokens() which is currently open for anyone to call because tcmPublicAccess is currently true. During a call to performConversionForTokens(), reentrancy can be achieved with the end result being the free minting of xTonic tokens. A brief description of the token conversion process:

  • The staking pool contract holds predominantly TONIC.
  • Other approved tokens held by the staking pool can be swapped for TONIC. For example, if the pool holds some WCRO, it can be swapped for TONIC using performConversionForTokens() which increases the contract's TONIC balance, thus increasing rewards for its stakers.
  • Upon successful conversion, any extra TONIC that was received during the swap (more than the oracle quote) is sent to the function caller as a reward.

The issue with the above is that a caller can

@princeleonal
princeleonal / setup.md
Created February 10, 2024 04:24 — forked from akella/setup.md
My Setup
@princeleonal
princeleonal / markdown-text-101.md
Created February 1, 2024 16:27 — forked from matthewzring/markdown-text-101.md
A guide to Markdown on Discord.

Markdown Text 101

Want to inject some flavor into your everyday text chat? You're in luck! Discord uses Markdown, a simple plain text formatting system that'll help you make your sentences stand out. Here's how to do it! Just add a few characters before & after your desired text to change your text! I'll show you some examples...

What this guide covers:

@princeleonal
princeleonal / 1_top+hacker_methodologies.md
Created January 6, 2024 09:54 — forked from ruevaughn/1_top+hacker_methodologies.md
Hacker Methodologies & Tools (NEW)

The Top Hacker Methodologies & Tools Notes

Nuclei Templates

Concrete5 CMS : Identification, Mass Hunting, Nuclei Template Writing & Reporting


@princeleonal
princeleonal / bitcoin-merkle-proofs.js
Created December 1, 2023 04:50 — forked from eddmann/bitcoin-merkle-proofs.js
Bitcoin Internals: Verifying Merkle Roots using Merkle Proofs in JavaScript
const fetchLatestBlock = () =>
fetch(`https://blockchain.info/q/latesthash?cors=true`)
.then(r => r.text());
const fetchMerkleRootAndTransactions = block =>
fetch(`https://blockchain.info/rawblock/${block}?cors=true`)
.then(r => r.json())
.then(d => [d.mrkl_root, d.tx.map(t => t.hash)]);
const random = arr =>

How to pass the OSCP

  1. Recon
  2. Find vuln
  3. Exploit
  4. Document it

Recon

Unicornscans in cli, nmap in msfconsole to help store loot in database.