code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/env python import sys, random, string PATH_INSTALL = "./" sys.path.append(PATH_INSTALL) from androguard.core.bytecodes import dvm TEST = "./examples/dalvik/test/bin/classes.dex" TEST_OUTPUT = "./examples/dalvik/test/bin/classes_output.dex" j = dvm.DalvikVMFormat( open(TEST).read() ) # Modify the name o...
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL + "./") from androguard.core.androgen import Androguard, OBFU_Names, OBFU_NAMES_FIELDS, OBFU_NAMES_METHODS TEST = [ './examples/java/test/orig/Test1.class', './examples/java/test/orig_main/Test.class' ] TEST_OUTPUT = [ './examples/java...
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL + "./core/vm") sys.path.append(PATH_INSTALL + "./core/predicates") from il_reil import VM_REIL, REIL_REGISTER, REIL_LITERAL, REIL_OFFSET, REIL_SUB, REIL_STRING x = "HELLO WORLD" var_j = REIL_REGISTER( "j", 4, 0 ) lit_1 = REIL_LITERAL...
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL + "/core") sys.path.append(PATH_INSTALL + "/core/bytecodes") import jvm TEST = "./examples/java/test/orig/Test1.class" j = jvm.JVMFormat( open(TEST).read() ) # SHOW CLASS (verbose) j.show() # SHOW FIELDS for i in j.get_fields() : ...
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL + "./") from androgen import Androguard CONF1 = "./examples/java/Demo1/androguard_1.xml" BASE_TEST = "./examples/java/Demo1/orig/" BASE_TEST_OUTPUT = "./examples/java/Demo1/new/" BASE_MAIN_TEST = "./examples/java/Demo1/orig_main/" BA...
Python
#!/usr/bin/env python import random, string import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL + "./") from androguard.core.androgen import AndroguardS TEST = './examples/java/test/orig/Test1.class' TEST_OUTPUT = './examples/java/test/new/Test1.class' TEST2 = './examples/java/Hello.class' _a = Androguard...
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append( PATH_INSTALL ) from androguard.core.bytecodes import dvm, apk TEST = "./examples/android/TC/bin/TC-debug.apk" a = apk.APK( TEST ) a.show() j = dvm.DalvikVMFormat( a.get_dex() ) # SHOW CLASS (verbose) #j.show()
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL + "/core") sys.path.append(PATH_INSTALL + "/core/bytecodes") sys.path.append(PATH_INSTALL + "/core/analysis") import jvm, analysis TEST = "./examples/java/test/orig/Test1.class" j = jvm.JVMFormat( open(TEST).read() ) x = analysis.VMA...
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL) from androguard.core.bytecodes import apk from xml.dom import minidom ap = apk.AXMLPrinter( open("examples/axml/AndroidManifest2.xml", "r").read() ) print minidom.parseString( ap.getBuff() ).toxml()
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL) from androguard.core.androgen import AndroguardS from androguard.core.analysis import analysis #TEST = 'examples/java/test/orig/Test1.class' TEST = 'examples/android/TestsAndroguard/bin/classes.dex' a = AndroguardS( TEST ) x = anal...
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL + "/core") sys.path.append(PATH_INSTALL + "/core/bytecodes") sys.path.append(PATH_INSTALL + "/core/assembly/") sys.path.append(PATH_INSTALL + "/core/assembly/libassembly") import assembly assembly.ASM() #import arm #arm.ARM() #a = ap...
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL) from androguard.core.bytecodes import dvm TEST = "./examples/dalvik/test/bin/classes.dex" j = dvm.DalvikVMFormat( open(TEST).read() ) # SHOW CLASS (verbose) j.show() # SHOW FIELDS for i in j.get_fields() : print i.get_access(),...
Python
#!/usr/bin/env python import sys PATH_INSTALL = "./" sys.path.append(PATH_INSTALL) from androguard.core.bytecodes import dvm from androguard.core.analysis import analysis from androguard.decompiler import decompiler TEST = "examples/android/TestsAndroguard/bin/classes.dex" j = dvm.DalvikVMFormat( open(TEST).read()...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This script is useful for taking the output of memdump() and # converting it back into binary output. This can be useful, for # example, when one wants to push that data into other tools like # objdump or hexdump. # # (C) Copyright 2010 Kevin O'Connor <kevin@koconnor.net> # # This file may be ...
Python
#!/usr/bin/env python # Fill in checksum/size of an option rom, and pad it to proper length. # # Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import sys def alignpos(pos, alignbytes): mask = alignbytes - 1 return (pos + mask...
Python
#!/usr/bin/python # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com> # # This file may be distributed under the terms of the GNU GPLv3 license. # Read a preprocessed ASL listing and put each ACPI_EXTRACT # directive in a comment, to make iasl skip it. # We also put each directive on a new line, th...
Python
#!/usr/bin/env python # Script to check a bios image and report info on it. # # Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import sys import layoutrom def main(): # Get args objinfo, rawfile, outfile = sys.argv[1:] # ...
Python
#!/usr/bin/env python # Script that can read from a serial device and show timestamps. # # Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. # Usage: # tools/readserial.py /dev/ttyUSB0 115200 import sys import time import select import...
Python
#!/usr/bin/env python # Script that tries to find how much stack space each function in an # object is using. # # Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. # Usage: # objdump -m i386 -M i8086 -M suffix -d out/rom16.o | tools/che...
Python
#!/usr/bin/python # Copyright (C) 2011 Red Hat, Inc., Michael S. Tsirkin <mst@redhat.com> # # This file may be distributed under the terms of the GNU GPLv3 license. # Process mixed ASL/AML listing (.lst file) produced by iasl -l # Locate and execute ACPI_EXTRACT directives, output offset info # # Documentation of ACP...
Python
#!/usr/bin/env python # Script to report the checksum of a file. # # Copyright (C) 2009 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import sys def main(): data = sys.stdin.read() ords = map(ord, data) print "sum=%x\n" % sum(ords) if __na...
Python
#!/usr/bin/env python # Encode an integer in little endian format in a file. # # Copyright (C) 2011 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import sys import struct def main(): filename = sys.argv[1] value = int(sys.argv[2]) outval =...
Python
# *-*- Mode: Python -*-* ## # # Echo back a unique integer value, and prepend to response a # leading sentinel byte (0xFF) the client can check scan for. # # This is used by clients talking to the guest agent over the # wire to ensure the stream is in sync and doesn't contain stale # data from previous client. It must...
Python
# -*- Mode: Python -*- # # QAPI Schema ## # @NameInfo: # # Guest name information. # # @name: #optional The name of the guest # # Since 0.14.0 ## { 'type': 'NameInfo', 'data': {'*name': 'str'} } ## # @query-name: # # Return the name information of a guest. # # Returns: @NameInfo of the guest # # Since 0.14.0 ## { 'co...
Python
# *-*- Mode: Python -*-* # for testing enums { 'enum': 'EnumOne', 'data': [ 'value1', 'value2', 'value3' ] } { 'type': 'NestedEnumsOne', 'data': { 'enum1': 'EnumOne', '*enum2': 'EnumOne', 'enum3': 'EnumOne', '*enum4': 'EnumOne' } } # for testing nested structs { 'type': 'UserDefOne', 'data': { 'integer': 'int',...
Python
# Copyright (c) 2009 Raymond Hettinger # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, modify, merge, # publish,...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Command-line wrapper for the tracetool machinery. """ __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>" __copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>" __license__ = "GPL version 2 or (at your option) any later version" __maintainer__...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Stderr built-in backend. """ __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>" __copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>" __license__ = "GPL version 2 or (at your option) any later version" __maintainer__ = "Stefan Hajnoczi" __em...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ DTrace/SystemTAP backend. """ __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>" __copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>" __license__ = "GPL version 2 or (at your option) any later version" __maintainer__ = "Stefan Hajnoczi" __e...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Simple built-in backend. """ __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>" __copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>" __license__ = "GPL version 2 or (at your option) any later version" __maintainer__ = "Stefan Hajnoczi" __em...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Backend management. Creating new backends --------------------- A new backend named 'foo-bar' corresponds to Python module 'tracetool/backend/foo_bar.py'. A backend module should provide a docstring, whose first non-empty line will be considered its short descripti...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ LTTng User Space Tracing backend. """ __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>" __copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>" __license__ = "GPL version 2 or (at your option) any later version" __maintainer__ = "Stefan Hajno...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Format management. Creating new formats -------------------- A new format named 'foo-bar' corresponds to Python module 'tracetool/format/foo_bar.py'. A format module should provide a docstring, whose first non-empty line will be considered its short description. A...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Machinery for generating tracing-related intermediate files. """ __author__ = "Lluís Vilanova <vilanova@ac.upc.edu>" __copyright__ = "Copyright 2012, Lluís Vilanova <vilanova@ac.upc.edu>" __license__ = "GPL version 2 or (at your option) any later version" __m...
Python
# # Option ROM signing utility # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL, version 2 or later. # See the COPYING file in the top-level directory. import sys import struct if len(sys.argv) < 3: print('usage: signrom.py input output') sys.exit(1)...
Python
#!/usr/bin/env python # # KVM Flight Recorder - ring buffer tracing script # # Copyright (C) 2012 IBM Corp # # Author: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> # # This script provides a command-line interface to kvm ftrace and is designed # to be used as a flight recorder that is always running. To start in-memo...
Python
#!/usr/bin/python # # tool for querying VMX capabilities # # Copyright 2009-2010 Red Hat, Inc. # # Authors: # Avi Kivity <avi@redhat.com> # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. MSR_IA32_VMX_BASIC = 0x480 MSR_IA32_VMX_PINBASED_CTLS = 0x4...
Python
#!/usr/bin/python # # top-like utility for displaying kvm statistics # # Copyright 2006-2008 Qumranet Technologies # Copyright 2008-2011 Red Hat, Inc. # # Authors: # Avi Kivity <avi@redhat.com> # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. imp...
Python
#!/usr/bin/env python # # Pretty-printer for simple trace backend binary trace files # # Copyright IBM, Corp. 2010 # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. # # For help see docs/tracing.txt import struct import re import inspect header_ev...
Python
#!/usr/bin/python # GDB debugging support # # Copyright 2012 Red Hat, Inc. and/or its affiliates # # Authors: # Avi Kivity <avi@redhat.com> # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. # # Contributions after 2012-01-13 are licensed under the...
Python
# # QAPI types generator # # Copyright IBM, Corp. 2011 # # Authors: # Anthony Liguori <aliguori@us.ibm.com> # # This work is licensed under the terms of the GNU GPLv2. # See the COPYING.LIB file in the top-level directory. from ordereddict import OrderedDict from qapi import * import sys import os import getopt impor...
Python
#!/usr/bin/env python # Pretty print 9p simpletrace log # Usage: ./analyse-9p-simpletrace <trace-events> <trace-pid> # # Author: Harsh Prateek Bora import os import simpletrace symbol_9p = { 6 : 'TLERROR', 7 : 'RLERROR', 8 : 'TSTATFS', 9 : 'RSTATFS', 12 : 'TLOPEN', 13 : 'RLOPEN', ...
Python
# # QAPI command marshaller generator # # Copyright IBM, Corp. 2011 # # Authors: # Anthony Liguori <aliguori@us.ibm.com> # Michael Roth <mdroth@linux.vnet.ibm.com> # # This work is licensed under the terms of the GNU GPLv2. # See the COPYING.LIB file in the top-level directory. from ordereddict import OrderedDict...
Python
# # QAPI helper library # # Copyright IBM, Corp. 2011 # # Authors: # Anthony Liguori <aliguori@us.ibm.com> # # This work is licensed under the terms of the GNU GPLv2. # See the COPYING.LIB file in the top-level directory. from ordereddict import OrderedDict def tokenize(data): while len(data): if data[0]...
Python
# # QAPI visitor generator # # Copyright IBM, Corp. 2011 # # Authors: # Anthony Liguori <aliguori@us.ibm.com> # Michael Roth <mdroth@linux.vnet.ibm.com> # # This work is licensed under the terms of the GNU GPLv2. # See the COPYING.LIB file in the top-level directory. from ordereddict import OrderedDict from qapi ...
Python
#!/usr/bin/env python # # Tests for image streaming. # # Copyright (C) 2012 IBM Corp. # # 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 Software Foundation; either version 2 of the License, or # (at your option) any...
Python
#!/usr/bin/env python import sys import struct import string class QcowHeaderExtension: def __init__(self, magic, length, data): self.magic = magic self.length = length self.data = data @classmethod def create(cls, magic, data): return QcowHeaderExtension(magic, len(da...
Python
# Common utilities and Python wrappers for qemu-iotests # # Copyright (C) 2012 IBM Corp. # # 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 Software Foundation; either version 2 of the License, or # (at your option) ...
Python
#!/usr/bin/python # # QMP command line tool # # Copyright IBM, Corp. 2011 # # Authors: # Anthony Liguori <aliguori@us.ibm.com> # # This work is licensed under the terms of the GNU GPLv2 or later. # See the COPYING file in the top-level directory. import sys, os from qmp import QEMUMonitorProtocol def print_response(...
Python
#!/usr/bin/python ## # QEMU Object Model test tools # # Copyright IBM, Corp. 2012 # # Authors: # Anthony Liguori <aliguori@us.ibm.com> # # This work is licensed under the terms of the GNU GPL, version 2 or later. See # the COPYING file in the top-level directory. ## import fuse, stat from fuse import Fuse import o...
Python
# QEMU Monitor Protocol Python class # # Copyright (C) 2009, 2010 Red Hat Inc. # # Authors: # Luiz Capitulino <lcapitulino@redhat.com> # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. import json import errno import socket class QMPError(Except...
Python
#!/usr/bin/python ## # QEMU Object Model test tools # # Copyright IBM, Corp. 2011 # # Authors: # Anthony Liguori <aliguori@us.ibm.com> # # This work is licensed under the terms of the GNU GPL, version 2 or later. See # the COPYING file in the top-level directory. ## import sys import os from qmp import QEMUMonitor...
Python
#!/usr/bin/python ## # QEMU Object Model test tools # # Copyright IBM, Corp. 2011 # # Authors: # Anthony Liguori <aliguori@us.ibm.com> # # This work is licensed under the terms of the GNU GPL, version 2 or later. See # the COPYING file in the top-level directory. ## import sys import os from qmp import QEMUMonitor...
Python
#!/usr/bin/python ## # QEMU Object Model test tools # # Copyright IBM, Corp. 2011 # # Authors: # Anthony Liguori <aliguori@us.ibm.com> # # This work is licensed under the terms of the GNU GPL, version 2 or later. See # the COPYING file in the top-level directory. ## import sys import os from qmp import QEMUMonitor...
Python
#!/usr/bin/python # # Low-level QEMU shell on top of QMP. # # Copyright (C) 2009, 2010 Red Hat Inc. # # Authors: # Luiz Capitulino <lcapitulino@redhat.com> # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. # # Usage: # # Start QEMU with: # # # qemu...
Python
#! /usr/bin/env python # GLib Testing Framework Utility -*- Mode: python; -*- # Copyright (C) 2007 Imendio AB # Authors: Tim Janik # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; eith...
Python
#!/usr/bin/env python import commands import getopt import sys SSH_USER = 'bot' SSH_HOST = 'localhost' SSH_PORT = 29418 SSH_COMMAND = 'ssh %s@%s -p %d gerrit approve ' % (SSH_USER, SSH_HOST, SSH_PORT) FAILURE_SCORE = '--code-review=-2' FAILURE_MESSAGE = 'This commit message does not match the standard.' \ + '...
Python
#!/usr/bin/env python2.6 # Copyright (c) 2010, Code Aurora Forum. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # Redistributions of source code must retain the above copyright # not...
Python
#!/usr/bin/python from optparse import OptionParser import re import subprocess import sys """ This script generates a release note from the output of git log between the specified tags. Options: --issues Show output the commits with issues associated with them. --issue-numbers Show outputs issue numbers o...
Python
#!/usr/bin/env python # # hanzim2dict # # Original version written by Michael Robinson (robinson@netrinsics.com) # Version 0.0.2 # Copyright 2004 # # 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 Software...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- import sys, os, string, re, glob import libxml2dom fencoding = 'utf-8' whattoextract = u'康熙字典' #def TextInNode(node): # result = u'' # for child in node.childNodes: # if child.nodeType == child.TEXT_NODE: # result += child.nodeValue # else: # result += TextInNode(child) ...
Python
import sys, string for line in sys.stdin.readlines(): words = string.split(line[:-1], '\t') muci = words[1] sheng = words[2] deng = words[3] hu = words[4] yunbu = words[5] diao = words[6] fanqie= words[7] she = words[8] chars = words[9] romazi= words[10] beizhu= words[12] pinyin= word...
Python
# This tool convert KangXiZiDian djvu files to tiff files. # Download djvu files: http://bbs.dartmouth.edu/~fangq/KangXi/KangXi.tar # Character page info: http://wenq.org/unihan/Unihan.txt as kIRGKangXi field. # Character seek position in Unihan.txt http://wenq.org/unihan/unihandata.txt # DjVuLibre package provides the...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from gimpfu import * import os def prepare_image(image, visibleLayers, size, numColors = None): """prepare custom image image - image object to change size - size of the image in pixels visibleLayers - a list of layers that must be visible """ for layer in imag...
Python
#!/usr/bin/python # WinVNKey Hannom Database to Stardict dictionary source Conversion Tool # coded by wesnoth@ustc on 070804 # http://winvnkey.sourceforge.net import sys, os, string, types, pprint infileencoding = 'utf-16-le' outfileencoding = 'utf-8' def showhelp(): print "Usage: %s filename" % sys.argv[0] def isha...
Python
#!/usr/bin/env python # # uyghur2dict # By Abdisalam (anatilim@gmail.com), inspired by Michael Robinson's hanzim2dict converter. # # Original version, hanzim2dict, written by Michael Robinson (robinson@netrinsics.com) # Version 0.0.2 # Copyright 2004 # # This program is free software; you can redistribute i...
Python
#!/usr/bin/env python2 # # converts XML JMDict to Stardict idx/dict format # JMDict website: http://www.csse.monash.edu.au/~jwb/j_jmdict.html # # Date: 3rd July 2003 # Author: Alastair Tse <acnt2@cam.ac.uk> # License: BSD (http://www.opensource.org/licenses/bsd-license.php) # # Usage: jm2stardict expects the file JMdi...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Script for decoding Lingea Dictionary (.trd) file # Result is <header>\t<definition> file, convertable easily # by stardict-editor from package stardict-tools into native # Stardict dictionary (stardict.sf.net and www.stardict.org) # # Copyright (C) 2007 - Klokan Petr ...
Python
import sys, string base = {} for line in sys.stdin.readlines(): words = string.split(line[:-1], '\t') if len(words) != 2: print "Error!" exit if base.has_key(words[0]): base[words[0]] += [words[1]] else: base[words[0]] = [words[1]] keys = base.keys() keys.sort() for key in keys: print key,'\t...
Python
#!/usr/bin/env python # # hanzim2dict # # Original version written by Michael Robinson (robinson@netrinsics.com) # Version 0.0.2 # Copyright 2004 # # 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 Software...
Python
#!/usr/bin/python # -*- coding: utf-8 -*- import sys, os, string, re, glob import libxml2dom fencoding = 'utf-8' whattoextract = u'康熙字典' #def TextInNode(node): # result = u'' # for child in node.childNodes: # if child.nodeType == child.TEXT_NODE: # result += child.nodeValue # else: # result += TextInNode(child) ...
Python
import sys, string for line in sys.stdin.readlines(): words = string.split(line[:-1], '\t') muci = words[1] sheng = words[2] deng = words[3] hu = words[4] yunbu = words[5] diao = words[6] fanqie= words[7] she = words[8] chars = words[9] romazi= words[10] beizhu= words[12] pinyin= word...
Python
# This tool convert KangXiZiDian djvu files to tiff files. # Download djvu files: http://bbs.dartmouth.edu/~fangq/KangXi/KangXi.tar # Character page info: http://wenq.org/unihan/Unihan.txt as kIRGKangXi field. # Character seek position in Unihan.txt http://wenq.org/unihan/unihandata.txt # DjVuLibre package provides the...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- from gimpfu import * import os def prepare_image(image, visibleLayers, size, numColors = None): """prepare custom image image - image object to change size - size of the image in pixels visibleLayers - a list of layers that must be visible """ for layer in imag...
Python
#!/usr/bin/python # WinVNKey Hannom Database to Stardict dictionary source Conversion Tool # coded by wesnoth@ustc on 070804 # http://winvnkey.sourceforge.net import sys, os, string, types, pprint infileencoding = 'utf-16-le' outfileencoding = 'utf-8' def showhelp(): print "Usage: %s filename" % sys.argv[0] def isha...
Python
#!/usr/bin/env python # # uyghur2dict # By Abdisalam (anatilim@gmail.com), inspired by Michael Robinson's hanzim2dict converter. # # Original version, hanzim2dict, written by Michael Robinson (robinson@netrinsics.com) # Version 0.0.2 # Copyright 2004 # # This program is free software; you can redistribute i...
Python
#!/usr/bin/env python2 # # converts XML JMDict to Stardict idx/dict format # JMDict website: http://www.csse.monash.edu.au/~jwb/j_jmdict.html # # Date: 3rd July 2003 # Author: Alastair Tse <acnt2@cam.ac.uk> # License: BSD (http://www.opensource.org/licenses/bsd-license.php) # # Usage: jm2stardict expects the file JMdi...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Script for decoding Lingea Dictionary (.trd) file # Result is <header>\t<definition> file, convertable easily # by stardict-editor from package stardict-tools into native # Stardict dictionary (stardict.sf.net and www.stardict.org) # # Copyright (C) 2007 - Klokan Petr ...
Python
import sys, string base = {} for line in sys.stdin.readlines(): words = string.split(line[:-1], '\t') if len(words) != 2: print "Error!" exit if base.has_key(words[0]): base[words[0]] += [words[1]] else: base[words[0]] = [words[1]] keys = base.keys() keys.sort() for key in keys: print key,'\t...
Python
""" Compute the difference between two data sets. The data sets can include an arbitrary number of fields and/or partitions. Some diagnostics are also printed. """ # Get the keys from the first block of the first data set keys = inputs[0].__iter__().next().PointData.keys() # Initialize the maximum value dictionary dma...
Python
# We assume here that the model results have been interpolated on a # structured grid and saved in a mat file. import scipy.io data = scipy.io.loadmat('data.mat') X = data['X'] Y = data['Y'] Z = data['Z'] import numpy as np import pylab as pl pl.figure() # this is useful to get a tight bounding box pl.axes([0.11,0.05,...
Python
# Copyright (C) 2009,2010,2011,2012 Marco Restelli # # This file is part of: # FEMilaro -- Finite Element Method toolkit # # FEMilaro 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 Software Foundation; either version 3 of the ...
Python
#! /usr/bin/env python # encoding: utf-8 # waf 1.6.10 VERSION='0.3.3' import sys APPNAME='p2t' top = '.' out = 'build' CPP_SOURCES = ['poly2tri/common/shapes.cc', 'poly2tri/sweep/cdt.cc', 'poly2tri/sweep/advancing_front.cc', 'poly2tri/sweep/sweep_context.cc', ...
Python
# coding=utf-8 # # 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 or agreed to in writing, software # di...
Python
#!/usr/bin/env python # # 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 or agreed to in writing, softwa...
Python
#!/usr/bin/env python # # 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 or agreed to in writing, softwa...
Python
# coding=utf-8 # # 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 or agreed to in writing, software # di...
Python
# # 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 or agreed to in writing, software # distributed under ...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012/2013, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Founda...
Python
#!/usr/bin/env python # This file is part of Androguard. # # Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr> # All rights reserved. # # Androguard is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation,...
Python