Skip to content

Instantly share code, notes, and snippets.

View j2abro's full-sized avatar

John Abraham j2abro

View GitHub Profile
import re
from collections import Counter
# Count unique OFACs SDN addresses
# https://www.treasury.gov/ofac/downloads/sdnlist.txt
# https://home.treasury.gov/policy-issues/financial-sanctions/specially-designated-nationals-and-blocked-persons-list-sdn-human-readable-lists
# https://home.treasury.gov/policy-issues/financial-sanctions/faqs/topic/1626
sdn_filename = 'sdn.txt'
sdn_entity = [] # Each entity on the list is separated by empty line
"transactions": [
{
"transaction_hash": "0xb80fbd585eaaeab31de87cf28564032f941255e811fe7ed77e58fc4254988dcd",
"tx_index": 0,
"bundle_index": 0,
"block_number": 14597944,
"eao_address": "0x38563699560e4512c7574C8cC5Cf89fd43923BcA",
"to_address": "0x000000000035B5e5ad9019092C665357240f594e",
"gas_used": 99595,
block blockPosition bundleIndex ethEquivAmount gasPriceGwei minerAddress trade UniswapV2PairAddress hash from to
14597944 0 0 0.69 28.21 0x00192fb10df37c9fb26829eb2cc623cd1bf599e8 Eth for NTVRK 0xddf8390ced9fad414b1ca1dd4fe14f881c2cfa70 0xb80fbd585eaaeab31de87cf28564032f941255e811fe7ed77e58fc4254988dcd 0x38563699560e4512c7574c8cc5cf89fd43923bca 0x000000000035b5e5ad9019092c665357240f594e
14597944 1 1 5.15 29.71 0x00192fb10df37c9fb26829eb2cc623cd1bf599e8 Eth for NTVRK 0xddf8390ced9fad414b1ca1dd4fe14f881c2cfa70 0xe5b52a16a63a867a497c85dc07a076231acbab7f81ae31c11ce4cf0ea7176625 0x11420153f1247554aaec76629497849a683a058b 0x68b3465833fb72a70ecdf485e0e4c7bd8665fc45
14597944 2 2 0.72 195.78 0x00192fb10df37c9fb26829eb2cc623cd1bf599e8 NTVRK for Eth 0xddf8390ced9fad414b1ca1dd4fe14f881c2cfa70 0xa81b2ae4d3a68c1f7ea0c5bc2d4ff17ba3248f88a54cc0c44fdd253656ff0f77 0x38563699560e4512c7574c8cc5cf89fd43923bca 0x000000000035b5e5ad9019092c665357240f594e
// Get the first Uniswap V2 pairs. Sorted, starting at zero. Get the next 1000 by setting skip to 1000
// https://thegraph.com/hosted-service/subgraph/uniswap/uniswap-v2
// https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2/graphql
{
pairs(first: 1000, skip: 0, orderBy: txCount, orderDirection: desc) {
id
txCount
volumeUSD
token0 {
import IUniswapV2Factory from "@uniswap/v2-core/build/IUniswapV2Factory.json" assert {type: "json"};
import { ethers } from 'ethers';
const provider = new ethers.providers.InfuraProvider("homestead", INFURA_KEY);
const UniswapV2FactoryAddress = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f';
(async () => {
const factory = new ethers.Contract( UniswapV2FactoryAddress , IUniswapV2Factory.abi , provider )
let numPairs = await factory.allPairsLength();
console.log('Number of Uniswap V2 Trading Pairs:', numPairs.toString());
}) ();
Trade Pair Trade Amt. Gas Price Blocknumber Transaction Index Transaction Hash
Attacker Frontrun ETH for FARM 220 eth 3,355.9 gwei 11908528 2 TX 0x699d
Victim Trade ETH for FARM 153 eth 536.6 gwei 11908528 62 TX 0xd82a
Attacker Backrun FARM for ETH 234.32 eth 452.9 gwei 11908530 56 TX 0x62fe
Comment Trade Blocknumber Transaction Index Transaction Hash
Attacker Frontrun ETH for FARM 11908528 2 <a href=https://etherscan.io/tx/0x699de2603b40fea219afeccf388ea6c66b36758d89ab1eebb3324239ee442378>TX 0x699d</a>
Victim Trade ETH for FARM 11908528 62 <a href=https://etherscan.io/tx/0xd82a86f8324fba7e0d374b461d6faf0c39a0d53fde06505d6c2cb8447609c617>TX 0xd82a</a>
Attacker Backrun FARM for ETH 11908530 56 <a href=https://etherscan.io/tx/0x62fedc4df9aebe7cdf7965fe1e35de7d657c94db2c55551c1954eb823a0351b6>TX 0x62fe</a>
#http://interactive.blockdiag.com/packetdiag/
packetdiag {
colwidth = 24
node_height = 80
scale_direction = ltr # right_to_left; # left_to_right, ltr, right_to_left or rtl
scale_interval = 8 # draw scale labels each 8 bytes
* Preamble [rotate = 270, len=1]
* Access\nAddress [len = 4]
* PDU\n\n(2 to 30 bytes)[len = 16]
* CRC [len = 3]
@j2abro
j2abro / ble_pdu_packet
Last active November 4, 2015 01:10
Bluetooth PDU data format for advertising packet
#http://interactive.blockdiag.com/packetdiag/
packetdiag {
colwidth = 32
node_height = 80
scale_direction = ltr # right_to_left; # left_to_right, ltr, right_to_left or rtl
scale_interval = 8 # draw scale labels each 4 bytes
0-15: Header\n\n(16 bits)
16-31: Payload\n\n(variable, per length field in header) [colheight = 2]
* PDU Type [rotate = 270, len=4]
* RFU [rotate = 270, len = 2] #this format also works