Skip to content

Instantly share code, notes, and snippets.

@averagesecurityguy
averagesecurityguy / ec2_match.py
Created November 30, 2012 02:54
Find Domains That Do Not Match Amazon EC2 Name
import os
import sys
import difflib
import requests
import socket
def get_html(domain):
if domain is None: return None
try:
print '\tGetting {0}'.format(domain)
@averagesecurityguy
averagesecurityguy / gist:4673693
Created January 30, 2013 14:38
Twitter Single User Oauth
import requests
import oauth
class Twitter():
def __init__(self):
self.consumer_key = ''
self.consumer_secret = ''
self.token = ''
self.token_secret = ''
@averagesecurityguy
averagesecurityguy / gist:6678618
Created September 23, 2013 23:56
Javascript callbacks
/*
Why does the first function work properly but the second does not? The second one fails
because the file variable does not get properly passed to testExt.
*/
/* Example 1 */
function listFiles(err, files) {
if (err) throw err;
files.forEach(function (file) {testExt(file);});
}
@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:
@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 / 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 / .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 / build.md
Last active August 29, 2015 14:02
Solar Backup System
@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 / 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: