Important! increase this value by 1 everytime a keyword is excluded below



  • You'll probably have heard about the Australian government's dumbass plan to introduce mandatory government-controlled censorship of the internet, by forcing ISPs to install URL filters.  According to a story in today's ElReg, the website of the minister responsible, Stephen Conroy, has a tag cloud reflecting the most popular search terms entered into the site's search facility.  The amusing point of the ElReg story is that they've crudely hacked the code that generates the cloud tag to exclude the term "ISP filtering", which made me lol, but there are a few other WTFs in the code as well:

    [quote user="http://www.minister.dbcde.gov.au/"] 

    <script type="text/javascript">
    // Script Authour: Aleks Bochniak
    // Modified by: Des Ko
    // Modified date: 1/12/2009
    <!--
    var a = 'NBN; Broadband; National Broadband Network; ABC; Broadcasting; National Broadcasters; SBS; Digital Switchover; Broadcasting; Digital Television; Youth Advisory Group; ISP Filtering; Cyber-Safety; Internet; Budget; ISP Filtering; Cyber-Safety; Internet; E-Health; Mobile Services; Digital Economy; Telephone Services; ICT; E-Health; Innovation; Broadband; Cyber-Bullying; ISP Filtering; Cyber-Safety; Emergency Services; Mobile Services; Telephone Services; E-Health; Emergency Services; Digital Regions; NBN; Broadband; National Broadband Network; Internet; Australian Broadband Guarantee; Broadband; Digital Economy; Internet; Post; E-Security; Internet; Digital Switchover; ABC; Digital Television; ISP Filtering; Cyber-Safety; Internet; E-Health; Emergency Services; Digital Regions; NBN; National Broadband Network; Digital Switchover; Digital Television; Mobile Services; Telephone Services; ABC; National Broadcasters; SBS; Emergency Services; Spectrum; Digital Switchover; Digital Television; NBN; National Broadband Network; Telephone Services; Productivity; Innovation; NBN Co; NBN; Broadband; National Broadband Network; Broadband; National Broadband Network; NBN; Broadband; National Broadband Network; Internet; Telephone Services; Mobile Services; Telephone Services; E-Security; ISP Filtering; Cyber-Safety; Internet; ABC; Digital Television; NBN; Broadband; National Broadband Network; Mobile Services; Spectrum; Cyber-Bullying; Youth Advisory Group; Consultative Working Group; ISP Filtering; Cyber-Safety; Digital Switchover; ABC; Broadcasting; Digital Television; Digital Switchover; Digital Television; Innovation; ICT; Community Television; Community Radio; Digital Switchover; NICTA; Do Not Call Register; NBN; Broadband; National Broadband Network; Budget; National Broadcasters; Digital Television; SBS; ABC; Broadcasting; Budget; National Broadcasters; Digital Television; SBS; Innovation; ICT; NICTA; Digital Economy; Budget; Digital Switchover; ABC; Broadcasting; Digital Television; Emergency Services; Do Not Call Register; Budget; Telephone Services; Digital Divide; Community Television; Community Radio; Broadcasting; Budget; Broadcasting; Budget; Digital Television; NBN Co; NBN; Broadband; National Broadband Network; Budget; Smart Grid; Innovation; Broadband; National Broadband Network; Budget; Digital Regions; ABC; NBN; Broadband; National Broadband Network; Budget; NBN; Broadband; National Broadband Network; Mobile Services; Mobile Services; Budget; Telephone Services; Digital Switchover; Broadcasting; National Broadcasters; Digital Television; NBN; Broadband; National Broadband Network; Digital Switchover; Digital Television; E-Security; Internet; Broadband; E-Security; National Broadband Network; Internet; E-Security; Broadband; E-Security; Internet; Broadband; Digital Economy; National Broadband Network; NBN; Broadband; E-Security; Digital Economy; National Broadband Network; Internet; E-Health; Emergency Services; Digital Regions; NBN; Broadband; National Broadband Network; ICT; Mobile Services; Telephone Services; Post; Digital Divide; NBN; Broadband; National Broadband Network; Digital Divide; Digital Literacy; Internet; NBN Co; NBN; National Broadband Network; Cyber-Bullying; CyberSmart; Cybersmart.gov.au; Youth Advisory Group; Consultative Working Group; Cyber-Safety; Productivity; Innovation; NBN; Broadband; Digital Economy; National Broadband Network; NBN Co; NBN; Broadband; National Broadband Network; Internet; Digital Switchover; Anti-Siphoning; Broadcasting; National Broadcasters; Digital Television; Innovation; NBN; Broadband; Digital Economy; National Broadband Network; NBN Co; NBN; Broadband; National Broadband Network; NBN Co; NBN; Broadband; National Broadband Network; NBN Co; NBN; Broadband; National Broadband Network; ICT; Digital Economy; Internet; Emergency Services; Mobile Services; Telephone Services; NBN Co; NBN; National Broadband Network; NBN Co; NBN; National Broadband Network; Digital Switchover; ABC; E-Security; Cyber-Safety; Telephone Services; SBS; NBN Co; NBN; Broadband; National Broadband Network; Australian Broadband Guarantee; Broadband; National Broadband Network; Internet; National Broadband Network; E-Health; Innovation; Emergency Services; Digital Regions; NBN; Broadband; National Broadband Network; NBN Co; NBN; Broadband; National Broadband Network; Post; Digital Switchover; Broadcasting; National Broadcasters; Digital Television; Cyber-Bullying; CyberSmart; Cybersmart.gov.au; Youth Advisory Group; Consultative Working Group; ISP Filtering; Cyber-Safety; E-Health; Innovation; Digital Regions; Broadband; National Broadband Network; NBN Co; NBN; Broadband; National Broadband Network; Internet; Community Radio; Broadcasting; Cyber-Bullying; CyberSmart; Cybersmart.gov.au; Youth Advisory Group; Consultative Working Group; ISP Filtering; Cyber-Safety; Internet; Australian Broadband Guarantee; NBN; National Broadband Network; Telephone Services; Internet; NBN; National Broadband Network; Internet; ABC; Broadband; National Broadband Network; Digital Television; SBS; Digital Switchover; Digital Television; Digital Switchover; Digital Television; E-Health; NBN; Broadband; Digital Economy; National Broadband Network; Internet; Telephone Services; Post; ABC; National Broadcasters; SBS; Smart Grid; Smart Grid; Broadcasting; Community Television; Broadcasting; Spectrum; National Broadcasters; Digital Television; NBN; Broadband; National Broadband Network; NBN; Broadband; SBS; Media; ABC; SBS; Digital Switchover; Digital Television; Digital Switchover; Digital Television; NBN; Cyber-Safety; Media; NBN; ; NBN; National Broadband Network; NBN; ; Australian Broadband Guarantee; Online Content; Cyber-Safety; Post; NBN Co; NBN; Broadband; National Broadband Network; Post; NBN Co; NBN; National Broadband Network; NBN Co; NBN; National Broadband Network; Digital Switchover; ABC; Broadcasting; Digital Television; Digital Divide; Digital Switchover; Broadcasting; Digital Economy; Radio; Spectrum; Digital Television; Digital Regions; Broadband; Digital Economy; National Broadband Network; Digital Switchover; Media; Broadcasting; Digital Television; Digital Switchover; Media; ABC; Broadcasting; Digital Television; Online Content; Cyber-Safety; Internet; ; Cybersmart.gov.au; Digital Economy; Cyber-Safety; Internet; NBN; NBN; National Broadband Network; NBN Co; NBN; Broadband; National Broadband Network; Internet; Digital Switchover; Broadcasting; Digital Television; Community Radio; Broadcasting; Radio; ; Broadband; National Broadband Network; Internet; NBN; Broadband; National Broadband Network; Internet; Innovation; Digital Switchover; NBN Co; NBN; Broadband; Digital Economy; National Broadband Network; Mobile Services; Mobile Services; Mobile Services; Broadband; National Broadband Network; Telephone Services; Internet; NBN; Broadband; National Broadband Network; Mobile Services; Youth Advisory Group; Consultative Working Group; E-Security; ISP Filtering; Cyber-Safety; Internet; Mobile Services; Broadband; Telephone Services; Internet; E-Security; ISP Filtering; Cyber-Safety; Mobile Services; Telephone Services; Mobile Services; E-Security; Cyber-Safety; Telephone Services; Mobile Services; Broadband; Telephone Services; Internet; E-Security; Cyber-Safety; Internet; Australian Broadband Guarantee; NBN; Broadband; National Broadband Network; Internet; NBN; Broadband; National Broadband Network; Internet; Digital Switchover; Broadcasting; Digital Television; Broadband; National Broadband Network; Australian Broadband Guarantee; Broadband; National Broadband Network; Internet; Telephone Services; Digital Switchover; Broadcasting; Digital Television; NBN; Broadband; National Broadband Network; Broadband; National Broadband Network; Australian Broadband Guarantee; Broadband; National Broadband Network; Mobile Services; E-Health; Productivity; Emergency Services; Broadband; Mobile Services; E-Security; Cyber-Safety; Internet; Media; Broadcasting; Mobile Services; Telephone Services; Internet; Mobile Services; Broadband; Telephone Services; Internet; Innovation; Australian Broadband Guarantee; NBN; Broadband; National Broadband Network; Budget; Internet; Youth Advisory Group; Consultative Working Group; Budget; ISP Filtering; Cyber-Safety; Community Radio; Media; Broadcasting; Cyber-Bullying; Consultative Working Group; Cyber-Safety; Australian Broadband Guarantee; Broadband; National Broadband Network; Youth Advisory Group; Consultative Working Group; ISP Filtering; Cyber-Safety; Innovation; Broadband; National Broadband Network; Broadband; National Broadband Network; NBN; Broadband; National Broadband Network; NBN; Broadband; National Broadband Network; Media; Digital Switchover; Digital Television; NBN; Broadband; National Broadband Network; E-Security; Internet; E-Security; Digital Economy; Internet; Innovation; Convergence; E-Security; Digital Economy; Cyber-Safety; Internet; E-Security; Cyber-Safety; Internet; Mobile Services; Broadband; Telephone Services; Internet; NBN; Broadband; National Broadband Network; Broadband; Digital Economy; National Broadband Network; Australian Broadband Guarantee; Broadband; National Broadband Network; Internet; NBN; National Broadband Network; ICT; E-Security; Mobile Services; Telephone Services; Australian Broadband Guarantee; Broadband; National Broadband Network; Online Content; Youth Advisory Group; Mobile Services; ISP Filtering; Cyber-Safety; Internet; Digital Switchover; Digital Television; NBN; National Broadband Network; ISP Filtering; Cyber-Safety; Telephone Services; Internet; National Broadband Network; Mobile Services; Telephone Services; Telephone Services; Emergency Services; Do Not Call Register; Telephone Services; Broadband; National Broadband Network; Australian Broadband Guarantee; Do Not Call Register; NBN; E-Security; National Broadband Network; Internet; Australian Broadband Guarantee; Do Not Call Register; E-Security; National Broadband Network; Media; ABC; Internet; Productivity; Digital Economy; Internet; Innovation; Youth Advisory Group; ISP Filtering; Cyber-Safety; Internet; Digital Television; Digital Switchover; Broadcasting; Digital Television; Community Radio; Broadcasting; Budget; Digital Switchover; Digital Television; Australian Broadband Guarantee; Mobile Services; Broadband; Telephone Services; Internet; Australian Broadband Guarantee; Do Not Call Register; Broadband; E-Security; National Broadband Network; ABC; National Broadcasters; SBS; Digital Switchover; Broadcasting; Digital Television; E-Health; Innovation; Emergency Services; Broadband; Digital Economy; Post; Australian Broadband Guarantee; Do Not Call Register; NBN; Broadband; E-Security; National Broadband Network; Mobile Services; Telephone Services; Digital Economy; Mobile Services; Telephone Services; Telephone Services; NBN; Digital Economy; National Broadband Network; E-Health; Broadband; National Broadband Network; Mobile Services; Telephone Services; Digital Switchover; Broadcasting; Spectrum; Digital Television; Digital Switchover; Spectrum; Digital Television; Youth Advisory Group; Cyber-Safety; Internet; Innovation; Digital Economy; Digital Economy; Australian Broadband Guarantee; Broadband; National Broadband Network; Youth Advisory Group; ISP Filtering; Cyber-Safety; Broadband; Digital Economy; Digital Switchover; ABC; Broadcasting; Digital Television; ICT; Broadband; E-Security; Digital Economy; NBN; Broadband; National Broadband Network; Productivity; Digital Economy; Mobile Services; Telephone Services; E-Security; ISP Filtering; Cyber-Safety; ';
    var split = new Array();
    split = a.split('; '); //string to array
    var unique = unique(split);
    /*unique.sort();*/ //sort alphabetically

    var frequency = new Array();
    var counts = new Array();
    var largest = 0;
    var smallest = 1;

    /* Script creates an array and finds the most used tag */
    for(var i=0; i<unique.length; i++) {
    var mullet=0;
    unique[i] = unique[i].replace(/^\s+|\s+$/g, '') ;
    for(var j=0; j<split.length; j++) {
    if (unique[i]==split[j]) {
    mullet=mullet+1;
    }
    frequency[i] = mullet;
    }
    }

    for(var d=0;d<frequency.length;d++){
    largest=Math.max(largest,frequency[d]); //find largest
    }
    var diff = largest-smallest; //difference, smallest is always 1
    var dist = diff/6; //distribution
    var large = 1 + (dist*2);
    var medium = 1 + dist;

    // write out the tag cloud
    if(unique.length != 0) {
    //document.write('<div id=\"cloud-wrap\">');
    document.write('<div id=\"cloud-wrap\" class=\"divider\">');
    document.write('<p id=\"tag-cloud\">');

    //for(var i=0; i<unique.length; i++)
    for(var i=0; i<=15/*<-Important! increase this value by 1 everytime a keyword is excluded below*/; i++)
    {
    var z=0;
    for(var j=0; j<split.length; j++) {
    if (unique[i]==split[j]) {
    z=z+1;
    }
    counts[i] = z;
    }
    var size = getTagClass(z);
    //Customise the tag-cloud to display what shows up
    if (unique[i] == "ISP Filtering")
    {
    continue;
    }
    document.write('<a class="'+size+'" href=\"http://www.minister.dbcde.gov.au/search?q='+unique[i]+'">'+unique[i]+'</a> ');
    }
    document.write('</p>');
    document.write('</div>');
    }
    //-->

    </script>

    [/quote]

    So, they forgot to increase the value of the integer constant 15 by one every time a tag is excluded, meaning that you can tell that tags have been excluded because there will be less than 16 items in the tag cloud.  (They also apparently forgot that you can't change the value of a constant, and trying to decrement i might have worked better than trying to increment '15'!)

    I also notice that they recount the frequency of all the items in the entire tag cloud array every time round the loop, just in case it has magically changed since last time.  That's after they've already repeatedly iterated across the entire array of terms once for each unique term.  Quadratic algorithms must flow through this guy's blood.

    On the other hand, it does have a variable called 'mullet', which I found stunning...



  • And this gem in the <noscript> tag beneath the posted script:

    <a href="http://www.minister.dbcde.gov.au/search?q=Youth20Group">Youth Advisory Group</a>

    Evidently they aren't urlencoding values returned from a DB, but rather just manually embedding links... and failing at that too. I'm guessing they aren't using any server-side code on that page, because that's the first tag cloud I've seen generated with JS.

    But I have to give credit for the use of "mullet" as a variable name.



  • @DaveK said:

     

    On the other hand, it does have a variable called 'mullet', which I found stunning...

    Obviously, they were talking about this kind of mullet, so it makes perfect sense.


  • @DaveK said:

    mandatory government-controlled censorship of the internet
    It still boggles the mind how this is possible in a developed, democratic country.



  • Since the exclusion is a crude hack that only excludes the one specific phrase "ISP Filtering", surely it must be possible to come up with a whole host of creatively indecent search strings that reach that guy's site and can be Googlebombed into the tag cloud.

     



  • @dtobias said:

    Since the exclusion is a crude hack that only excludes the one specific phrase "ISP Filtering", surely it must be possible to come up with a whole host of creatively indecent search strings that reach that guy's site and can be Googlebombed into the tag cloud.

    I thought those were search strings used on the site's own search feature, rather than the searches that led to the site, but maybe you're right, in which case we just need to creatively falsify our Referer: headers to look like google search results urls.

    However isn't TRWTF that this array is not automatically generated and inserted into the page but manually updated from time to time anyway, and they could have just not included all those "isp filtering" strings in the first place?




  • @DOA said:

    @DaveK said:

    mandatory government-controlled censorship of the internet
    It still boggles the mind how this is possible in a developed, democratic country.

     

     You aren't thinking of the children nearly hard enough. Report for re-education immediately.



  • @DaveK said:

    However isn't TRWTF that this array is not automatically generated and inserted into the page but manually updated from time to time anyway, and they could have just not included all those "isp filtering" strings in the first place?

     

     

    agreed


  • Silly Australians.
    Hmm, I wonder what horrors lurk in the code behind the idiotic New South Wales Driver Qualification Test I had to take this morning...



  • @Tyler said:

    You aren't thinking of the children nearly hard enough.

    I'd say he's thinking of the children plenty hard.  Why do you think they're trying to filter his Internet?


  • Discourse touched me in a no-no place

    @DaveK said:

    <script type>="text/javascript">
    // Script Authour: Aleks Bochniak
    // Modified by: Des Ko
    // Modified date: 1/12/2009

    Mr Bochniak is reported as saying: "No, I didn’t write it for their website. They must have taken a version of my ‘tag cloud’ Javascript off one of my website tutorials. Their code is basically a modified version of mine."

    However, at least last week, techies could, if they so wished, have discovered the identity of the person whose code was "borrowed" by government. Not any more, however, as not only has Mr B’s name been removed – but also the name of the person who amended it, allegedly "at the request of family members".

    Curiouser and curiouser.
    Idiots, the lot of them.


  • @Eternal Density said:

    Silly Australians. Hmm, I wonder what horrors lurk in the code behind the idiotic New South Wales Driver Qualification Test I had to take this morning...
     

    Back in my day it was done on paper. Probably composed in Ami Pro. (My mother worked for the QLD equivalent of the RTA/DMV/etc)



  • @DaveK said:

    On the other hand, it does have a variable called 'mullet', which I found stunning...
    And on the OTHER other hand... having a variable called "mullet", and it being an incremented counter, and NOT SEIZING THE OPPORTUNITY to have a "mullet++;" line... is SO disappointing. I'm disappointed.

    Anyway, TRWTF is "document.write"... ^^



  • @DaveK said:

    var a = 'NBN; Broadband; National Broadband Network; ABC; Broadcasting; National Broadcasters; SBS; Digital Switchover; Broadcasting; Digital Television; Youth Advisory Group; ISP Filtering; Cyber-Safety; Internet; Budget; ...etc. ';
    var split = new Array();
    split = a.split('; '); //string to array

    Really? Creating a semicolon-delimited list and then splitting it on semicolons? I guess someone copy-pasted the list (or it was populated from a database), but really, how hard is it to write a little function to render it as a Javascript array right out? Also, why initialize var split to a new Array(); when you're just going to be re-assigning it on the next line?



  • Also, is it just me, or does it seem like a LOT of duplicate entries in that huge list? An inept SELECT, perhaps?


Log in to reply