예제 #1
0
    def _prepare(self):

        Upload._load_local_file(self)
        
        webenv = WebEnv(self.support_vectors, self.modhandler.url)
        
        if self.args['rpath']:
            # Check if remote file is actually in web root
            self.args['rpath'], self.args['url'] = webenv.file_map(self.args['rpath'])
        else:
            
            # Extract filename
            filename = self.args['lpath'].split('/')[-1]
            
            # Check if starting folder is actually in web root
            try:
                absolute_path_folder, url_folder = webenv.folder_map(self.args['startpath'])
            except ProbeException, e:
                # If default research fails, retry from web root base folder
                if self.args['startpath'] != '.':
                    raise
                else:
                    try:
                        absolute_path_folder, url_folder = webenv.folder_map(webenv.base_folder_path)
                    except ProbeException, e2:                
                        raise e
예제 #2
0
    def _prepare(self):

        Upload._load_local_file(self)

        webenv = WebEnv(self.support_vectors, self.modhandler.url)

        if self.args['rpath']:
            # Check if remote file is actually in web root
            self.args['rpath'], self.args['url'] = webenv.file_map(
                self.args['rpath'])
        else:

            # Extract filename
            filename = self.args['lpath'].split('/')[-1]

            # Check if starting folder is actually in web root
            try:
                absolute_path_folder, url_folder = webenv.folder_map(
                    self.args['startpath'])
            except ProbeException, e:
                # If default research fails, retry from web root base folder
                if self.args['startpath'] != '.':
                    raise
                else:
                    try:
                        absolute_path_folder, url_folder = webenv.folder_map(
                            webenv.base_folder_path)
                    except ProbeException, e2:
                        raise e
예제 #3
0
    def _prepare_probe(self):

        Upload._load_local_file(self)
        
        webenv = WebEnv(self.support_vectors, self.modhandler.url)
        
        if self.args['rpath']:
            # Check if remote file is actually in web root
            self.args['rpath'], self.args['url'] = webenv.file_map(self.args['rpath'])
        else:
            
            # Extract filename
            filename = self.args['lpath'].split('/')[-1]
            
            # Check if starting folder is actually in web root
            absolute_path_folder, url_folder = webenv.folder_map(self.args['startpath'])
            
            # Start find in selected folder
            writable_subdirs = self.support_vectors.get('find_writable_dirs').execute({'path' : absolute_path_folder})

            if not writable_subdirs:
                raise ProbeException(self.name, WARN_WRITABLE_DIR_NOT_FOUND)
                
            writable_folder, writable_folder_url = webenv.folder_map(writable_subdirs[0])
            print writable_folder, writable_folder_url, writable_subdirs[0]
                
                
            self.args['rpath'] = os.path.join(writable_folder, filename)
            
            self.args['url'] = os.path.join(writable_folder_url, filename)        
                
        
                
        Upload._check_remote_file(self)                
예제 #4
0
 def _set_vectors(self):
     Upload._set_vectors(self)
     
     self.support_vectors.add_vector('find_writable_dirs', 'find.perms', '-type d -writable $path'.split(' '))
     self.support_vectors.add_vector('document_root', 'system.info', 'document_root' )
     self.support_vectors.add_vector('normalize', 'shell.php', 'print(realpath("$path"));')
     self.support_vectors.add_vector('script_folder', 'shell.php', 'print(dirname(__FILE__));')
예제 #5
0
파일: upload2web.py 프로젝트: Gwill/Weevely
    def _set_vectors(self):
        Upload._set_vectors(self)

        self.support_vectors.add_vector("find_writable_dirs", "find.perms", "-type d -writable $path".split(" "))
        self.support_vectors.add_vector("document_root", "system.info", "document_root")
        self.support_vectors.add_vector("normalize", "shell.php", 'print(realpath("$path"));')
        self.support_vectors.add_vector("script_folder", "shell.php", "print(dirname(__FILE__));")
예제 #6
0
    def _set_vectors(self):
        Upload._set_vectors(self)

        self.support_vectors.add_vector('find_writable_dirs', 'find.perms',
                                        '-type d -writable $path'.split(' '))
        self.support_vectors.add_vector('document_root', 'system.info',
                                        'document_root')
        self.support_vectors.add_vector('normalize', 'shell.php',
                                        'print(realpath("$path"));')
        self.support_vectors.add_vector('script_folder', 'shell.php',
                                        'print(dirname(__FILE__));')
예제 #7
0
    def _stringify_result(self):
        if self._result:
            self._result = [self.args['rpath'], self.args['url']]
        else:
            self._result = ['', '']

        return Upload._stringify_result(self)
예제 #8
0
 def _stringify_result(self):
     if self._result:
         self._result = [ self.args['rpath'], self.args['url'] ]
     else:
         self._result = [ '', '' ]
     
     return Upload._stringify_result(self)
예제 #9
0
 def _output_result(self):
     if self._result:
         self._result = [ self.args['rpath'], self.args['url'] ]
     else:
         self._result = [ '', '' ]
     
     return Upload._output_result(self)
예제 #10
0
파일: upload2web.py 프로젝트: Gwill/Weevely
    def _stringify_result(self):
        if self._result:
            self._result = [self.args["rpath"], self.args["url"]]
        else:
            self._result = ["", ""]

        return Upload._stringify_result(self)
예제 #11
0
                else:
                    try:
                        absolute_path_folder, url_folder = webenv.folder_map(
                            webenv.base_folder_path)
                    except ProbeException, e2:
                        raise e

            # Start find in selected folder
            writable_subdirs = self.support_vectors.get(
                'find_writable_dirs').execute({'path': absolute_path_folder})

            if not writable_subdirs:
                raise ProbeException(self.name, WARN_WRITABLE_DIR_NOT_FOUND)

            writable_folder, writable_folder_url = webenv.folder_map(
                writable_subdirs[0])

            self.args['rpath'] = os.path.join(writable_folder, filename)

            self.args['url'] = os.path.join(writable_folder_url, filename)

        Upload._check_remote_file(self)

    def _stringify_result(self):
        if self._result:
            self._result = [self.args['rpath'], self.args['url']]
        else:
            self._result = ['', '']

        return Upload._stringify_result(self)
예제 #12
0
                else:
                    try:
                        absolute_path_folder, url_folder = webenv.folder_map(webenv.base_folder_path)
                    except ProbeException, e2:                
                        raise e
            
            # Start find in selected folder
            writable_subdirs = self.support_vectors.get('find_writable_dirs').execute({'path' : absolute_path_folder})

            if not writable_subdirs:
                raise ProbeException(self.name, WARN_WRITABLE_DIR_NOT_FOUND)
                
            writable_folder, writable_folder_url = webenv.folder_map(writable_subdirs[0])
            
            self.args['rpath'] = os.path.join(writable_folder, filename)
            
            self.args['url'] = os.path.join(writable_folder_url, filename)        
                
        
                
        Upload._check_remote_file(self)                
        
    
    def _stringify_result(self):
        if self._result:
            self._result = [ self.args['rpath'], self.args['url'] ]
        else:
            self._result = [ '', '' ]
        
        return Upload._stringify_result(self)