Skip to content

Instantly share code, notes, and snippets.

View scrape_launchpad_bugs.py
# Download launchpad bugs
import sys
import subprocess
import requests
from launchpadlib.launchpad import Launchpad
cachedir = '.'
launchpad = Launchpad.login_anonymously('just testing', 'production', cachedir, version='devel')
View aircrack_coverity.sh
#!/bin/sh
PROJECT_DIR="/home/moshe/Desktop/aircrack-ng"
COV_BUILD="/home/moshe/Downloads/cov-analysis-linux64-7.6.0/bin/cov-build"
PROJECT_NAME="aircrack-ng"
BUILD_DIR="/home/moshe/Desktop/aircrack-ng_cov/cov-int"
TAR_DIR="/home/moshe/Desktop/aircrack-ng_cov/"
BUILD_CMD="make sqlite=true experimental=true pcre=true -j 4"
# Prepare to build commands
@moshekaplan
moshekaplan / pdf_decrypt.py
Created Nov 16, 2016
PyPDF2 attempt at decryption
View pdf_decrypt.py
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):
@moshekaplan
moshekaplan / PatchExtract125.ps1
Created Nov 15, 2016 — forked from anonymous/PatchExtract125.ps1
Patch Extract v1.25 by Greg Linares (@Laughing_Mantis)
View PatchExtract125.ps1
<#
================
PATCHEXTRACT.PS1
=================
Version 1.25 Microsoft MSU Patch Extraction and Patch Organization Utility by Greg Linares (@Laughing_Mantis)
This Powershell script will extract a Microsoft MSU update file and then organize the output of extracted files and folders.
Organization of the output files is based on the patch's files and will organize them based on their archicture (x86, x64, or wow64)
as well as their content-type, ie: resource and catalog files will be moved to a JUNK subfolder and patch binaries and index files will
View msg.py
#!/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"
@moshekaplan
moshekaplan / TextHandler.py
Last active Dec 31, 2019
A Logging Handler that allows logging to a Tkinter Text Widget
View TextHandler.py
#!/usr/bin/env python
# Built-in modules
import logging
import Tkinter
import threading
class TextHandler(logging.Handler):
"""This class allows you to log to a Tkinter Text or ScrolledText widget"""
def __init__(self, text):
View selenium_cookies_to_mechanize.py
import mechanize
import cookielib
import selenium.webdriver
# Create a selenium instance for browsing web pages
driver = selenium.webdriver.Firefox()
# ... Perform some actions
# Grab the cookie
@moshekaplan
moshekaplan / merge_dicts.py
Created Aug 17, 2014
Merge Python dictionaries
View merge_dicts.py
def merge_dicts(*dicts):
all_items = []
for dictionary in dicts:
all_items += dictionary.items()
return dict(all_items)
View undo_modulo_multiplication.py
#!/usr/bin/env python
"""
Given the result of a multiplication and one of the factors, calculate the
other factor
Arguments:
known_factor = the factor we're given
result = the result of the multiplication modulo some number
size_of_modulo_result = The number of bits in the result
View traceback_as_string.py
import traceback
import logging
def get_exception_info(skip=2):
"""Note, this relies on being called from the exception handler. This is very brittle to the depth of the call."""
frames_output = []
for frame in traceback.extract_stack()[:-skip]:
fname, lineno, parent, function = frame
frame_output = """ File "%s", line %d, in %s\n %s""" % (fname, lineno, parent, function)
frames_output.append(frame_output)