예제 #1
0
    def __call__(self):
        smtpHost = "mailhost"

        properties = System.getProperties()
        properties["mail.smtp.host"] = smtpHost
        session = Session.getInstance(System.getProperties())
        session.debug = 1

        message = MimeMessage(session)
        message.setFrom(InternetAddress("*****@*****.**"))
        message.addRecipient(Message.RecipientType.TO,
                             InternetAddress("*****@*****.**"))
        message.subject = "Test email %s from thread %s" % (
            grinder.runNumber, grinder.threadNumber)

        # One could vary this by pointing to various files for content
        message.setText("SMTPTransport Email works from The Grinder!")

        # Wrap transport object in a Grinder Jython Test Wrapper
        transport = emailSendTest1.wrap(session.getTransport("smtp"))

        transport = emailSendTest1.wrap(transport)
        transport.connect(smtpHost, "username", "password")
        transport.sendMessage(message,
                              message.getRecipients(Message.RecipientType.TO))
        transport.close()
예제 #2
0
    def __call__(self):
        smtpHost = "mailhost"

        properties = System.getProperties()
        properties["mail.smtp.host"] = smtpHost
        session = Session.getInstance(System.getProperties())
        session.debug = 1

        message = MimeMessage(session)
        message.setFrom(InternetAddress("*****@*****.**"))
        message.addRecipient(Message.RecipientType.TO,
                             InternetAddress("*****@*****.**"))
        message.subject = "Test email %s from thread %s" % (grinder.runNumber,
                                                            grinder.threadID)

        # One could vary this by pointing to various files for content
        message.setText("SMTPTransport Email works from The Grinder!")

        # Wrap transport object in a Grinder Jython Test Wrapper
        transport = emailSendTest1.wrap(session.getTransport("smtp"))

        transport = emailSendTest1.wrap(transport)
        transport.connect(smtpHost, "username", "password")
        transport.send(message)
        transport.close()
예제 #3
0
    def __init__(self, html=0, target=None, encoding=None):
        if target is None:
            target = ElementTree.TreeBuilder()
        self.target = self._target = target

        self._buffer = StringIO.StringIO()
        self._doctype = None
        self.entity = {}
        self._names = {} # name memo cache

        XMLReader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader
        self._reader = XMLReader()

        version = System.getProperties().getProperty("java.version");
        self.version = "J2SE %s" % version

        self._reader.setContentHandler(self)
        self._reader.setErrorHandler(self)
        self.parser = self._parser = self

        # Expat-like Callback Interface
        self.DefaultHandlerExpand      = self._default
        self.StartElementHandler       = self._start
        self.EndElementHandler         = self._end
        self.CharacterDataHandler      = self._data
        self.StartNamespaceDeclHandler = lambda *args: None
        self.EndNamespaceDeclHandler   = lambda *args: None
예제 #4
0
    def __init__(self):
        self.originalOut = sys.stdout

        # Setup pig
        props = Properties()

        props.putAll(javasystem.getProperties())

        for f in os.environ.get("DEFAULT_PIG_OPTS_FILES").split(","):
            PropertiesUtil.loadPropertiesFromFile(props, f) 

        props.setProperty('log4jconf', os.environ.get('LOG4J_CONF'))
        pigOpts = os.environ.get('PIG_OPTS')
        if pigOpts:
            for opt in pigOpts.strip().split(' '):
                opt = opt.split('=')
                props.setProperty(opt[0], opt[1])

        pigContext = PigContext(ExecType.LOCAL, props)

        params = ArrayList()
        paramFiles = ArrayList()
        pigContext.setParams(params)
        pigContext.setParamFiles(paramFiles)

        PigMain.configureLog4J(props, pigContext)
        pigInputStream = PigInputStream()
        reader = ConsoleReader(pigInputStream, OutputStreamWriter(javasystem.out))
        inputStream = ConsoleReaderInputStream(reader)

        self.pigBufferedReader = PigBufferedReader(InputStreamReader(pigInputStream))

        self.grunt = PigGrunt(self.pigBufferedReader, pigContext)
        self.grunt.setConsoleReader(reader)
        self.pigServer = self.grunt.pig
예제 #5
0
    def run(self):
        from java.net import URL

        # Add new scope
        if self.opts.add_to_scope:
            self.burp.includeInScope(URL(self.opts.add_to_scope))
            print("[--] Added new scope ...")

        # Send URL to spider
        if self.opts.send_to_spider:
            self.burp.sendToSpider(URL(self.opts.send_to_spider))
            print("[--] Starting spider ...")

        # Start interactive jython console
        if self.opts.interactive:
            from java.util import Properties
            pre_properties = System.getProperties()
            pre_properties['python.console'] = 'org.python.util.ReadlineConsole'
            post_properties = Properties()

            PythonInterpreter.initialize(pre_properties, post_properties, [])

            # Attach threaded console to BurpExtender
            self.burp.console = console = JLineConsole()
            console.set('Burp', self.burp)

            try:
                self.burp.stdout.write('Launching interactive session...\n')
            except Exception:
                sys.stdout.write('Launching interactive session...\n')

            ConsoleThread(console).start()
