Skip to content

Instantly share code, notes, and snippets.

@averagesecurityguy
averagesecurityguy / ec2_masscan_conf.py
Created February 4, 2015 00:37
Generate a masscan configuration file for the EC2 IP address ranges.
import requests
resp = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json')
ranges = resp.json()
sync = ranges['syncToken']
ec2 = [r['ip_prefix'] for r in ranges['prefixes'] if r['service'] == 'EC2']
with open('ec2.conf', 'wb') as f:
f.write('EC2 Masscan Configuration.\n'.encode('utf-8'))
@averagesecurityguy
averagesecurityguy / Makefile
Last active January 15, 2023 09:44
Cython Shell Example
CC=gcc
INCLUDE=/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
LINK=python2.7
FILE=shell
$(FILE): $(FILE).c
$(CC) $(FILE).c -I$(INCLUDE) -l$(LINK) -o $(FILE)
$(FILE).c:
cython --embed $(FILE).pyx
When I do a dig for googleusercontent.com I don't get an answer. If I specify the DNS server IP address I do get an answer. Not sure what is happening but curl and Python cannot resolve the address while the browser can. Any ideas?
$ dig googleusercontent.com
; <<>> DiG 9.8.3-P1 <<>> googleusercontent.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 23113
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
@averagesecurityguy
averagesecurityguy / url_scan.py
Created August 25, 2014 19:17
URL Scanner in Python
#!/usr/bin/env python
#
# The requests module is probably already on your system. If it is not
# the run: easy_install requests
#
import sys
import requests
def checkUrl(url):
try:
@averagesecurityguy
averagesecurityguy / url_scan.js
Last active August 29, 2015 14:05
URL Scanner in Node
var fs = require('fs');
var readline = require('readline');
var http = require('http');
var timeout = 2; // Timeout in seconds.
var rd = readline.createInterface({
input: fs.createReadStream('tenthousand_urls.txt'),
output: process.stdout,
terminal: false
});
@averagesecurityguy
averagesecurityguy / build.md
Last active August 29, 2015 14:02
Solar Backup System
@averagesecurityguy
averagesecurityguy / .bashrc
Created April 9, 2014 13:34
Chrome with Custom Proxy
# In your .bashrc file you need to export the BURP_SERVER and BURP_PORT environment
# variables. You can change the server and port by exporting new values before
# running the shell script.
export BURP_SERVER='127.0.0.1'
export BURP_PORT='8080'
@averagesecurityguy
averagesecurityguy / nessus_version.sh
Created January 21, 2014 15:46
Nessus Version via API
#!/bin/sh
servers="address1 address2"
for server in $servers;
do
echo "Getting version information for $server."
resp=`curl -k https://$server:8834/feed 2>/dev/null`
@averagesecurityguy
averagesecurityguy / gist:7434393
Created November 12, 2013 16:51
Redirect body sizes from Alexa top ~1500
URL Status_Code Body_Size
http://google.com 301 219
http://facebook.com 301 0
http://youtube.com 301 0
http://yahoo.com 301 211
http://wikipedia.org 301 233
http://live.com 301 0
http://twitter.com 301 0
http://qq.com 302 161
http://amazon.com 301 230
@averagesecurityguy
averagesecurityguy / redirect_sizes.py
Created November 12, 2013 16:42
Script to get redirect body sizes.
#!/usr/bin/env python
import requests
import sys
def get_redirect(url):
# Access the URL and process the set-cookie header value.
try:
resp = requests.get(url, timeout=10, allow_redirects=False)
except: