本文整理汇总了Python中java.io.PrintWriter.flush方法的典型用法代码示例。如果您正苦于以下问题:Python PrintWriter.flush方法的具体用法?Python PrintWriter.flush怎么用?Python PrintWriter.flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.io.PrintWriter
的用法示例。
在下文中一共展示了PrintWriter.flush方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: writeAsClientGET
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import flush [as 别名]
def writeAsClientGET(cls, socket, hostField, data, playerName):
""" generated source for method writeAsClientGET """
pw = PrintWriter(socket.getOutputStream())
pw.print_("GET /" + URLEncoder.encode(data, "UTF-8") + " HTTP/1.0\r\n")
pw.print_("Accept: text/delim\r\n")
pw.print_("Host: " + hostField + "\r\n")
pw.print_("Sender: GAMESERVER\r\n")
pw.print_("Receiver: " + playerName + "\r\n")
pw.print_("\r\n")
pw.print_("\r\n")
pw.flush()
示例2: writeClientGetHTTP
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import flush [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()
示例3: writeClientPostHTTP
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import flush [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()
示例4: writeAsServer
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import flush [as 别名]
def writeAsServer(cls, socket, data):
""" generated source for method writeAsServer """
pw = PrintWriter(socket.getOutputStream())
pw.print_("HTTP/1.0 200 OK\r\n")
pw.print_("Content-type: text/acl\r\n")
pw.print_("Content-length: " + len(data) + "\r\n")
pw.print_("Access-Control-Allow-Origin: *\r\n")
pw.print_("Access-Control-Allow-Methods: POST, GET, OPTIONS\r\n")
pw.print_("Access-Control-Allow-Headers: Content-Type\r\n")
pw.print_("Access-Control-Allow-Age: 86400\r\n")
pw.print_("\r\n")
pw.print_(data)
pw.flush()
示例5: writeAsClient
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import flush [as 别名]
def writeAsClient(cls, socket, hostField, data, playerName):
""" generated source for method writeAsClient """
pw = PrintWriter(socket.getOutputStream())
pw.print_("POST / HTTP/1.0\r\n")
pw.print_("Accept: text/delim\r\n")
pw.print_("Host: " + hostField + "\r\n")
pw.print_("Sender: GAMESERVER\r\n")
pw.print_("Receiver: " + playerName + "\r\n")
pw.print_("Content-Type: text/acl\r\n")
pw.print_("Content-Length: " + len(data) + "\r\n")
pw.print_("\r\n")
pw.print_(data)
pw.flush()
示例6: BurpExtender
# 需要导入模块: from java.io import PrintWriter [as 别名]
# 或者: from java.io.PrintWriter import flush [as 别名]
class BurpExtender(IBurpExtender, IScannerListener, IProxyListener, IHttpListener):
def registerExtenderCallbacks(self, callbacks):
# keep a reference to our callbacks object
self._callbacks = callbacks
self._scanlist = [] # Holds scan items (Burp data structures)
self._scantarget = [] # Holds list of URLs added to scan
# set our extension name
callbacks.setExtensionName("Headless Scanner Driver")
# obtain our output stream
self._stdout = PrintWriter(callbacks.getStdout(), True)
self._stderr = PrintWriter(callbacks.getStderr(), True)
# register ourselves as listeners
callbacks.registerScannerListener(self)
callbacks.registerProxyListener(self)
self._stdout.println(json.dumps({"running": 1})) # Indicate we're up
self._stdout.flush()
return
def processProxyMessage(self, messageIsRequest, message):
# This method is called for every externally triggered request.
callbacks = self._callbacks # As stored in registerExtenderCallbacks
message.setInterceptAction(
IInterceptedProxyMessage.ACTION_DONT_INTERCEPT) # Inform Burp not to intercept the message.
if messageIsRequest == 1: # Booleans are integers
# Obtain message target & content
requestresponse = message.getMessageInfo()
request = requestresponse.getRequest() # returns array.array
target = requestresponse.getHttpService()
host = target.getHost()
port = target.getPort()
protocol = target.getProtocol()
# Interpret in-band signaling from the test driver
# (any request to ports 1111, 1112 will get intercepted as
# an instruction to this extension)
if port == 1111: # Show scan status
message.setInterceptAction(
IInterceptedProxyMessage.ACTION_DROP) # Was a control message, do not process further
statuses = []
for scaninstance in self._scanlist:
statuses.append(scaninstance.getStatus())
# This output may block due to output buffers being filled.
# When running this extension, something should be reading
# stdout.
self._stdout.println(json.dumps(statuses))
self._stdout.flush()
return
if port == 1112: # Dump results and quit
message.setInterceptAction(
IInterceptedProxyMessage.ACTION_DROP) # Was a control message, do not process further
scanissues = self.get_issues()
# This output may block due to output buffers being filled.
# When running this extension, something should be reading
# stdout.
self._stdout.println(json.dumps(scanissues, encoding="utf-8"))
self._stdout.flush()
callbacks.exitSuite(0) # Exit cleanly
return
if port == 1113: # Dump results but don't quit
message.setInterceptAction(
IInterceptedProxyMessage.ACTION_DROP) # Was a control message, do not process further
scanissues = self.get_issues()
#clear the scanlist to avoid getting previous issues in future scans
self._scanlist = []
# This output may block due to output buffers being filled.
# When running this extension, something should be reading
# stdout.
self._stdout.println(json.dumps(scanissues, encoding="utf-8"))
self._stdout.flush()
return
# Duplicate scan rejection
urlpath = re.search('^\w+ (.+) HTTP', request.tostring())
if urlpath is not None:
url = protocol + "://" + host + urlpath.group(1)
if self._scantarget.count(url) == 0: # Not already scanned?
self._scantarget.append(url)
# Start an active scan on the message
https = 0
if protocol == "https":
https = 1
scaninstance = callbacks.doActiveScan(host,
port,
https,
request)
self._scanlist.append(scaninstance)
return
def get_issues(self):
scanissues = []
# Collect issues. We have a list of scans that contain
# scan findings. Extract these and dump in a JSON.
for scaninstance in self._scanlist:
for scanissue in scaninstance.getIssues():
issue = {}
issue['url'] = scanissue.getUrl().toString()
#.........这里部分代码省略.........