예제 #6
0
def cov_test_main():
    __doc__ = '''
    Usage: jxml-cov-test [options] <output-file> <unittest-file>...

    <output-file>       Cobertura-compatible coverage data file.
    <unittest-file>     unittest files.

    Example:
        jxml-cov-test coverage.xml test1.py test2.py
    '''
    args = docopt(__doc__)

    logging.basicConfig()
    logger = logging.getLogger('jxml.cov-test')

    from java.lang import System
    import unittest

    props = System.getProperties()
    props['javax.xml.transform.TransformerFactory'] = 'org.apache.xalan.processor.TransformerFactoryImpl'
    props['javax.xml.parsers.DocumentBuilderFactory'] = 'org.apache.xerces.jaxp.DocumentBuilderFactoryImpl'
    props['javax.xml.parsers.SAXParserFactory'] = 'org.apache.xerces.jaxp.SAXParserFactoryImpl'

    output_name = args['<output-file>']
    test_filenames = args['<unittest-file>']
    ts = load_tests(test_filenames)
    runner = unittest.TextTestRunner()
    with xsltcoverage(output_name) as coverage:
        runner.run(ts)
예제 #7
0
def cov_test_main():
    __doc__ = '''
    Usage: jxml-cov-test [options] <output-file> <unittest-file>...

    <output-file>       Cobertura-compatible coverage data file.
    <unittest-file>     unittest files.

    Example:
        jxml-cov-test coverage.xml test1.py test2.py
    '''
    args = docopt(__doc__)

    logging.basicConfig()
    logger = logging.getLogger('jxml.cov-test')

    from java.lang import System
    import unittest

    props = System.getProperties()
    props[
        'javax.xml.transform.TransformerFactory'] = 'org.apache.xalan.processor.TransformerFactoryImpl'
    props[
        'javax.xml.parsers.DocumentBuilderFactory'] = 'org.apache.xerces.jaxp.DocumentBuilderFactoryImpl'
    props[
        'javax.xml.parsers.SAXParserFactory'] = 'org.apache.xerces.jaxp.SAXParserFactoryImpl'

    output_name = args['<output-file>']
    test_filenames = args['<unittest-file>']
    ts = load_tests(test_filenames)
    runner = unittest.TextTestRunner()
    with xsltcoverage(output_name) as coverage:
        runner.run(ts)
예제 #8
0
def getRootNamingContext(corbaloc):
    props = System.getProperties()

    args = ["-ORBInitRef", corbaloc]
    orb = ORB.init(args, props)

    nameserver = orb.resolve_initial_references("NameService")
    return NamingContextHelper.narrow(nameserver)
예제 #9
0
파일: rtm.py 프로젝트: hsnuhayato/tsml
def getRootNamingContext(corbaloc):
	props = System.getProperties()

	args = ["-ORBInitRef", corbaloc]
	orb = ORB.init(args, props)

	nameserver = orb.resolve_initial_references("NameService");
	return NamingContextHelper.narrow(nameserver);
예제 #10
0
    def setCommandLineArgs(self, args):
        '''
        This method is invoked immediately after the implementation's
        constructor to pass any command-line arguments that were passed
        to Burp Suite on startup.

        The following command-line options have been made available:

        -i, --interactive   Run Burp in interactive mode (Jython Console)
        -f <FILE>           Restore from burp state file upon startup
        -h
        '''
        from optparse import OptionParser
        parser = OptionParser()

        parser.add_option('-i', '--interactive',
                          action='store_true',
                          help='Run Burp in interactive mode (Jython Console)')

        parser.add_option('-f', '--file', metavar='FILE',
                          help='Restore Burp state from FILE on startup')

        parser.add_option('-P', '--python-path',
                          default='',
                          help='Set PYTHONPATH used by Jython')

        parser.add_option('--disable-reloading',
                          action='store_true',
                          help='Disable hot-reloading when a file is changed')

        opt, args = parser.parse_args(list(args))

        if opt.interactive:
            from java.util import Properties

            pre_properties = System.getProperties()
            pre_properties['python.console'] = 'org.python.util.ReadlineConsole'

            post_properties = Properties()

            if opt.python_path:
                post_properties['python.path'] = opt.python_path

            PythonInterpreter.initialize(pre_properties, post_properties, sys.argv[1:])

            self.console = JLineConsole()
            self.console.exec('import __builtin__ as __builtins__')
            self.console.exec('from gds.burp import HttpRequest, HttpResponse')
            self.console.set('Burp', self)

            sys.stderr.write('Launching interactive session...\n')
            ConsoleThread(self.console).start()

        self.opt, self.args = opt, args

        return
