Пример #1
0
 def __initRoot(self, do_upd, rev):
     '''
     Root menu init routine.
     '''        
     if do_upd in (None, True) and is_working_copy() and \
         verify_dir_has_perm(W3AF_LOCAL_PATH, os.W_OK, levels=1):
         # Output function
         log = om.out.console
         # Ask user function
         def ask(msg):
             return raw_input(msg + ' [y/N] ').lower() in ('y', 'yes')
         # Show revisions logs function
         def show_log(msg, get_logs):
             if ask(msg):
                 log(get_logs())
         # Instantiate mgr.
         vmgr = VersionMgr(log=log)
         # Set callbacks
         vmgr.callback_onupdate_confirm = ask
         vmgr.callback_onupdate_show_log = show_log
         try:
             vmgr.update(force=do_upd, rev=rev, print_result=True)
         except Exception, e:
             om.out.error('An error occured while updating: %s' % e.args)
         except KeyboardInterrupt:
             pass
Пример #2
0
    def update(self):
        if self._force_upd in (None, True) and is_git_repo() and \
        verify_dir_has_perm(W3AF_LOCAL_PATH, os.W_OK, levels=1):
            try:
                resp = self._call_update()
                self._handle_update_output(resp)
            except KeyboardInterrupt:
                pass
            except Exception, ex:
                self._logger('An error occurred while updating: "%s"' % ex)

            # TODO: Please read https://github.com/andresriancho/w3af/issues/6
            # for more information on what's missing here 
            '''
Пример #3
0
    def _home_directory(self):
        '''
        Handle all the work related to creating/managing the home directory.
        @return: None
        '''
        # Start by trying to create the home directory (linux: /home/user/.w3af/)
        create_home_dir()

        # If this fails, maybe it is because the home directory doesn't exist
        # or simply because it ain't writable|readable by this user
        if not verify_dir_has_perm(HOME_DIR, perm=os.W_OK|os.R_OK, levels=1):
            print('Either the w3af home directory "%s" or its contents are not'
                  ' writable or readable. Please set the correct permissions '
                  'and ownership.' % HOME_DIR)
            sys.exit(-3)
Пример #4
0
 def update(self):
     if self._force_upd in (None, True) and is_working_copy() and \
         verify_dir_has_perm(W3AF_LOCAL_PATH, os.W_OK, levels=1):
         try:
             resp = self._call_update()
             self._handle_update_output(resp)
         except KeyboardInterrupt:
             pass
         except Exception, ex:
             print('An error occurred while updating: %s' % ex.args)
         
         # Try to convert to int => a valid revision number. Otherwise the
         # code is inconsistent => more than one revision is checked out
         try:
             int(get_svnversion())
         except ValueError:
             self._log("Oops!... w3af can't be started. It seems that the "
               "last auto update process was unsuccessful.\n\n"
               "Please update manually by executing a regular 'svn update' "
               "in the w3af installation directory.\n")
             sys.exit(1)