PageRenderTime 87ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Malformity/transforms/vt_hash2filenames.py

https://bitbucket.org/Vnoxygen/malformity
Python | 43 lines | 35 code | 7 blank | 1 comment | 2 complexity | cb8ae32817473021526ddf285545057b MD5 | raw file
  1. #!/usr/bin/env python
  2. import re
  3. from BeautifulSoup import BeautifulSoup
  4. from canari.maltego.utils import debug, progress
  5. from canari.framework import configure
  6. from canari.maltego.message import MaltegoException
  7. from common.entities import Hash, Filename
  8. from common.vt import build
  9. __author__ = 'Keith Gilbert - @digital4rensics'
  10. __copyright__ = 'Copyright 2013, Malformity Project'
  11. __credits__ = []
  12. __license__ = 'GPL'
  13. __version__ = '0.1'
  14. __maintainer__ = 'Keith Gilbert - @digital4rensics'
  15. __email__ = 'Keith@digital4rensics.com'
  16. __status__ = 'Development'
  17. __all__ = [
  18. 'dotransform',
  19. ]
  20. @configure(
  21. label='Hash to Filenames - VirusTotal',
  22. description='Returns submitted filenames for a hash from a VirusTotal report',
  23. uuids=[ 'malformity.v1.VT_Hash2Filenames' ],
  24. inputs=[ ( 'VirusTotal', Hash ) ],
  25. debug=True
  26. )
  27. def dotransform(request, response):
  28. page = build(request.value)
  29. try:
  30. results = page.find(text=re.compile('File names ')).findNext('ol').findAll('li')
  31. for entry in results:
  32. text = entry.text
  33. response += Filename(text)
  34. except:
  35. raise MaltegoException('Could not find Filenames')
  36. return response