예제 #11
0
def initCORBA():
	global rootnc, orb
	props = System.getProperties()
	
	args = string.split(System.getProperty("NS_OPT"))
	orb = ORB.init(args, props)

	nameserver = orb.resolve_initial_references("NameService");
	rootnc = NamingContextHelper.narrow(nameserver);
	return None
예제 #12
0
파일: hrp.py 프로젝트: 130s/openhrp3-1
def initCORBA():
    global rootnc, orb
    props = System.getProperties()

    args = string.split(System.getProperty("NS_OPT"))
    orb = ORB.init(args, props)

    nameserver = orb.resolve_initial_references("NameService")
    rootnc = NamingContextHelper.narrow(nameserver)
    return None
예제 #13
0
def printprops():

    props = System.getProperties()
    names = []

    for name in props.keys():
        names.append(name)
    names.sort()

    for val in props['java.class.path'].split(':'):
        print val
예제 #14
0
def getCmd():
    classPath = System.getProperties().get('java.class.path').split(':')
    cmd = System.getenv("pgm")
    if cmd == None:
        jarPath = classPath[1]
        print jarPath
        dir = os.path.dirname(jarPath)
        dir = os.path.dirname(dir)
        print dir
        cmd = os.path.join(dir, 'nmrfxs')
    return cmd
예제 #15
0
파일: dbg.py 프로젝트: fenfire-org/libvob
def option(o, a):
    if o in ("-d", "--dbg"):
        debugger.debugClass(a, 1)
    elif o in ("-G", "--gldbg"):
        GL.loadLib()
        print "Setting GL debug ", a
        GL.setDebugVar(a, 1)
    elif o in ("-D", ):
        m = re.match('^(.*)=(.*)$', a)
        assert m
        prop = System.getProperties()
        prop.setProperty(m.group(1), m.group(2))
        System.setProperties(prop)
예제 #16
0
def initCORBA():
    global rootnc, nshost, orb
    props = System.getProperties()

    args = string.split(System.getProperty("NS_OPT"))
    nshost = System.getProperty("NS_OPT").split(':')[2]
    if nshost == "localhost" or nshost == "127.0.0.1":
        nshost = socket.gethostname()
    print 'nshost =', nshost
    orb = ORB.init(args, props)

    nameserver = orb.resolve_initial_references("NameService")
    rootnc = NamingContextHelper.narrow(nameserver)
    return None
예제 #17
0
파일: rtm.py 프로젝트: hsnuhayato/tsml
def initCORBA():
	global rootnc, nshost, orb
	props = System.getProperties()
	
	args = string.split(System.getProperty("NS_OPT"))
	nshost = System.getProperty("NS_OPT").split(':')[2]
	if nshost == "localhost" or nshost == "127.0.0.1":
		nshost = socket.gethostname()
	print 'nshost =',nshost
	orb = ORB.init(args, props)

	nameserver = orb.resolve_initial_references("NameService");
	rootnc = NamingContextHelper.narrow(nameserver);
	return None
예제 #18
0
def launchHexEditor():
    pluginsManager = PluginsLocator.getManager()
    appfolder = pluginsManager.getApplicationFolder().getAbsolutePath()

    java = os.path.join(System.getProperties().getProperty("java.home"), "bin",
                        "java")

    installDir = getResource(__file__, "app").replace("\\", "/")
    profileDir = getDataFolder().replace("\\", "/")

    cmd = [
        java, "-Duser.home=" + profileDir, "-jar",
        installDir + "/hexeditor-1.0.jar"
    ]
    #print cmd
    subprocess.call(cmd)
예제 #19
0
    def __init__(self, console, _locals, *args, **kwargs):
        preProperties = System.getProperties()
        postProperties = Properties()

        console.callbacks.getStdout().write('Initializing interpreter with postProperties: %r\n' % (
            postProperties, ))

        console.callbacks.getStdout().write('Initializing interpreter with preProperties: %r\n' % (
            postProperties, ))

        InteractiveInterpreter.initialize(preProperties, postProperties, args)

        InteractiveInterpreter.__init__(self, _locals)
        self.setOut(StdOutRedirector(self))
        self.setErr(StdErrRedirector(self))
        self.console = console
예제 #20
0
    def __init__(self, console, _locals, *args, **kwargs):
        preProperties = System.getProperties()
        postProperties = Properties()

        console.log.debug('initializing interpreter with postProperties: %r',
                          postProperties)

        console.log.debug('Initializing interpreter with preProperties: %r',
                          preProperties)

        InteractiveInterpreter.initialize(preProperties, postProperties, args)

        InteractiveInterpreter.__init__(self, _locals)
        self.setOut(StdOutRedirector(self))
        self.setErr(StdErrRedirector(self))
        self.console = console
