This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from re import compile | |
from django.conf import settings | |
from django.http import HttpResponseRedirect | |
from django.utils.http import is_safe_url | |
EXEMPT_URLS = [compile(settings.LOGIN_URL.lstrip('/'))] | |
if hasattr(settings, 'LOGIN_EXEMPT_URLS'): | |
EXEMPT_URLS += [compile(expr) for expr in settings.LOGIN_EXEMPT_URLS] | |
class LoginRequiredMiddleware: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.core.mail.backends.base import BaseEmailBackend | |
from django.core.mail.message import sanitize_address | |
import sendgrid | |
class SendgridBackend(BaseEmailBackend): | |
def __init__(self, user=None, token=None, **kwargs): | |
super(SendgridBackend, self).__init__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Patch docx file with a tracking URL | |
Author: Roy Firestein (roy[at]firestein[dot]net) | |
Date: October 28, 2014 | |
Based on code from https://docping.me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import imaplib | |
import email | |
from datetime import datetime | |
### | |
### Enter your IMAP server address here | |
### | |
mail = imaplib.IMAP4_SSL('mail.example.com') | |
### | |
### Enter your email and password here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd "$(dirname "$0")" | |
while test $# -gt 0; do | |
case "$1" in | |
-h|--help) | |
echo " " | |
echo "domain watcher" | |
echo " " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
Decode quoted-printable text in a file | |
""" | |
import sys | |
import quopri | |
from BeautifulSoup import BeautifulSoup as bs | |
print '\t\tHTML Extract0r 2014\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Name: logentries.config | |
# Description: configure rsyslogd to include logfiles from apache | |
# | |
# Steps: | |
# 1. Save this file as .ebextensions/logentries.config | |
# 2. Replace 'TOKEN' below (line 37) | |
# 3. Deploy per normal scripts or aws.push. | |
# | |
files: | |
"/etc/rsyslog.d/apache.conf" : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from copy import copy | |
import json | |
import logging | |
import requests | |
class Cymon(object): | |
def __init__(self, auth_token, endpoint='https://cymon.io/api/nexus/v1'): | |
self.endpoint = endpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Remove Nessus findings by hostname or IP address from .nessus files | |
Example usage: | |
python nessus_exclude.py –d nessus_files/ -r 10.1.1.1,10.2.2.2,hostname.internal | |
""" | |
import os | |
import xml.dom.minidom | |
from optparse import OptionParser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
Analyze Apache log file to identify malicious request sources | |
''' | |
from os import path | |
import sys | |
import urllib | |
import json | |
def apache2_logrow(s): |
OlderNewer