__restricted_builtin__.py 676 B

12345678910111213141516171819
  1. ################################################################################
  2. #
  3. # __restricted_builtin__.py
  4. #
  5. # This module is designed to replace the __builtin__, but overwrite many of the
  6. # functions that would allow an unscrupulous scripter to take malicious actions
  7. #
  8. ################################################################################
  9. from __builtin__ import *
  10. from __restricted_builtin_funcs__ import r_import, r_open, r_execfile, r_eval, \
  11. r_reload, r_exec, r_unload
  12. # override some dangerous functions with their safer versions
  13. __import__ = r_import
  14. execfile = r_execfile
  15. open = r_open
  16. eval = r_eval
  17. reload = r_reload