当前位置: 首页>>代码示例>>Python>>正文


Python PrintWriter.println方法代码示例

本文整理汇总了Python中java.io.PrintWriter.println方法的典型用法代码示例。如果您正苦于以下问题:Python PrintWriter.println方法的具体用法?Python PrintWriter.println怎么用?Python PrintWriter.println使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.PrintWriter的用法示例。


在下文中一共展示了PrintWriter.println方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: register_script

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
    def register_script(self):
        """
        Registers a pig scripts with its variables substituted.
        raises: IOException If a temp file containing the pig script could not be created.
        raises: ParseException The pig script could not have all its variables substituted.

        todo: Refactor this processes that result in calling this method.  This method gets
        called twice for a single assert as every method that needs the data assumes no one
        else has called it (even methods that call other methods that call it (assertOutput()
        calls get_alias() which both call this method).  
        """
        pigIStream = BufferedReader(StringReader(self.orig_pig_code))
        pigOStream =  StringWriter()

        ps = ParameterSubstitutionPreprocessor(50) # Where does 50 come from?
        ps.genSubstitutedFile(pigIStream, pigOStream, self.args, self.arg_files)

        substitutedPig = pigOStream.toString()
        f = File.createTempFile("tmp", "pigunit")
        pw = PrintWriter(f)
        pw.println(substitutedPig)
        pw.close()

        pigSubstitutedFile = f.getCanonicalPath()
        self._temp_pig_script = pigSubstitutedFile

        self.pig.registerScript(pigSubstitutedFile, self.alias_overrides)        
开发者ID:MarkRoddy,项目名称:squealer,代码行数:29,代码来源:pigproxy.py

示例2: BurpExtender

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
class BurpExtender(IBurpExtender, IScannerListener, IExtensionStateListener):

    # init module settings and variables
    # hoping to make this a GUI option (not sure how yet)


    
    #
    # implement IBurpExtender
    #


    def registerExtenderCallbacks(self, callbacks):
        
        # keep a reference to our callbacks object
        self._callbacks = callbacks
        
        # set our extension name
        callbacks.setExtensionName("Scanner Streamer [c22]")
        
        # obtain our output stream
        self._stdout = PrintWriter(callbacks.getStdout(), True)

        # register ourselves as a Scanner listener
        callbacks.registerScannerListener(self)
        
        # register ourselves as an extension state listener
        callbacks.registerExtensionStateListener(self)
        
        # call initExtension routine
        initExtension()

        return


    #
    # implement IScannerListener
    #

    def newScanIssue(self, issue):
        
        if domainInScope(self, issue):
            # check if finding already displayed for this hostname
            if newFinding(issue):
                outputFinding(self, issue)
            else:
                # already displayed
                if verbose:
                    self._stdout.println("[-] Finding already displayed (%s)" % issue.getIssueName())

        return

    #
    # implement IExtensionStateListener
    #

    def extensionUnloaded(self):

        self._stdout.println("\n[!] Scanner_Streamer.py extension was unloaded")
        return
开发者ID:0x4d4e,项目名称:Random_Code,代码行数:62,代码来源:scanner_streamer.py

示例3: createInputFile

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
 def createInputFile(self, fs, fileName, input_data):
     if(fs.exists(Path(fileName))):
         raise IOException("File " + fileName + " already exists on the minicluster")
     stream = fs.create(Path(fileName))
     pw = PrintWriter(OutputStreamWriter(stream, "UTF-8"))
     for i in xrange(len(input_data)):
         pw.println(input_data[i])
     pw.close();
开发者ID:MarkRoddy,项目名称:squealer,代码行数:10,代码来源:cluster.py

示例4: registerExtenderCallbacks

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
	def registerExtenderCallbacks(self, callbacks):
		
		callbacks.setExtensionName("Seccasts Tutorial - Jython")
		
		stdout = PrintWriter(callbacks.getStdout(), True)
		
		stdout.println("Hello from Seccasts!")
		
		return
开发者ID:SecCasts,项目名称:seccasts,代码行数:11,代码来源:hello_world.py