예제 #21
0
 def __init__(self, pig_code, args=None, arg_files=None):
     """
     pig_code: The text of the Pig script to test with no substitution or change
     args: The list of arguments of the script.
     arg_files: The list of file arguments of the script.
     """
     self.orig_pig_code = pig_code
     self.args = args or []
     self.arg_files = arg_files or []
     self.alias_overrides = {
         "STORE": "",
         "DUMP": "",
     }
     if (System.getProperties().containsKey("pigunit.exectype.cluster")):
         self.pig = PigServer(ExecType.MAPREDUCE)
     else:
         self.pig = PigServer(ExecType.LOCAL)
예제 #22
0
 def __init__(self, pig_code, args = None, arg_files = None):
     """
     pig_code: The text of the Pig script to test with no substitution or change
     args: The list of arguments of the script.
     arg_files: The list of file arguments of the script.
     """
     self.orig_pig_code = pig_code
     self.args = args or []
     self.arg_files = arg_files or []
     self.alias_overrides = {
         "STORE" : "",
         "DUMP" : "",
         }
     if (System.getProperties().containsKey("pigunit.exectype.cluster")):
         self.pig = PigServer(ExecType.MAPREDUCE)
     else:
         self.pig = PigServer(ExecType.LOCAL)
예제 #23
0
    def __init__(self, console, _locals, *args, **kwargs):
        preProperties = System.getProperties()
        postProperties = Properties()

        console.callbacks.getStdout().write(
            'Initializing interpreter with postProperties: %r\n' %
            (postProperties, ))

        console.callbacks.getStdout().write(
            'Initializing interpreter with preProperties: %r\n' %
            (postProperties, ))

        InteractiveInterpreter.initialize(preProperties, postProperties, args)

        InteractiveInterpreter.__init__(self, _locals)
        self.setOut(StdOutRedirector(self))
        self.setErr(StdErrRedirector(self))
        self.console = console
예제 #24
0
def initCORBA():
    global rootnc, nshost, orb
    try:
        props = System.getProperties()
	
        NS_OPT="-ORBInitRef NameService=corbaloc:iiop:localhost:2809/NameService" 
    #args = string.split(System.getProperty("NS_OPT"))
        args = string.split(NS_OPT)
        #nshost = System.getProperty("NS_OPT").split(':')[2]
        #if nshost == "localhost" or nshost == "127.0.0.1":
        #    nshost = socket.gethostname()
        #print 'nshost =',nshost
        orb = ORB.init(args, props)

        nameserver = orb.resolve_initial_references("NameService");
        rootnc = NamingContextHelper.narrow(nameserver);
        return None
    except:
        print "initCORBA failed"
예제 #25
0
def initCORBA():
    global rootnc, nshost, orb
    try:
        props = System.getProperties()

        NS_OPT = "-ORBInitRef NameService=corbaloc:iiop:localhost:2809/NameService"
        #args = string.split(System.getProperty("NS_OPT"))
        args = string.split(NS_OPT)
        #nshost = System.getProperty("NS_OPT").split(':')[2]
        #if nshost == "localhost" or nshost == "127.0.0.1":
        #    nshost = socket.gethostname()
        #print 'nshost =',nshost
        orb = ORB.init(args, props)

        nameserver = orb.resolve_initial_references("NameService")
        rootnc = NamingContextHelper.narrow(nameserver)
        return None
    except:
        print "initCORBA failed"
예제 #26
0
파일: avcswing.py 프로젝트: INRIM/avc
def init(core,*args,**kwargs):
  "Do init specific for this widget toolkit"
  # mapping between the real widget and the wal widget
  core['avccd'].widget_map = { \
    swing.JButton:	core['Button'], \
    swing.JCheckBox:	core['ToggleButton'], \
    swing.JColorChooser:core['ColorChooser'], \
    swing.JComboBox:	core['ComboBox'],\
    swing.JTextField:	core['Entry'], \
    swing.JLabel:	core['Label'], \
    swing.JProgressBar:	core['ProgressBar'], \
    swing.JRadioButton:	core['RadioButton'], \
    swing.JSlider:	core['Slider'], \
    swing.JSpinner:	core['SpinButton'], \
    swing.JTable:	core['ListView'],
    swing.JTextArea:	core['TextView'],
    swing.JToggleButton:core['ToggleButton'],
    swing.JTree:	core['TreeView']}
  # get toolkit version
  core['avccd'].toolkit_version = System.getProperties()['java.runtime.version']
