是否有可能覆盖/阻止Javascript代码,以避免每小时超过一次点击

Is it possible to overwrite / block a Javascript code that avoids more than one click per hour?

本文关键字:一次 每小时 阻止 覆盖 有可能 Javascript 代码 是否      更新时间:2023-09-26

我在我的国家发现了一个投票比赛,在意识到有人在上面得到了很多投票(比如4天6千张)之后,我一直在努力满足我对它的好奇心,而没有找到一个合适的答案。

这是一个没有验证码的投票比赛,你只需要点击一个"投票"按钮。但它确实有一些JS代码来避免每小时来自同一台计算机的不止一次投票(IP + cookie,据我所见),我认为有些人设法避免了,并使用JSON回调来构建一个随机确认链接,有些人也可能设法构建(这将允许更快的投票):

http://ws.discoverybrasil.com/curiosity/concurso/altaVoto.php?jsoncallback=jQuery164036090815054306025_1321401398889&video=1327&tema=3&region=2&_=1321401584457

这是投票过程中涉及的完整JS:

<script>
var TEMA_ELEGIDO = 0;
var DATOS = {};
$(document).ready(function(){
TEMA_ELEGIDO = getQueryVariable('tema','');
mostrar_tema();
detallar_video();
if(typeof(FB)!='undefined') FB.XFBML.parse(); // lanzo el FB JS SDK (viene en los includes de Discovery).
});
function mostrar_tema(){
$.getJSON(APPSERVER+'/listarTemas.php?jsoncallback=?', function(response){
    if(!response){ alert('Erro no envio de dados. Tente novamente, por favor.'); return };
    if(response.resultado != 1){ alert(response.errormsg); return };
    for(var i in response.lista){
        if(response.lista[i].id == TEMA_ELEGIDO){
            $('#curiosity_tema').html(response.lista[i].titulo);
            TEMA_ELEGIDO = response.lista[i].id;
        }
    }
});
}
function detallar_video(){
var id = getQueryVariable('id');
if(id=='') return;
$.getJSON(APPSERVER+'/detalleContenido.php?jsoncallback=?',{
    'id': id
}, function(response){
    if(!response){ alert('Erro no envio de dados. Tente novamente, por favor.'); return };
    if(response.resultado != 1){
        alert('Error: '+ response.errormsg);
        return;
    }
    DATOS = response;
    $('#curiosity_usuario').html( (response.nombre+' '+response.apellido).replace('<','') );
    $('#curiosity_locacion').html( (response.ciudad+', '+response.pais).replace('<','') );
    /^http':'/'/www.youtube.com'/.*['?&]+v[='/]?(['w'd-_]{11})[^&#]*/.test(response.video_link);
    if(RegExp.$1 == '') /^http':'/'/youtu.be'/(['w'd-_]{11})/.test(response.video_link);
    var embed = '<object width="854" height="510"><param name="movie" value="http://www.youtube.com/v/'+ (RegExp.$1).replace('<','') +'?version=3&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+ (RegExp.$1).replace('<','') +'?version=3&rel=0" type="application/x-shockwave-flash" width="854" height="510" allowscriptaccess="always" allowfullscreen="true"></embed></object>';
    $('#curiosity_video').html(embed);
    $('#curiosity_votos').html(response.votos +' votos');
    if(!puede_votar(response.id)) inhabilitar_voto();
});
}
function inhabilitar_voto(){
$('#curiosity a.votar').css({opacity:0.3, cursor:'default'}).html('Votado');
}
function votar(){
if(!puede_votar(DATOS.id)){
    alert('Você só pode votar 1 vez por hora para cada vídeo.');
    return false;
}
$.getJSON(APPSERVER+'/altaVoto.php?jsoncallback=?',{
    'video': DATOS.id,
    'tema': TEMA_ELEGIDO,
    'region': REGION,
}, function(response){
    if(!response){ alert('Erro no envio de dados. Tente novamente, por favor.'); return };
    if(response.resultado != 1){
        if(response.resultado == 2){
            alert('Você só pode votar 1 vez por hora para cada vídeo.');
        }else{
            alert('Error: '+ response.errormsg);
        }
        $('#curiosity a.votar').animate({opacity:1});
        return;
    }
    recordar_voto(DATOS.id);
    inhabilitar_voto();
    $('#curiosity_votos').html( (parseInt(DATOS.votos,10)+1) +' votos' );
});
}
function puede_votar(video_id){
var puede = true;
var ahora = (new Date()).getTime();
var votos = (getCookie('votos')).split('&');
if(votos.length > 0){
    for(var i in votos){
        var pair = votos[i].split('=');
        if(pair.length != 2) continue;
        if(pair[0] != video_id) continue;
        if(parseInt(pair[1]) <= 0) continue;
        if( (1000*pair[1])+3600000 > ahora ){ puede = false; break; }
    }
}
return puede;
}
function recordar_voto(video_id){
var ahora = (new Date()).getTime() / 1000;
var existente = false;
var votos = (getCookie('votos')).split('&');
if(votos.length > 0){
    for(var i in votos){
        var pair = votos[i].split('=');
        if(pair.length != 2) continue;
        if(pair[0] != video_id) continue;
        existente = true;
        votos[i] = video_id+'='+ahora;
    }
}
if(!existente) votos.push(video_id+'='+ahora);
setCookie('votos', votos.join('&'), 365);
}
function ver_mas(){
location.href='galeria.shtml?tema='+TEMA_ELEGIDO;   
}
</script>

所以,我的问题是:我疯了吗?或者有可能阻止避免每台计算机每小时一次以上投票的代码,或者像网站直接投票使用的那样进行随机JSON回调(使用Greasemonkey或使用Fiddler构建随机请求,也许?)?还是我错过了什么?

我甚至没有参加比赛,现在已经结束了,但是如此高的投票数量真的让我很好奇-我真的怀疑他们每小时有200或300个有效和快速的代理使用自动化工具(如iMacros)投票。

非常感谢!

我看了一下代码,基本上有两个障碍可以防止重复投票:

  1. 有一个叫做puede_votar()的函数,它显然需要一个视频id并返回true,如果你在过去的60分钟内没有投票给那个特定的视频或false否则。这是依赖于cookie,所以它可以很容易地通过清除您的cookie来击败。

  2. 如果你能通过,它发送一个请求到APPSERVER + '/altaVoto.php与您想要投票的视频id。这将返回一个响应代码,可能是一个失败。其中一个失败是代码2,它让你知道你在一小时内试图投票不止一次。

    这当然取决于你的IP地址。因为这些都是在服务器端验证的,所以你唯一的选择就是获得一个新的IP。所以是的,我相信不管是谁干的他都有很多时间和很多代理人。他们可能用的是Tor之类的东西。

concerning (response.)Resultado == 2),我打赌服务器检查1小时限制,并失败,因为它使用浏览器发送的cookie信息…