示例5: BurpExtender

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
class BurpExtender(IBurpExtender, IHttpRequestResponse, IHttpService, ITab):

  def registerExtenderCallbacks(self, callbacks):
    self.callbacks = callbacks
    self.helpers = callbacks.getHelpers()
    self.stdout = PrintWriter(callbacks.getStdout(), True)
    self.stderr = PrintWriter(callbacks.getStderr(), True)

    callbacks.setExtensionName('Save URL List')
    self.panel = JPanel()
    self.myLabel = JLabel('Save URL List as a Text File', JLabel.CENTER)
    self.buttonFile = Button('Select File', actionPerformed=self.selectFile)
    self.buttonSaveProxy = Button('Save All Proxy History', actionPerformed=self.saveProxy)
    self.buttonSaveSiteTree = Button('Save All Target SiteTree ', actionPerformed=self.saveSiteTree)
    self.buttonSaveProxyScope = Button('Save In-Scope Proxy History', actionPerformed=self.saveProxyScope)
    self.buttonSaveSiteTreeScope = Button('Save In-Scope Target SiteTree', actionPerformed=self.saveSiteTreeScope)
    self.panel.add(self.myLabel)
    self.panel.add(self.buttonFile)
    self.panel.add(self.buttonSaveProxy)
    self.panel.add(self.buttonSaveSiteTree)
    self.panel.add(self.buttonSaveProxyScope)
    self.panel.add(self.buttonSaveSiteTreeScope)
    callbacks.customizeUiComponent(self.panel)
    callbacks.addSuiteTab(self)

  def getTabCaption(self):
    return 'URL List'

  def getUiComponent(self):
    return self.panel

  def selectFile(self, event):
    chooser = JFileChooser()
    retVal = chooser.showSaveDialog(None)
    self.saveFile = chooser.selectedFile.path

  def saveProxy(self, event):
    self.stdout.println('Writing Entire Proxy History URL List to File: ' + self.saveFile)
    writer = open(self.saveFile, 'w')
    proxyHistory = self.callbacks.getProxyHistory()

    if proxyHistory:
      for item in proxyHistory:
        try:
          request = item.getRequest()
          if request:
            service = item.getHttpService()
            myURL = self.helpers.analyzeRequest(service, request).getUrl().toString()
            writer.write(myURL + '\n')

        except Exception, e:
          self.stderr.println('Error Writing URL.')
          continue

    else:
开发者ID:WeiEast,项目名称:burpSaveUrlList,代码行数:57,代码来源:burpSaveUrlList.py

示例6: registerExtenderCallbacks

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
    def	registerExtenderCallbacks(self, callbacks):
        # set our extension name
        callbacks.setExtensionName("G2 Determine Session Cookie")
        callbacks.registerContextMenuFactory(DetermineCookieMenuItem(callbacks))

        # obtain our output and error streams
        stdout = PrintWriter(callbacks.getStdout(), True)
        stderr = PrintWriter(callbacks.getStderr(), True)
        
        # write a message to our output stream
        stdout.println("G2 Determine Session Cookie - Successful Initialization")
开发者ID:gheld,项目名称:burp-g2plugins,代码行数:13,代码来源:G2DetermineSessionCookie.py

示例7: writeClientPostHTTP

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
 def writeClientPostHTTP(self, writeOutTo, headers, data):
     """ generated source for method writeClientPostHTTP """
     bw = BufferedWriter(OutputStreamWriter(writeOutTo.getOutputStream()))
     pw = PrintWriter(bw)
     pw.println("POST / HTTP/1.0")
     if 0 > len(headers):
         pw.println(headers)
     pw.println("Content-length: " + len(data))
     pw.println()
     pw.println(data)
     pw.flush()
开发者ID:hobson,项目名称:ggpy,代码行数:13,代码来源:Test_Http.py

示例8: Connection

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
class Connection(object):
    def __init__(self, addr, port):
        self.socket = Socket(addr, port)
        self.in = BufferedReader(InputStreamReader(self.socket.getInputStream()))
        self.out = PrintWriter(self.socket.getOutputStream(), True)

    def sendMessage(self, msg):
        self.out.println(str(msg))
        response = self.in.readLine()
        if response is None: # abort abort abort
            exit(1)
        decoded = Message.decode(response)
        return decoded.msgData # empty string or hash
开发者ID:zhangmarvin,项目名称:north-american-happiness,代码行数:15,代码来源:clientNetwork.py