예제 #27
0
 def __index(self, emailInfo):
     from org.apache.lucene.index import IndexWriterConfig
     from org.apache.lucene.util import Version
     from org.apache.lucene.analysis.standard import StandardAnalyzer
     analyser = StandardAnalyzer(Version.LUCENE_33)
     conf = IndexWriterConfig(Version.LUCENE_33, analyser)
     from org.apache.lucene.store import FSDirectory
     from java.io import File
     storage = File.createTempFile(u'Tubelight-', '.index')
     storage.delete()
     storage.mkdir()
     storage.deleteOnExit()
     self.storage = storage.getAbsolutePath()
     from java.io import File
     self.session.setAttribute('directory', storage.getAbsolutePath()+File.separator+'mail.idx')
     directory = FSDirectory.open(storage)
     from org.apache.lucene.index import IndexWriter
     iw = IndexWriter(directory, conf)
     from us.d8u.tubelight import Configuration
     addr = emailInfo[Configuration.EmailAddressKey]
     (username, server) = addr.split('@')
     from java.lang import System
     System.setProperty("mail.imap.partialfetch", "false")
     urlPrefix = (("imap://%s@%s:%d/Inbox") % (username, server, int(emailInfo[Configuration.EmailPortKey])))
     from javax.mail import Session
     session = Session.getDefaultInstance(System.getProperties(), None).getStore(h.get(Configuration.EmailProtocolKey))
     session.connect(server, username, emailInfo[Configuration.EmailPasswordKey])
     folder = session.getDefaultFolder()
     for m in folder.getMessages():
         from org.apache.lucene.document import Document
         d = Document()
         subject = Field("subject", m.getSubject(), Field.Store.YES, Field.Index.ANALYZED)
         toSrc = u''
         toSrc = [((u'%s, %s') % (toSrc, str(r))) for r in m.getAllRecipients()]
         to = Field("to", toSrc.substring(toSrc.indexOf(u',')), Field.Store.YES, Field.Index.ANALYZED)
         d.add(to)
         d.add(subject)
         iw.addDocument(d)
     iw.commit()
     self.searcher = IndexSearcher(directory)
def launchJEdit():
  pluginsManager = PluginsLocator.getManager()
  appfolder = pluginsManager.getApplicationFolder().getAbsolutePath()
  
  java = os.path.join( System.getProperties().getProperty("java.home"), "bin", "java")

  jeditInstallDir = getResource(__file__, "app").replace("\\","/")
  jeditProfileDir = getDataFolder().replace("\\","/")

  CP = "" #jeditInstallDir+"/jedit.jar"
  for fname in os.listdir(jeditInstallDir+"/jars"):
    CP += ":"+jeditInstallDir+"/lib/"+fname
 
  cmd = [
    java,
    "-cp",CP,
    "-splash:"+getResource(__file__, "images","jedit-splash"),
    "-Duser.home="+jeditProfileDir,
    "-jar",
    jeditInstallDir+"/jedit.jar",
    "-settings="+jeditProfileDir,
  ]
  #print cmd
  subprocess.call(cmd)
예제 #29
0
    def setCommandLineArgs(self, args):
        '''
        This method is invoked immediately after the implementation's
        constructor to pass any command-line arguments that were passed
        to Burp Suite on startup.

        The following command-line options have been made available:

        -i, --interactive   Run Burp in interactive mode (Jython Console)
        -f <FILE>           Restore from burp state file upon startup
        -d, --debug         Set log level to DEBUG
        -v, --verbose       Set log level to INFO
        -C, --config        Specify an alternate config (default: burp.ini)
        --disable-reloading Disable monitoring of plugins for changes
        -h
        '''
        from optparse import OptionParser
        parser = OptionParser()

        parser.add_option('-i', '--interactive',
                          action='store_true',
                          help='Run Burp in interactive mode (Jython Console)')

        parser.add_option('-f', '--file', metavar='FILE',
                          help='Restore Burp state from FILE on startup')

        parser.add_option('-d', '--debug',
                          action='store_true',
                          help='Set log level to DEBUG')

        parser.add_option('-v', '--verbose',
                          action='store_true',
                          help='Set log level to INFO')

        parser.add_option('-P', '--python-path',
                          default='',
                          help='Set PYTHONPATH used by Jython')

        parser.add_option('-C', '--config',
                          default='burp.ini',
                          help='Specify alternate jython-burp config file')

        parser.add_option('--disable-reloading',
                          action='store_true',
                          help='Disable hot-reloading when a file is changed')

        opt, args = parser.parse_args(list(args))

        if opt.debug:
            logging.basicConfig(
                filename='jython-burp.log',
                format='%(asctime)-15s - %(levelname)s - %(message)s',
                level=logging.DEBUG)

        elif opt.verbose:
            logging.basicConfig(
                filename='jython-burp.log',
                format='%(asctime)-15s - %(levelname)s - %(message)s',
                level=logging.INFO)

        self.config = Configuration(os.path.abspath(opt.config))

        if opt.interactive:
            from java.util import Properties

            pre_properties = System.getProperties()
            pre_properties['python.console'] = 'org.python.util.ReadlineConsole'

            post_properties = Properties()

            if opt.python_path:
                post_properties['python.path'] = opt.python_path

            PythonInterpreter.initialize(
                pre_properties, post_properties, sys.argv[1:])

            self.console = JLineConsole()
            self.console.exec('import __builtin__ as __builtins__')
            self.console.exec('from gds.burp import HttpRequest, HttpResponse')
            self.console.set('Burp', self)

            sys.stderr.write('Launching interactive session...\n')
            ConsoleThread(self.console).start()

        self.opt, self.args = opt, args

        return
