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
PyPDF2 attempt at decryption | |
Modifications to file: pdf.py | |
References: | |
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/pdf_reference_1-7.pdf | |
https://github.com/qpdf/qpdf/blob/master/libqpdf/QPDF_encryption.cc#L400 | |
http://security.stackexchange.com/questions/95781/what-security-scheme-is-used-by-pdf-password-encryption-and-why-is-it-so-weak | |
def decode_permissions(self, permissions_code): |
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
def lcs(str1, str2): | |
# If either string is empty, stop | |
if len(str1) == 0 or len(str2) == 0: | |
return "" | |
# First property | |
if str1[-1] == str2[-1]: | |
return lcs(str1[:-1], str2[:-1]) + str1[-1] | |
# Second proprerty |
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
""" | |
MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm | |
Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All | |
rights reserved. | |
License to copy and use this software is granted provided that it | |
is identified as the "RSA Data Security, Inc. MD5 Message-Digest | |
Algorithm" in all material mentioning or referencing this software | |
or this function. |
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 | |
# -*- coding: latin-1 -*- | |
""" | |
ExtractMsg: | |
Extracts emails and attachments saved in Microsoft Outlook's .msg files | |
https://github.com/mattgwwalker/msg-extractor | |
""" | |
__author__ = "Matthew Walker" |
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 | |
import sys | |
from scapy.all import * | |
MAC = "00:0c:29:bf:b0:5a" # MAC Addr of Sockstress Attacker | |
def findARP(p): | |
op = p.sprintf("%ARP.op%") | |
if op == "who-has": # Only respond to ARP Requests | |
psrc = p.sprintf("%ARP.psrc%") |
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 pyimgur | |
CLIENT_ID = "" | |
im = pyimgur.Imgur(CLIENT_ID) | |
blacklist = ['nsfw'] | |
def is_fishy_imgur(id): | |
# Takes an Imgur ID and returns True if it is fishy | |
image = im.get_image(id) |
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
# CIDR to ipv4 | |
# Written by Moshe Kaplan | |
def to_long(ip): | |
ip = ip.split('.', 4) | |
return int(ip[0])*(2**24) + int(ip[1])*(2**16) + int(ip[2])*(2**8) + int(ip[3]) | |
def to_dotted_decimal(long_form): | |
octets = [] | |
for i in range(4): | |
octets += [str(long_form % 2**8)] |
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 hashlib | |
salt = "This is a super secret salt. Nobody should ever be able to guess this.6rAtas7swe9ach6rAtas7swe9achXrAtas7swe9ach6rAtas7swe9ach6rAtas7swe9ach6rAtas7swe9ach" | |
def get_code(number, length): | |
"""Returns the first length bytes of the generated 'code'""" | |
return hashlib.sha512(str(number) + str(salt)).hexdigest()[:length] | |
for i in range(10): | |
print get_code(i, 7) |
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 cv2 | |
from cv2 import cv | |
method = cv.CV_TM_SQDIFF_NORMED | |
template_name = "mozicon128.png" | |
image_name = "test2.jpeg" | |
# Load | |
needle = cv2.imread(template_name) |