示例9: BurpExtender

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
class BurpExtender(IBurpExtender, IIntruderPayloadProcessor):
  def registerExtenderCallbacks(self, callbacks):
    self._callbacks = callbacks
    self._helpers = callbacks.getHelpers()

    # Register methods for error reporting
    self.stdout = PrintWriter(callbacks.getStdout(), True)
    self.stderr = PrintWriter(callbacks.getStderr(), True)

    self.stdout.println("Module loaded successfully!")
    callbacks.setExtensionName('Simple Burp Intruder Payload Processor')
    callbacks.registerIntruderPayloadProcessor(self)
    return

    def getProcessorName():
        return "Capitalize Payload Process"

    def processPayload(currentPayload, originalPayload, baseValue):
        try:
            # Data will be outputted to Burp UI by default
            self.stdout.println("currentPayload: %s" % currentPayload)
            newPayload = capitalize(currentPayload)
            self.stdout.println("newPayload: %s" % newPayload)
        except:
            print "Unexpected error:", sys.exc_info()[0]

        return newPayload

    def capitalize(data):
        # A simple function that will capitalize strings
        self.stdout.println("data: %s" % data)
        return data.upper()
开发者ID:pyoor,项目名称:burp-payload-processor-skeleton,代码行数:34,代码来源:burp-payload-processor.py

示例10: writeClientGetHTTP

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
 def writeClientGetHTTP(self, writeOutTo, headers, data):
     """ generated source for method writeClientGetHTTP """
     bw = BufferedWriter(OutputStreamWriter(writeOutTo.getOutputStream()))
     pw = PrintWriter(bw)
     pw.println("GET /" + URLEncoder.encode(data, "UTF-8") + " HTTP/1.0")
     if 0 > len(headers):
         pw.println(headers)
     pw.println("Content-length: 0")
     pw.println()
     pw.println()
     pw.flush()
开发者ID:hobson,项目名称:ggpy,代码行数:13,代码来源:Test_Http.py

示例11: registerExtenderCallbacks

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
    def registerExtenderCallbacks(self, callbacks):
        # set our extension name
        callbacks.setExtensionName("Hello world extension")

        # obtain our output and error streams
        stdout = PrintWriter(callbacks.getStdout(), True)
        stderr = PrintWriter(callbacks.getStderr(), True)

        # write a message to our output stream
        stdout.println("Hello output")

        # write a message to our error stream
        stderr.println("Hello errors")

        # write a message to the Burp alerts tab
        callbacks.issueAlert("Hello alerts")

        # throw an exception that will appear in our error stream
        raise RuntimeException("Hello exception")
开发者ID:artran,项目名称:burp-plugins,代码行数:21,代码来源:HelloWorld.py

示例12: BurpExtender

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
class BurpExtender(IBurpExtender, IIntruderPayloadProcessor):
    def registerExtenderCallbacks(self, callbacks):
        self._callbacks = callbacks
        self._helpers = callbacks.getHelpers()
        

        # Register methods for error reporting
        self.stdout = PrintWriter(callbacks.getStdout(), True)
        self.stderr = PrintWriter(callbacks.getStderr(), True)

        self.stdout.println("Module loaded successfully!")
        callbacks.setExtensionName('Add Luhn check digit')
        callbacks.registerIntruderPayloadProcessor(self)
        return

    def getProcessorName(self):
        return "Add Luhn check digit to the number"

    def processPayload(self,currentPayload, originalPayload, baseValue):
        payload = self._helpers.bytesToString(currentPayload)
        if not payload.isdigit():
            print "You need to pass a digit"
            return currentPayload
        try:
            # Data will be outputted to Burp UI by default
            self.stdout.println("currentPayload: %s" % payload)
            payload = addluhn(payload)
            self.stdout.println("newPayload: %s" % payload)
        except:
            print "Unexpected error:", sys.exc_info()[0]
        newPayload = self._helpers.stringToBytes(payload)
        return newPayload
开发者ID:EnableSecurity,项目名称:burp-luhn-payload-processor,代码行数:34,代码来源:burp-payload-processor.py