예제 #30
0
def loadTauModel(name,
                 path=System.getProperties().getProperty("taup.model.path"),
                 verbose=False):
    return TauModelLoader.load(name, path, verbose)
예제 #31
0
    def setCommandLineArgs(self, args):
        '''
        This method is invoked immediately after the implementation's
        constructor to pass any command-line arguments that were passed
        to Burp Suite on startup.

        The following command-line options have been made available:

        -i, --interactive   Run Burp in interactive mode (Jython Console)
        -f <FILE>           Restore from burp state file upon startup
        -d, --debug         Set log level to DEBUG
        -v, --verbose       Set log level to INFO
        -C, --config        Specify an alternate config (default: burp.ini)
        --disable-reloading Disable monitoring of plugins for changes
        -h
        '''
        from optparse import OptionParser
        parser = OptionParser()

        parser.add_option('-i', '--interactive',
                          action='store_true',
                          help='Run Burp in interactive mode (Jython Console)')

        parser.add_option('-f', '--file', metavar='FILE',
                          help='Restore Burp state from FILE on startup')

        parser.add_option('-d', '--debug',
                          action='store_true',
                          help='Set log level to DEBUG')

        parser.add_option('-v', '--verbose',
                          action='store_true',
                          help='Set log level to INFO')

        parser.add_option('-P', '--python-path',
                          default='',
                          help='Set PYTHONPATH used by Jython')

        parser.add_option('-C', '--config',
                          default='burp.ini',
                          help='Specify alternate jython-burp config file')

        parser.add_option('--disable-reloading',
                          action='store_true',
                          help='Disable hot-reloading when a file is changed')

        opt, args = parser.parse_args(list(args))

        if opt.debug:
            logging.basicConfig(
                filename='jython-burp.log',
                format='%(asctime)-15s - %(levelname)s - %(message)s',
                level=logging.DEBUG)

        elif opt.verbose:
            logging.basicConfig(
                filename='jython-burp.log',
                format='%(asctime)-15s - %(levelname)s - %(message)s',
                level=logging.INFO)

        self.config = Configuration(opt.config)

        if opt.interactive:
            from java.util import Properties

            pre_properties = System.getProperties()
            pre_properties['python.console'] = 'org.python.util.ReadlineConsole'

            post_properties = Properties()

            if opt.python_path:
                post_properties['python.path'] = opt.python_path

            PythonInterpreter.initialize(
                pre_properties, post_properties, sys.argv[1:])

            self.console = JLineConsole()
            self.console.exec('import __builtin__ as __builtins__')
            self.console.exec('from gds.burp import HttpRequest, HttpResponse')
            self.console.set('Burp', self)

            sys.stderr.write('Launching interactive session...\n')
            ConsoleThread(self.console).start()

        self.opt, self.args = opt, args

        return
예제 #32
0
###################################################################################################
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
###################################################################################################
import os
import java.lang.System as System
import java.io.FileInputStream as FileInputStream
import java.util.Properties as Properties

propFile="/tmp/wlst.properties"

if( os.path.isfile( propFile ) ):
   propFile = FileInputStream("/tmp/wlst.properties")
   prop = System.getProperties()
   prop.load( propFile )
   System.setProperties( prop )
   System.getProperties().list(System.out)
#End if

def connectToAdminServer():
    script = sys.argv.pop(0)
    user = sys.argv.pop(0)
    url = sys.argv.pop(0)
    password = os.getenv('DEPLOYIT_WLST_PASSWORD')
    print "Connecting to WebLogic %s as user %s" %(url, user)
    connect(user, password, url)


예제 #33
0
connectionDefaults = HTTPPluginControl.getConnectionDefaults()
httpUtilities = HTTPPluginControl.getHTTPUtilities()

# connectionDefaults.setFollowRedirects(True)
# connectionDefaults.setUseCookies(True)
connectionDefaults.defaultHeaders = \
        [ NVPair('Accept-Language', 'en-us,en;q=0.5'),
          NVPair('Accept-Encoding', 'gzip, deflate'),
          NVPair('User-Agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20100101 Firefox/13.0'), ]

