code
stringlengths
1
1.72M
language
stringclasses
1 value
import logging from residual_fit import residual_fit __all__ = ['residual_fit'] log = logging.getLogger('fitpy') log.setLevel(logging.WARNING) handler = logging.StreamHandler() handler.setLevel(logging.DEBUG) handler.setFormatter(logging.Formatter('%(levelname)s %(name)s: %(message)s')) log.addHandler(handler)
Python
import logging __all__ = ['format_as_list'] log = logging.getLogger('fitpy.parameters') def guess_initial_parameter_constraints(): raise NotImplementedError() def format_as_list(input, keys): if input: if isinstance(input, dict): log.debug('Formatting dictionary as list.') ou...
Python
# XXX Consider making this into a ResidualCostFunction object # and moving the residual closure from the factory into it. class CostFunctionWrapper(object): def __init__(self, function, parameter_names): self.function = function self.parameter_names = parameter_names def __call__(self, *args): ...
Python
import math def linmesh(min, max, num_points): ''' Create a linear mesh of points between and including the min and max values passed. ''' dx = (max-min)/float(num_points) return [min+dx*i for i in range(num_points)]
Python
import unittest import logging from fitpy import parameters class TestFormatAsList(unittest.TestCase): def test_from_dictionary(self): parameter_names = ['a', 'd', 'z'] dict_param_constraints = {'a':(0, 1), 'z':(-1, 2), 'extra':123} self.assertEqual([(0,1), None, (-1,2)], p...
Python
import inspect import itertools from fitpy.utils import iterables from . import cost_function_wrapper def count_crossings(yvalues1, yvalues2): """ Counts the number of times these function evaluations cross each other. Cases where the two come together to identical values, or separate from identical v...
Python
from . import meshes from . import parameters from . import logutils
Python
import os import logging import collections def getLogger(filename): long_name, junk = os.path.splitext(filename) begining, end = os.path.split(long_name) logger_name = '' while not ('fitpy' == end): logger_name = '.'+ end + logger_name begining, end = os.path.split(begining) else:...
Python
def isiterable(obj): return hasattr(obj, '__iter__') def make_iterable(obj, iter_type=list): if isiterable(obj): return obj return iter_type([obj]) def get_two(iterable): iterator = iter(iterable) first = iterator.next() for second in iterator: yield (first, second) fir...
Python
import inspect import itertools import collections import logging from .utils import logutils from .utils.parameters import format_as_list from .algorithms import factories import default_settings as ds from .optimize import optimize __all__ = ['residual_fit'] logger = logutils.getLogger(__file__) # XXX rename t...
Python
#!/usr/bin/env python
Python
#!/usr/bin/env python
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys def main(): if (len(sys.argv) < 2): print "faltan argumentos al programa" return 1 archivos = sys.argv[1:] output = "" i = 0 encabezado = "Seccion {}" try: salida = open("Documentacion.txt", 'w') for archivo in archivos: entrada = open(archivo)...
Python
import sys ignorados = ['*','/'] marcador_comienzo = "@DOC" marcador_fin = "@END" def main(): if (len(sys.argv) < 2): print "faltan argumentos al programa" return 1 archivos = sys.argv[:] archivos.remove("documentador.py") for archivo in archivos: try: salida = open("Documentacion" + archivo + ".txt", 'w...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys def main(): if (len(sys.argv) < 2): print "faltan argumentos al programa" return 1 archivos = sys.argv[1:] output = "" i = 0 encabezado = "Seccion {}" try: salida = open("Documentacion.txt", 'w') for archivo in archivos: entrada = open(archivo)...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys def main(): if (len(sys.argv) < 2): print "faltan argumentos al programa" return 1 archivos = sys.argv[1:] output = "" i = 0 try: encabezado = "Seccion {}" salida = open("Documentacion.txt", 'w') for archivo in archivos: entrada = open(archivo...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys def main(): if (len(sys.argv) < 2): print "faltan argumentos al programa" return 1 archivos = sys.argv[1:] output = "" i = 0 try: encabezado = "Seccion {}" salida = open("Documentacion.txt", 'w') for archivo in archivos: entrada = open(archivo...
Python
import sys ignorados = ['*','/'] marcador_comienzo = "@DOC" marcador_fin = "@END" def main(): if (len(sys.argv) < 2): print "faltan argumentos al programa" return 1 archivos = sys.argv[:] archivos.remove("documentador.py") for archivo in archivos: try: salida = open("Documentacion" + archivo + ".txt", 'w...
Python
import sys ignorados = ['*','/'] marcador_comienzo = "@DOC" marcador_fin = "@END" def main(): if (len(sys.argv) < 2): print "faltan argumentos al programa" return 1 archivos = sys.argv[:] archivos.remove("documentador.py") for archivo in archivos: try: salida = open("Documentacion" + archivo + ".txt", 'w...
Python
""" 2D Ellipse fitting Fits an ellipse to a set of points (x_i, y_i) using the canonical representation: a * x^2 + b * x * y + c * y^2 + d * x + e * y + f = 0 (1) Provided features ----------------- The module provides several function related to ellipses: `fit_elli...
Python
# -*- coding: utf-8 -*- """ :Author: Alexis Mignon :E-mail: alexis.mignon@gmail.com """ from distutils.core import setup setup(name='fit_ellipse', version='0.1', description='Least square fitting of 2D ellipses.', author='Alexis Mignon', author_email='alexis.mignon@gmail.com', py_modules=...
Python
#!/usr/bin/env python # # Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law o...
Python
#turns the all uppercase geographical regions #into more gramatically correct geographical regions def decap(l): if l.startswith("GeogRegion"): num, region = l.split("=") result = "" for i in range(len(region)): if shouldBeCaps(region, i): result += region[i].upp...
Python
#!/usr/bin/python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run ...
Python
# mycharts.py from reportlab.graphics.shapes import Drawing, String from reportlab.graphics.charts.lineplots import LinePlot from reportlab.graphics.charts.lineplots import ScatterPlot from reportlab.lib import colors from reportlab.graphics.charts.legends import Legend from reportlab.graphics.charts.textlabels im...
Python
from models import Measurement, have_trend_fields, text_fields, custom_fields from fiteat.utils import export_func, import_func, map_fields_func from fiteat.chart import graph as graph_func from django.utils.translation import ugettext as _ DAYS_FOR_WEIGHTED_AVERAGE = 7 def graph(request, fields, period): prefs =...
Python
from django.conf.urls.defaults import * urlpatterns = patterns('', # Example: (r'^graph/(?P<fields>[\w\+\_\d]+)/(?P<period>\w+)/$', 'fiteat.apps.measurements.views.graph'), (r'^export/$', 'fiteat.apps.measurements.views.export_view'), (r'^import/$', 'fiteat.apps.measurements.views.import_view'), (r...
Python
from django.db import models from django.contrib.auth.models import User from fiteat.middleware import threadlocals from fiteat.utils import get_units, truncate, flatten, save_with_trends, Constants, K from django.db.models.options import AdminOptions from django.core import validators from django.utils.translation imp...
Python
# Create your views here.
Python
from django.db import models from django.contrib.auth.models import User from fiteat.utils import Constants, K import multilingual from django.utils.translation import ugettext as _ EXERCISE_TYPES = Constants( K(cable=1, label=_('Cable')), K(barbell=2, label=_('Barbell')), K(dumbells=3, label=_('Dumbbells'...
Python
# Create your views here.
Python
from django.db import models from django.contrib.auth.models import User from django.utils.translation import gettext_lazy as _ from django.core import validators from fiteat.middleware import threadlocals UNIT_CHOICES = ( ('M', _('Metric')), ('E', _('English')) ) class Profile(models.Model): user = model...
Python
from models import Cardio from fiteat.utils import get_units, export_func, import_func, map_fields_func from fiteat.chart import graph as graph_func from django.utils.translation import ugettext as _ def export_view(request): data = Cardio.objects.filter(user=request.user).order_by('date') filename = 'cardio.c...
Python
from django.conf.urls.defaults import * urlpatterns = patterns('', # Example: (r'^graph/(?P<fields>[\w\+\_\d]+)/(?P<period>\w+)/$', 'fiteat.apps.cardio.views.graph'), (r'^export/$', 'fiteat.apps.cardio.views.export_view'), (r'^import/$', 'fiteat.apps.cardio.views.import_view'), (r'^map_fields/$', '...
Python
from django.db import models from django.contrib.auth.models import User from django.utils.translation import gettext_lazy as _ from django.core import validators from fiteat.middleware import threadlocals from fiteat.utils import get_units, truncate, flatten, save_with_trends, Constants, K from django.db.models.option...
Python
from math import floor import csv import re from datetime import datetime from django.http import HttpResponse, HttpResponseRedirect from fiteat.forms import CSVMapForm from django.shortcuts import render_to_response from itertools import count from fiteat.middleware import threadlocals from datetime import timedelta f...
Python
#!/usr/bin/python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run ...
Python
from django.conf.urls.defaults import * from settings_site import * urlpatterns = patterns('', # Example: (r'^fiteat/measure/', include('fiteat.apps.measurements.urls')), (r'^fiteat/cardio/', include('fiteat.apps.cardio.urls')), # (r'^fiteat/strength/', include('fiteat.apps.strength.urls')), (r'^f...
Python
# Django settings for fiteat project. from settings_site import * TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) MANAGERS = ADMINS SITE_ID = 1 # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. USE_I18N = True ...
Python
DEBUG = True DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. DATABASE_NAME = 'fiteat' # Or path to database file if using sqlite3. DATABASE_USER = 'fiteat' # Not used with sqlite3. DATABASE_PASSWORD = 'seledka' # Not used wi...
Python
from django import newforms as forms class CSVMapForm(forms.Form): """ A form that performs the mapping of the fields of the CSV file uploaded using ImportForm, to the fields of the DB """ def __init__(self, headers, choices, *args, **kwargs): super(CSVMapForm, self).__init__(*args, **kwar...
Python
import re # threadlocals middleware try: from threading import local except ImportError: from django.utils._threading_local import local _thread_locals = local() def get_current_user(): return getattr(_thread_locals, 'user', None) class ThreadLocals(object): """Middleware that gets various objects fro...
Python
''' Created on Jul 27, 2011 @author: Steve ''' import sys import os import re from xml.dom.minidom import parseString from shutil import copy2 from mmap import mmap class fileFuzz(object): ''' the main file fuzzer class that is used for creating and manipulating files - Steven Seeley 2010 ...
Python
# setup.py from distutils.core import setup import py2exe, sys, os sys.argv.append('py2exe') setup( console=[{'script': 'fivebelow.py', 'icon_resources': [(0, 'fivebelow.ico')]}], options = {'py2exe': {'bundle_files': 1}}, data_files=[ ( "config",["config/config.xml"] ), ...
Python
''' Created on Jul 28, 2011 @author: Steve ''' #import os.path import os #import time import sys import threading #import binascii import glob import time import random from decimal import Decimal, getcontext from pydbg import * from pydbg.defines import * from xml.dom.minidom import parseString ...
Python
''' Created on Jul 27, 2011 @author: Steve ''' import sys import re import os import time from optparse import OptionParser from FuzzLib import fileFuzz from monitor import monitor usage = "./%prog -m <mode> [<options>]" usage += "\nExample: ./%prog -m generate -t byteflip -i c:\\fuzz\\samples\\sample.j...
Python
#!python """Bootstrap setuptools installation If you want to use setuptools in your package's setup.py, just include this file in the same directory with it, and add this to the top of your setup.py:: from ez_setup import use_setuptools use_setuptools() If you want to require a specific version of setuptools...
Python
#! /usr/bin/env python sources = """ QlpoOTFBWSZTWcC/jl0G3b5///////////////////////9AwIAAgAMABABAAmIAgABEYmKFss+w y2c7JLvjyw85vVtbvvt58za+3r06d93PSrbX177PpH2bK23Zz3d0W+x7fOn3dxoKU7pZ0Ks19777 6qXno+6WDVthUsKeigoEhKoopVQAFU0dOcG0D3w+U97eeMRKSpKdsru4+73hQAfVABr5dKfIvej7 vF7va2Xa+LhLUNsqqW+ruzFaDQrp3Y21CtHQabbqHbKogiIVubq...
Python
#! /usr/bin/env python sources = """ QlpoOTFBWSZTWcC/jl0G3b5///////////////////////9AwIAAgAMABABAAmIAgABEYmKFss+w y2c7JLvjyw85vVtbvvt58za+3r06d93PSrbX177PpH2bK23Zz3d0W+x7fOn3dxoKU7pZ0Ks19777 6qXno+6WDVthUsKeigoEhKoopVQAFU0dOcG0D3w+U97eeMRKSpKdsru4+73hQAfVABr5dKfIvej7 vF7va2Xa+LhLUNsqqW+ruzFaDQrp3Y21CtHQabbqHbKogiIVubq...
Python
#!python """Bootstrap setuptools installation If you want to use setuptools in your package's setup.py, just include this file in the same directory with it, and add this to the top of your setup.py:: from ez_setup import use_setuptools use_setuptools() If you want to require a specific version of setuptools...
Python
import httplib while(True): conn = httplib.HTTPConnection('localhost',5000) r1 = conn.request("POST", "/facebook/like/1") res = conn.getresponse() print res.status, res.reason r2 = conn.request("POST", "/facebook/comment/1") res = conn.getresponse() print res.status, res.reason r3 = conn.request("POST", "/face...
Python
import signal, sys, random import threading import time from serial import Serial #Controlador class Controlador(threading.Thread): def __init__(self): threading.Thread.__init__(self) self._idle = True try: self.serial = Serial('/dev/rfcomm0', 19200, timeout = 0.1) except Exception as e: ra...
Python
from flask import Flask, request, session, g, redirect, url_for, abort, \ render_template, flash import threading, time, controlador,random filtroEventos = {} #Mapper #Thread que esta corriendo continuamente y mapea acciones al Controlador class Mapper(threading.Thread): def __init__(self): threading.Th...
Python
#!/usr/bin/python import Image bitflips = [] def binary(n, digits=8): # http://www.daniweb.com/code/snippet216539.html rep = bin(n)[2:] return ('0' * (digits - len(rep))) + rep for b in range(256): bitrep = binary(b, 8)[::-1] bitflips.append(int(bitrep, 2)) def encode(pix): i = 1 x = 0 ...
Python
# -*- coding: latin-1 -*- from copy import copy, deepcopy class FontParser(object): def __init__(self): self.char_dict = {} self.width = 5 self.height = 5 def parse(self, filename): fp = open(filename, 'rb') # Read header. line = fp.readline() x, y ...
Python
#!/usr/bin/python # Convert a font to a C data structure. # Structure supports up to 254 distinct characters. # Only works up to a maximum width of 8 pixels at the moment. import pygame, os def sort_dict(_dict): # http://corykrug.com/2007/08/13/sorting-dictionaries-in-python/ new_dict = {} sorted_keys = _d...
Python
from copy import copy, deepcopy class FontParser(object): def __init__(self): self.char_dict = {} self.width = 5 self.height = 5 def parse(self, filename): fp = open(filename, 'r') # Read header. line = fp.readline() x, y = line[1:].split('x') ...
Python
""" A voltage reference and resistive divider accuracy calculator for the feedback section of a power supply. Other features may be added later. This program works on the command line. Commands are all put on ARGV, then the results are printed out. Example usage: Simulate a 3.3V power supply using 0.8V +/-2% ref...
Python
#!/usr/bin/python import Image bitflips = [] def binary(n, digits=8): # http://www.daniweb.com/code/snippet216539.html rep = bin(n)[2:] return ('0' * (digits - len(rep))) + rep for b in range(256): bitrep = binary(b, 8)[::-1] bitflips.append(int(bitrep, 2)) def encode(pix): i = 1 x = 0 ...
Python
#!/usr/bin/python import Image bitflips = [] def binary(n, digits=8): # http://www.daniweb.com/code/snippet216539.html rep = bin(n)[2:] return ('0' * (digits - len(rep))) + rep for b in range(256): bitrep = binary(b, 8)[::-1] bitflips.append(int(bitrep, 2)) def encode(pix): i = 1 x = 0 ...
Python
#!/usr/bin/python import glob, os,sys #return list of (ipsw,kernel,ramdisk) def list_bootable(): res = [] for ipsw in glob.glob("data/ipsw/*.ipsw"): ipsw_id = os.path.basename(ipsw).replace("_Restore.ipsw", "") kernel = os.path.join("data", "boot", "kernel_%s.patched" % ipsw_id) ramdis...
Python
#!/usr/bin/env python import os,sys REDSNOW_URL="https://sites.google.com/a/iphone-dev.com/files/home/redsn0w_mac_0.9.15b3.zip" IPSWs = { #"iphone2g": "http://appldnld.apple.com.edgesuite.net/content.info.apple.com/iPhone/061-7481.20100202.4orot/iPhone1,1_3.1.3_7E18_Restore.ipsw", #"iphone3g": "http://appldn...
Python
import os import plistlib from keystore.keybag import Keybag from util.ramdiskclient import RamdiskToolClient """ this wont work on iOS 5 unless the passcode was already bruteforced """ def escrow(): client = RamdiskToolClient() di = client.getDeviceInfos() key835 = di.get("key835").decode("hex"...
Python
import plistlib import os from keystore.keybag import Keybag from keychain.keychain4 import Keychain4 from keychain.managedconfiguration import bruteforce_old_pass from util.ramdiskclient import RamdiskToolClient from util import write_file def bf_system(): curdir = os.path.dirname(os.path.abspath(__file_...
Python
#!/usr/bin/python from cmd import Cmd from firmware.img3 import Img3 from hfs.emf import cprotect_xattr, PROTECTION_CLASSES from hfs.hfs import hfs_date from keystore.keybag import Keybag, PROTECTION_CLASSES from nand.carver import NANDCarver from nand.nand import NAND from optparse import OptionParser from util import...
Python
#!/usr/bin/python from backups.backup3 import decrypt_backup3 from backups.backup4 import MBDB from icloud.backup import download_backup from keystore.keybag import Keybag from util import readPlist, makedirs import os import sys import plistlib showinfo = ["Device Name", "Display Name", "Last Backup Date", "IMEI", ...
Python
#!/usr/bin/python import os import plistlib import zipfile import struct import sys from optparse import OptionParser from crypto import aes_ctypes as AES from util.lzss import decompress_lzss devices = {"n82ap": "iPhone1,2", "n88ap": "iPhone2,1", "n90ap": "iPhone3,1", "n90bap": "iPho...
Python
from crypto.aes import AESencryptCBC, AESdecryptCBC from emf import cprotect_xattr, EMFFile from structs import * from util import write_file, sizeof_fmt import hashlib """ Implementation of the following paper : Using the HFS+ Journal For Deleted File Recovery. Aaron Burghardt, Adam Feldman. DFRWS 2008 http:...
Python
from construct import * from construct.macros import UBInt64 """ http://developer.apple.com/library/mac/#technotes/tn/tn1150.html """ def getString(obj): return obj.HFSUniStr255.unicode S_IFLNK = 0120000 kSymLinkFileType = 0x736C6E6B kSymLinkCreator = 0x72686170 kHardLinkFileType = 0x686C6E6B kHF...
Python
from structs import * """ Probably buggy HAX, only works on case SENSITIVE """ class BTree(object): def __init__(self, file, keyStruct, dataStruct): self.file = file self.keyStruct = keyStruct self.dataStruct = dataStruct block0 = self.file.readBlock(0) btnode ...
Python
from construct import Struct, ULInt16, ULInt32, String from construct.macros import ULInt64, Padding, If from crypto.aes import AESencryptCBC, AESdecryptCBC from hfs import HFSVolume, HFSFile from keystore.keybag import Keybag from structs import HFSPlusVolumeHeader, kHFSPlusFileRecord, getString, \ kHFSRootP...
Python
from btree import AttributesTree, CatalogTree, ExtentsOverflowTree from structs import * from util import write_file from util.bdev import FileBlockDevice import datetime import hashlib import os import struct import sys import zlib def hfs_date(t): return datetime.datetime(1904,1,1) + datetime.timedelta(seconds=t...
Python
from progressbar import ProgressBar from usbmux import usbmux from util import hexdump, sizeof_fmt import datetime import hashlib import struct import os CMD_DUMP = 0 CMD_PROXY = 1 kIOFlashStorageOptionRawPageIO = 0x002 kIOFlashStorageOptionBootPageIO = 0x100 class IOFlashStorageKitClient(object): ...
Python
from construct import * from structs import next_power_of_two, PAGETYPE_VFL, CEIL_DIVIDE from vfl import vfl_check_checksum, _vfl_vsvfl_spare_data """ https://github.com/iDroid-Project/openiBoot/blob/master/vfl-vsvfl/vsvfl.c https://github.com/iDroid-Project/openiBoot/blob/master/vfl-vsvfl/includes/vfl/vsvfl.h ...
Python
from carver import NANDCarver from construct.core import Struct from construct.macros import ULInt32, ULInt16, Array, ULInt8, Padding from pprint import pprint from structs import SpareData from util import hexdump from vfl import VFL import plistlib """ openiboot/plat-s5l8900/ftl.c openiboot/plat-s5l8900/i...
Python
from construct.core import Struct, Union from construct.macros import * #hardcoded iOS keys META_KEY = "92a742ab08c969bf006c9412d3cc79a5".decode("hex") FILESYSTEM_KEY = "f65dae950e906c42b254cc58fc78eece".decode("hex") def next_power_of_two(z): i = 1 while i < z: i <<= 1 return i def ...
Python
from construct import * from zipfile import crc32 GPT_HFS = "005346480000aa11aa1100306543ecac".decode("hex") GPT_EMF = "00464d450000aa11aa1100306543ecac".decode("hex") LWVM_partitionRecord = Struct("LWVM_partitionRecord", String("type", 16), String("...
Python
from crypto.aes import AESdecryptCBC from firmware.img2 import IMG2 from firmware.img3 import Img3, extract_img3s from firmware.scfg import parse_SCFG from hfs.emf import EMFVolume from hfs.hfs import HFSVolume from image import NANDImageSplitCEs, NANDImageFlat from keystore.effaceable import check_effaceable_he...
Python
from array import array from construct.core import Struct, Union from construct.macros import * from structs import next_power_of_two, CEIL_DIVIDE, PAGETYPE_VFL import struct """ https://github.com/iDroid-Project/openiBoot/blob/master/plat-s5l8900/includes/s5l8900/ftl.h https://github.com/iDroid-Project/openiB...
Python
import os import struct import sys """ row-by-row dump page = data + spare metadata + iokit return code + iokit return code 2 """ class NANDImageFlat(object): def __init__(self, filename, geometry): flags = os.O_RDONLY if sys.platform == "win32": flags |= os.O_BINARY ...
Python
from array import array from construct.core import Struct, Union from construct.macros import * from progressbar import ProgressBar from structs import * import struct #https://github.com/iDroid-Project/openiBoot/blob/master/openiboot/ftl-yaftl/yaftl.c YAFTL_CXT = Struct("YAFTL_CXT", String("version", 4...
Python
from crypto.aes import AESdecryptCBC, AESencryptCBC from hfs.emf import cprotect_xattr, EMFVolume from hfs.hfs import HFSVolume, hfs_date, HFSFile from hfs.journal import carveBtreeNode, isDecryptedCorrectly from hfs.structs import * from util import sizeof_fmt, makedirs, hexdump import hashlib import os import...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- # # usbmux.py - usbmux client library for Python # # Copyright (C) 2009 Hector Martin "marcan" <hector@marcansoft.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Soft...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- # # tcprelay.py - TCP connection relay for usbmuxd # # Copyright (C) 2009 Hector Martin "marcan" <hector@marcansoft.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free So...
Python
#!/usr/bin/python from optparse import OptionParser from hfs.emf import EMFVolume from util.bdev import FileBlockDevice import plistlib def main(): parser = OptionParser(usage="emf_decrypter.py disk_image.bin") parser.add_option("-w", "--nowrite", dest="write", action="store_false", default=True, ...
Python
#HAX d=open("redsn0w_win_0.9.9b4/redsn0w.exe", "rb").read() i = d.find("<key>IV</key>") i = d.rfind("<?xml",0,i) j = d.find("</plist>", i) assert i != -1 assert j != -1 open("Keys.plist", "wb").write(d[i:j+8])
Python
from crypto.PBKDF2 import PBKDF2 from crypto.aes import AESdecryptCBC from crypto.aeswrap import AESUnwrap from crypto.aeswrap import AESwrap from crypto.curve25519 import curve25519 from hashlib import sha256, sha1 from util.bplist import BPlistReader from util.tlv import loopTLVBlocks, tlvToDict import hmac ...
Python
from construct import RepeatUntil from construct.core import Struct, Union from construct.macros import * from crypto.aes import AESdecryptCBC from crypto.aeswrap import AESUnwrap from zipfile import crc32 import struct Dkey = 0x446B6579 EMF = 0x454D4621 BAG1 = 0x42414731 DONE = 0x444f4e45 #locker sentine...
Python
from construct.core import Struct from construct.macros import * from construct import RepeatUntil, OneOf from util import hexdump SCFGItem = Struct("SCFGItem", String("tag", 4), String("data", 16, padchar="\x00") ) SCFG = Struct("SCFG", ...
Python
from construct.core import Struct from construct.macros import * IMG2 = Struct("IMG2", String("magic",4), ULInt32("block_size"), ULInt32("images_offset"), ULInt32("images_block"), ULInt32("images_length"), Padding(0x1C), ...
Python
from crypto.aes import AESdecryptCBC from util import read_file, write_file from util.ramdiskclient import RamdiskToolClient import M2Crypto import struct import hashlib import os import sys def decryptGID(data): try: client = RamdiskToolClient.get() except: return None r = cl...
Python
#!/usr/bin/python import os import sys from hfs.emf import EMFVolume from hfs.journal import do_emf_carving from util.bdev import FileBlockDevice if __name__ == "__main__": if len(sys.argv) < 2: print "Usage: emf_undelete.py disk_image.bin" sys.exit(0) filename = sys.argv[1] volume = EMFVol...
Python
from Crypto.Cipher import AES from hashlib import sha1 from struct import unpack import os import re MBDB_SIGNATURE = 'mbdb\x05\x00' MASK_SYMBOLIC_LINK = 0xa000 MASK_REGULAR_FILE = 0x8000 MASK_DIRECTORY = 0x4000 def warn(msg): print "WARNING: %s" % msg class MBFileRecord(object): def __i...
Python
from crypto.PBKDF2 import PBKDF2 from crypto.aes import AESdecryptCBC from util import read_file, write_file, makedirs, readPlist from util.bplist import BPlistReader import hashlib import struct import glob import sys import os import re """ decrypt iOS 3 backup blob (metadata and file contents) """ d...
Python
import base64 from datetime import datetime import getpass import hashlib from httplib import HTTPSConnection import os import plistlib from pprint import pprint import re import struct from chunkserver_pb2 import FileGroups from crypto.aes import AESencryptCBC, AESdecryptCBC, AESdecryptCFB from icloud_pb...
Python
def decode_protobuf_array(data, obj_class): n = len(data) i = 0 res = [] while i < n: (length, i) = _DecodeVarint(data, i) l3 = obj_class() l3.ParseFromString(data[i:i+length]) res.append(l3) i += length return res def encode_protobuf_array(res): ...
Python
#!/usr/bin/env python from Crypto.Cipher import AES from Crypto.Util import strxor from struct import pack, unpack def gcm_rightshift(vec): for x in range(15, 0, -1): c = vec[x] >> 1 c |= (vec[x-1] << 7) & 0x80 vec[x] = c vec[0] >>= 1 return vec def gcm_gf_mult(a, b): mask = [...
Python
#!/usr/bin/python # -*- coding: ascii -*- ########################################################################### # PBKDF2.py - PKCS#5 v2.0 Password-Based Key Derivation # # Copyright (C) 2007, 2008 Dwayne C. Litzenberger <dlitz@dlitz.net> # All rights reserved. # # Permission to use, copy, modify, and distribute ...
Python
from Crypto.Util import number CURVE_P = (2**255 - 19) CURVE_A = 121665 def curve25519_monty(x1, z1, x2, z2, qmqp): a = (x1 + z1) * (x2 - z2) % CURVE_P b = (x1 - z1) * (x2 + z2) % CURVE_P x4 = (a + b) * (a + b) % CURVE_P e = (a - b) * (a - b) % CURVE_P z4 = e * qmqp % CURVE_P a ...
Python
from ctypes import * import sys if sys.platform == "darwin": kCCOptionECBMode=2 kCCAlgorithmAES128=0 kCCEncrypt=0 kCCDecrypt=1 Security = cdll.LoadLibrary("/System/Library/Frameworks/Security.framework/Security") #http://developer.apple.com/library/ios/documentation/System/Conceptual...
Python