示例13: BurpExtender

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
class BurpExtender(IBurpExtender, IHttpRequestResponse, IHttpService, ITab):

  def registerExtenderCallbacks(self, callbacks):
    self.callbacks = callbacks
    self.helpers = callbacks.getHelpers()
    callbacks.setExtensionName("Hello Burp")

    self.panel = JPanel()
    self.label = JLabel("Hello Burp")
    self.buttonOutput = Button("Print to Output", actionPerformed=self.printToOutput)
    self.buttonErrors = Button("Print to Errors", actionPerformed=self.printToErrors)
    self.buttonAlerts = Button("Print to Alerts", actionPerformed=self.printToAlerts)
    self.panel.add(self.label)
    self.panel.add(self.buttonOutput)
    self.panel.add(self.buttonErrors)
    self.panel.add(self.buttonAlerts)

    callbacks.customizeUiComponent(self.panel)
    callbacks.addSuiteTab(self)

    self.stdout = PrintWriter(callbacks.getStdout(), True)
    self.stderr = PrintWriter(callbacks.getStderr(), True)
    burpInfo = callbacks.getBurpVersion()
    self.stdout.println("Hello " + burpInfo[0] + " v" + burpInfo[1] + "." + burpInfo[2] +"!")

  def getTabCaption(self):
    return "Hello Burp"

  def getUiComponent(self):
    return self.panel

  def printToOutput(self, event):
    self.stdout.println("Hello output")

  def printToErrors(self, event):
    self.stderr.println("Hello errors")

  def printToAlerts(self, event):
    self.callbacks.issueAlert("Hello alerts")
开发者ID:gregpatton,项目名称:helloBurp,代码行数:41,代码来源:helloBurp.py

示例14: BurpExtender

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
class BurpExtender(IBurpExtender, ISessionHandlingAction):
    
    #
    # implement IBurpExtender
    #
    def	registerExtenderCallbacks(self, callbacks):
        
        # keep a reference to our callbacks object
        self._callbacks = callbacks
        
        # set our extension name
        callbacks.setExtensionName("WicketRequestHandler")

        callbacks.registerSessionHandlingAction(self)
        
        # obtain our output stream
        self._stdout = PrintWriter(callbacks.getStdout(), True)
        self._stderr = PrintWriter(callbacks.getStderr(), True)

        self._helper = callbacks.getHelpers()

        return

    #
    # implement ISessionHandlingAction
    #
    # This method is used by Burp to obtain the name of the session handling
    # action. This will be displayed as an option within the session handling
    # rule editor when the user selects to execute an extension-provided
    # action.
    #
    # @return The name of the action.
    def getActionName(self):
        return "UpdateWicketInterface"

    #
    # implement ISessionHandlingAction
    #
    #
    # This method is invoked when the session handling action should be
    # executed. This may happen as an action in its own right, or as a
    # sub-action following execution of a macro.
    #
    # @param IHttpRequestResponse currentRequest The base request that is currently being processed.
    # The action can query this object to obtain details about the base
    # request. It can issue additional requests of its own if necessary, and
    # can use the setter methods on this object to update the base request.
    # @param IHttpRequestResponse[] macroItems If the action is invoked following execution of a
    # macro, this parameter contains the result of executing the macro.
    # Otherwise, it is
    # <code>null</code>. Actions can use the details of the macro items to
    # perform custom analysis of the macro to derive values of non-standard
    # session handling tokens, etc.
    #
    def performAction(self, currentRequest, macroItems):      
        if macroItems is None:
            self._stdout.println("No macro defined!")
            return

        if currentRequest is None:
            self._stdout.println("No current request!")
            return

        request_info = self._helper.analyzeRequest(currentRequest.getRequest())
        request_params = request_info.getParameters()
        if request_params is None:
            self._stdout.println("No request params to update")
            return

        wicket_interface = None
        identifier = None
        for p in request_params:
            if p.getName() == "wicket:interface":
                wicket_interface = p
            elif "_hf_0" in p.getName():
                identifier = p

        updated_request = currentRequest.getRequest()
        # Remove the identifier if it exists
        if identifier is not None:
            updated_request = self._helper.removeParameter(updated_request, identifier)
            
        # Wicket Interface needs updating
        if wicket_interface is not None:
            for m in macroItems:
                m_response = m.getResponse()
                if m_response is None:
                    self._stderr.println("No Macro Response!")
                    continue
                else:
                    m_response_info = self._helper.analyzeResponse(m_response)
                    m_response_body = self._helper.bytesToString(m_response[m_response_info.getBodyOffset():])
                    re_interface = re.compile(r"(action=\"\?wicket:interface=)([\w:]+)(\")")
                    re_identifier = re.compile(r"(\w)+_hf_0")
                    result = re_interface.search(m_response_body)
                    iresult = re_identifier.search(m_response_body)
                    if result is None:
                        self._stderr.println("No interface found in macro response!")
                    else:
                        wi_value = result.group(2)