buildTest = Test(1, "Build")
pushTest = Test(2, "Push")

# Read the props from automatjon.properties in $HOME
props = util.Properties()
propertiesfis = javaio.FileInputStream("%s/automatjon.properties" % (System.getProperties()['user.home']))
props.load(propertiesfis)

# Update with any system properties passed. These will override the propfile
systemProps = System.getProperties()
props = systemProps
props.update(systemProps)
protocol = props['conductor.protocol']
hostname = props['conductor.hostname']
port = props['conductor.port']
cleanConductorDb = props['conductor.cleardb'] 
serverUsername = props['conductor.ssh.username']
serverPassword = props['conductor.ssh.password']
numusers = props['conductor.grinder.numusers']
profiles = props['conductor.grinder.profiles']
예제 #34
0
파일: __init__.py 프로젝트: crotwell/TauP
def loadTauModel(name, path=System.getProperties().getProperty("taup.model.path"), verbose=False):
    return TauModelLoader.load(name, path, verbose)
예제 #35
0
from java.lang import System
p = System.getProperties()
for e in p.entrySet():
   print e.getKey(), ":", e.getValue()
예제 #36
0
파일: script.py 프로젝트: chanoch/chellow
    mon = JavaSysMon()
    source.setAttribute("cpu-frequency-in-hz", df.format(mon.cpuFrequencyInHz()))
    source.setAttribute("current-pid", df.format(mon.currentPid()))
    source.setAttribute("num-cpus", df.format(mon.numCpus()))
    source.setAttribute("os-name", mon.osName())
    source.setAttribute("uptime-in-seconds", df.format(mon.uptimeInSeconds()))
    cpu = mon.cpuTimes()
    source.setAttribute("idle-millis", df.format(cpu.getIdleMillis()))
    source.setAttribute("system-millis", df.format(cpu.getSystemMillis()))
    source.setAttribute("total-millis", df.format(cpu.getTotalMillis()))
    source.setAttribute("user-millis", df.format(cpu.getUserMillis()))

    props = doc.createElement("properties")
    source.appendChild(props)
    sw = StringWriter()
    System.getProperties().store(sw, None)
    props.setTextContent(sw.toString())

    req_map = dict(
        [
            [entry.getKey(), entry.getValue()]
            for entry in inv.getMonad()
            .getServletConfig()
            .getServletContext()
            .getAttribute("net.sf.chellow.request_map")
            .entrySet()
        ]
    )

    for entry in Thread.getAllStackTraces().entrySet():
        thread_element = doc.createElement("thread")
예제 #37
0
from java.lang import System

p = System.getProperties()
for e in p.entrySet():
    print e.getKey(), ":", e.getValue()
예제 #38
0
###################################################################################################
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS.
###################################################################################################
import os
import java.lang.System as System
import java.io.FileInputStream as FileInputStream
import java.util.Properties as Properties

propFile = "/tmp/wlst.properties"

if (os.path.isfile(propFile)):
    propFile = FileInputStream("/tmp/wlst.properties")
    prop = System.getProperties()
    prop.load(propFile)
    System.setProperties(prop)
    System.getProperties().list(System.out)
#End if


def connectToAdminServer():
    script = sys.argv.pop(0)
    user = sys.argv.pop(0)
    url = sys.argv.pop(0)
    password = os.getenv('DEPLOYIT_WLST_PASSWORD')
    print "Connecting to WebLogic %s as user %s" % (url, user)
    connect(user, password, url)
예제 #39
0
def start_burp(options, *args):
    sys.path.extend([os.path.join('java', 'src'), options.burp])

    from burp_extender import BurpExtender as MyBurpExtender, ConsoleThread
    from burp import StartBurp
    import BurpExtender

    from gds.burp.config import Configuration

    if options.debug:
        logging.basicConfig(
            filename='jython-burp.log',
            format='%(asctime)-15s - %(levelname)s - %(message)s',
            level=logging.DEBUG)

    elif options.verbose:
        logging.basicConfig(
            filename='jython-burp.log',
            format='%(asctime)-15s - %(levelname)s - %(message)s',
            level=logging.INFO)

    else:
        logging.basicConfig(
            filename='jython-burp.log',
            format='%(asctime)-15s - %(levelname)s - %(message)s',
            level=logging.WARN)

    # Set the BurpExtender handler to the Pythonic BurpExtender
    Burp = MyBurpExtender()
    Burp.config = Configuration(os.path.abspath(opt.config))
    Burp.opt = options
    Burp.args = args

    BurpExtender.setHandler(Burp)
    StartBurp.main(args)

    # In latest Burp, callbacks might not get registered immediately
    while not Burp.cb:
        time.sleep(0.1)

    # Disable Burp Proxy Interception on startup
    Burp.setProxyInterceptionEnabled(False)

    if options.interactive:
        from java.util import Properties
        pre_properties = System.getProperties()
        pre_properties['python.console'] = 'org.python.util.ReadlineConsole'

        post_properties = Properties()

        PythonInterpreter.initialize(pre_properties, post_properties, [])

        # Attach threaded console to BurpExtender
        Burp.console = console = JLineConsole()
        console.set('Burp', Burp)

        try:
            Burp.stdout.write('Launching interactive session...\n')
        except Exception:
            sys.stdout.write('Launching interactive session...\n')

        ConsoleThread(console).start()
