How to use the thug.DOM.DFT.DFT function in thug

To help you get started, we’ve selected a few thug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github buffer / thug / thug / DOM / DFT.py View on Github external
opts = ["text/plain", "charset=US-ASCII"]

        mimetype = opts[0]

        handler = log.MIMEHandler.get_handler(mimetype)
        if handler:
            handler(self.window.url, data)
            return None

        if mimetype.startswith(('text/html', )):
            from .Window import Window

            doc    = w3c.parseString(data)
            window = Window(self.window.url, doc, personality = log.ThugOpts.useragent)

            dft = DFT(window)
            dft.run()

        return data
github buffer / thug / thug / DOM / Location.py View on Github external
for p in log.ThugOpts.Personality:
            if log.ThugOpts.Personality[p]['userAgent'] == self._window._navigator.userAgent:
                break

        url = log.HTTPSession.normalize_url(self._window, url)
        log.ThugLogging.log_href_redirect(referer, url)

        doc    = w3c.parseString('')
        window = Window(referer, doc, personality = p)  # pylint:disable=undefined-loop-variable
        window = window.open(url)
        if not window:
            return

        # self._window.url = url
        dft = DFT(window)
        dft.run()
github buffer / thug / thug / DOM / W3C / Core / Element.py View on Github external
if response is None or not response.ok:
                return

            ctype = response.headers.get('content-type', None)
            if ctype is None: # pragma: no cover
                return

            handler = log.MIMEHandler.get_handler(ctype)
            if handler:
                handler(self.doc.window.url, response.content)
                return

            if ctype.startswith(('text/html', )):
                doc = w3c.parseString(response.content)
                window = Window(response.url, doc, personality = log.ThugOpts.useragent)
                dft = DFT(window)
                dft.run()
github buffer / thug / thug / DOM / DFT.py View on Github external
return

        content_type = response.headers.get('content-type' , None)
        if content_type:
            handler = log.MIMEHandler.get_handler(content_type)
            if handler:
                handler(self.window.url, response.content)
                return

            if content_type.startswith(('text/html', )):
                from .Window import Window

                doc    = w3c.parseString(response.content)
                window = Window(self.window.url, doc, personality = log.ThugOpts.useragent)

                dft = DFT(window)
                dft.run()
                return

        self.anchors.append(anchor)
github buffer / thug / thug / DOM / DFT.py View on Github external
return

        if response is None or not response.ok: # pragma: no cover
            return

        if getattr(response, 'thug_mimehandler_hit', False): # pragma: no cover
            return

        doc    = w3c.parseString(response.content)
        window = Window(response.url, doc, personality = log.ThugOpts.useragent)

        frame_id = frame.get('id', None)
        if frame_id:
            log.ThugLogging.windows[frame_id] = window

        dft = DFT(window)
        dft.run()
github buffer / thug / thug / Debugger / Shellcode.py View on Github external
try:
                response = self.window._navigator.fetch(url, redirect_type = "URL found")
                log.ThugLogging.shellcode_urls.add(url)
            except Exception:
                return

            if response is None:
                return

            if not response.ok:
                return

            doc    = w3c.parseString(response.content)
            window = Window(url, doc, personality = log.ThugOpts.useragent)

            dft = DFT(window)
            dft.run()
github buffer / thug / thug / DOM / DFT.py View on Github external
def follow_href(self, href):
        from .Window import Window

        doc    = w3c.parseString('')
        window = Window(self.window.url, doc, personality = log.ThugOpts.useragent)
        window = window.open(href)

        if window:
            dft = DFT(window)
            dft.run()
github buffer / thug / thug / DOM / DFT.py View on Github external
def _init_pyhooks(self):
        hooks = log.PyHooks.get('DFT', None)
        if hooks is None:
            return

        for label, hook in hooks.items():
            name   = "{}_hook".format(label)
            _hook = six.get_method_function(hook) if six.get_method_self(hook) else hook
            method = six.create_bound_method(_hook, DFT)
            setattr(self, name, method)
github SpamScope / spamscope / src / modules / attachments / thug_analysis.py View on Github external
def _ThugAPI__run(self, window):
        if log.Trace:
            sys.settrace(log.Trace)

        with PyV8.JSLocker():
            with CustomWatchdog(log.ThugOpts.timeout,
                                callback=self.watchdog_cb):
                dft = DFT(window)
                dft.run()
github buffer / thug / thug / ThugAPI / ThugAPI.py View on Github external
def __run(self, window):
        if log.Trace: # pragma: no cover
            sys.settrace(log.Trace)

        with log.JSEngine.JSLocker:
            with Watchdog(log.ThugOpts.timeout, callback = self.watchdog_cb):
                dft = DFT(window)
                dft.run()