#.........这里部分代码省略.........
开发者ID:0x24bin,项目名称:BurpSuite,代码行数:103,代码来源:burp_wicket_request_handler.py

示例15: BurpExtender

# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import println [as 别名]
class BurpExtender(IBurpExtender, ITab, IContextMenuFactory):

    #
    # implement IBurpExtender
    #

    def registerExtenderCallbacks(self, callbacks):
        
        # properties
        self._title = "Generate Python Template"
        self._templatePath = '###### ----> PUT HERE THE ABSOLUTE PATH TO template.py <--- ####'
        
        # set our extension name
        callbacks.setExtensionName(self._title)
        
        # keep a reference to our callbacks object
        self._callbacks = callbacks
        
        # obtain an extension helpers object
        self._helpers = callbacks.getHelpers()
        
        # obtain std streams
        self._stdout = PrintWriter(callbacks.getStdout(), True)
        self._stderr = PrintWriter(callbacks.getStderr(), True)
                
        # main pane (top/bottom)
        self._mainpane = JPanel()
        self._mainpane.setLayout( GridLayout(2,1) )
        
        # configure bottom pane for buttons
        self._botPane = JPanel()
        flowLayout = FlowLayout()
        self._botPane.setLayout( flowLayout )
        self._botPane.add( JButton("Generate", actionPerformed=self.regeneratePy) )
        self._botPane.add( JButton("Export", actionPerformed=self.exportPy) )
        
        # Configure pyViewer (JTextArea) for python output --> top pane
        self._pyViewer = JTextArea(5, 20);
        scrollPane = JScrollPane(self._pyViewer); 
        self._pyViewer.setEditable(True);
        self._pyViewer.setText( "Waiting request ..." );
        
        ### Assign top / bottom components
        self._mainpane.add(scrollPane)
        self._mainpane.add(self._botPane)
                
        # customize our UI components
        callbacks.customizeUiComponent(self._mainpane)
        
        # add the custom tab to Burp's UI
        callbacks.addSuiteTab(self)
        
        
        # register ourselves as a ContextMenuFactory
        callbacks.registerContextMenuFactory(self)
        
        return

    def regeneratePy(self,event):
        pass

    def exportPy(self,event):
        chooseFile = JFileChooser()
        ret = chooseFile.showDialog(self._mainpane, "Choose file")
        filename = chooseFile.getSelectedFile().getCanonicalPath()
        self._stdout.println("Export to : " + filename )
        open(filename, 'w', 0).write( self._pyViewer.getText() )


    #
    # implement ITab
    #
    
    def getTabCaption(self):
        return "PyTemplate"
    
    def getUiComponent(self):
        return self._mainpane


    #
    # implement IContextMenuFactory
    #

    def createMenuItems(self, invocation):
        # add a new item executing our action
        item = JMenuItem(self._title, actionPerformed=lambda x, inv=invocation: self.loadRequest(inv))
        return [ item ]

    def loadRequest(self, invocation):
        pyCode = self.pythonHeader()
        selectedMessages = invocation.getSelectedMessages()
        self._numbMessages = len(selectedMessages)
        self._currentMessageNumber = 1
        for message in selectedMessages:
            self._currentlyDisplayedItem = message
            pyCode += self.generateRequest()
            self._currentMessageNumber += 1
        pyCode += '\n' + self.generateMain()
        self._pyViewer.setText( pyCode );
#.........这里部分代码省略.........
开发者ID:Logan-lu,项目名称:burp-pyTemplate,代码行数:103,代码来源:generate_python.py


注:本文中的java.io.PrintWriter.println方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。