예제 #40
0
파일: cloud.py 프로젝트: piyush76/EMS
def sendJournalMessage(guid, sender, to, cc, bcc, domain, cloudDomain, mtaHost):    
    randomId = String.valueOf(Random(System.currentTimeMillis()).nextInt(1000000))    
    print 'Sending message ' + randomId + ' to journaling address ' + guid + '@' + cloudDomain
    
    try:
        props = System.getProperties()
        props.put("mail.smtp.host", mtaHost)
        props.put("mail.smtp.starttls.enable", "false")     

        session = Session.getDefaultInstance(props)
        session.setDebug(True)

        # create message envelope
        envelope = MimeMessage(session)
        envelope.setSentDate(Date(System.currentTimeMillis() - 2000))
        envelope.setSubject("Test Journal Envelope " + randomId)
        envelope.setFrom(InternetAddress(sender + "@" + domain))
        
        # alternating character sets
        if (int(randomId) % 2) == 0:
            envelope.setText(String('bullet \x95, euro sign \x80, latin F \x83, tilde \x98', 'windows-1252'), 'windows-1252')
        elif (int(randomId) % 3) == 0:
            envelope.setText('plain ascii text...', 'us-ascii')
        else:
            envelope.setText('bullet \xe2\x80\xa2, euro sign \xe2\x82\xac, latin F \xc6\x92, tilde \x7e', 'utf-8')

        if to is not None:
            for recipient in to:
                envelope.addRecipient(Message.RecipientType.TO, InternetAddress(recipient + "@" + domain))
        if cc is not None:
            for recipient in cc:
                envelope.addRecipient(Message.RecipientType.CC, InternetAddress(recipient + "@" + domain))
        if bcc is not None:
            for recipient in bcc:
                envelope.addRecipient(Message.RecipientType.BCC, InternetAddress(recipient + "@" + domain))
        
        # generate message-id
        envelope.saveChanges()
        
        # create journal envelope
        journalEnvelope = MimeMessage(session)
        journalEnvelope.setHeader("X-MS-Journal-Report", "")
        journalEnvelope.setSentDate(Date())
        journalEnvelope.setSubject(envelope.getSubject())                   
        journalEnvelope.setFrom(InternetAddress("pseudoexchange@" + domain))            
        journalEnvelope.addRecipient(Message.RecipientType.TO, InternetAddress(guid + "@" + cloudDomain))
        
        # Sender: [email protected]
        # Subject: RE: Test - load CAtSInk
        # Message-Id: <[email protected]=
        # 1dev.com>
        # To: [email protected]
        # Cc: [email protected]
        # Bcc: [email protected]            
        journalReport = StringBuilder()
        journalReport.append("Sender: ").append(sender + "@" + domain).append("\r\n")
        journalReport.append("Subject: ").append(envelope.getSubject()).append("\r\n")
        journalReport.append("Message-Id: ").append(envelope.getMessageID()).append("\r\n")
        
        if to is not None:
            for recipient in to:
                journalReport.append("To: ").append(recipient + "@" + domain).append("\r\n")            
        if cc is not None:
            for recipient in cc:
                journalReport.append("Cc: ").append(recipient + "@" + domain).append("\r\n")                 
        if bcc is not None:
            for recipient in bcc:
                journalReport.append("Bcc: ").append(recipient + "@" + domain).append("\r\n")
        
        multipart = MimeMultipart()
        
        reportPart = MimeBodyPart()
        reportPart.setText(journalReport.toString(), "us-ascii")
        multipart.addBodyPart(reportPart)
        
        messagePart = MimeBodyPart()
        messagePart.setContent(envelope, "message/rfc822")
        multipart.addBodyPart(messagePart)

        journalEnvelope.setContent(multipart)
        
        try:
            Transport.send(journalEnvelope)
        except:
            print "Send failed, will try to propagate MTA configuration again..."            
            propagateMtaConfig()
            Transport.send(journalEnvelope)
        
        return True
    except:
        print 'Failed to send journaled message', randomId
        raise