Jump to content
Nytro

milw0rm Javascript Content Parser v3.0

Recommended Posts

Changes:

*AJAX rendering techniques

*Browser compliance! designed for Internet Explorer 6 & 7, Firefox, Opera, Seamonkey, Safari

*The code is smaller, I made it too big of useless stuffs in 2.0

*The javascript does no more act on the page loading time if the source feed is offline or timeout, simply choose when it will load the remote feed by adding update_ModuleX(); anywhere on your page, preferably in the footer.

*PHP proxy (this is optional, see post #2 in this thread)

What is it:

This is a simple javascript code wich you can copy and paste on your website to stay informed about the various public exploits, I have started building it 2 years ago from a basic code made by sophos, then with str0ke's cooperation I have got the idea to port it for milw0rm, rewriting it with AJAX styles, and that's what it is now. I think I won't update it much because it is now perfectly running, maybe a few minor updates to enhance the browsers compatibilities.

How to use it:

The code below is the sample code for the remote exploits section in milw0rm, if you would like to display other sections like dos, local, webapps, just change the configuration settings in the header of the code and replace all occurences of milalerts1 to the milalerts# defined for each sections, you should know that they are defined like this on milw0rm.com:

remote exploits = milalerts1

local exploits = milalerts2

webapps exploits = milalerts3

dos exploits = milalerts4

You must have only 10 occurences to change, with a quick editor that's fast to achieve.

//update:

I have forgot to mention, if you would like to display several milw0rm modules on a same web page, you must think to rename all occurences of _Module1 to _Module# where # is a unique number from 2 to 4 for example, this will work around some functions that could be mixed between each modules.

Code:

PHP Code:

<script type="text/javascript"> 

// Layout settings
var feed_Module1 = 'http://milw0rm.com/js/3.0/remote.php' // news url
var table_border_Module1 = '0' // table border size (default:0)
var table_width_Module1 = '175' // table width, in % or px (default:100%)
var table_cspacing_Module1 = '1' // table cellspacing (default:1)
var table_cpadding_Module1 = '0' // table cellpadding (default:0)
var table_bgcolour_Module1 = '#000000' // table background colour (default:#000000)
var table_bdcolour_Module1 = '#000000' // table border colour (default:#000000)
var table_bgpic_Module1 = '' // table background picture (default:none)
var table_align_Module1 = 'left' // table horizontal alignement, LEFT | RIGHT (default:left)
var table_hspace_Module1 = '0' // table horizontal space (default:0)
var table_vspace_Module1 = '0' // table vertical space (default:0)
var table_height_Module1 = '0' // table height (default:0)
var header_align_Module1 = 'left' // header horizontal alignement, LEFT | CENTER | MIDDLE | RIGHT (default:left)
var header_valign_Module1 = '' // header vertical alignement, TOP | MIDDLE | CENTER | BOTTOM | BASELINE (default:none)
var header_height_Module1 = '0' // header height (default:0)
var header_bgcolour_Module1 = '#000000' // header background colour (default:#000000)
var header_tcolour_Module1 = '#FFFFFF' // header text colour (default:#FFFFFF)
var header_ttheme_Module1 = '' // header text theme (default:Eras Medium ITC)
var header_tsize_Module1 = '1' // header text size (default:0)
var header_title1_Module1 = 'remote exploits' // header plural title
var header_title2_Module1 = 'remote exploit' // header singular title
var column1_align_Module1 = 'center' // column1 alignement, LEFT | CENTER | MIDDLE | RIGHT (default:center)
var column1_valign_Module1 = '' // column1 vertical alignement, TOP | MIDDLE | CENTER | BOTTOM | BASELINE (default:none)
var column1_height_Module1 = '0' // column1 height (default:0)
var column1_bgcolour_Module1 = '#918484' // column1 background colour (default:#918484)
var column1_tcolour_Module1 = '#000000' // column1 text colour (default:#000000)
var column1_ttheme_Module1 = '' // column1 text theme (default:Arial Narrow)
var column1_tsize_Module1 = '1' // column1 text size (default:0)
var column2_width_Module1 = '' // column2 width, in % or px (default:90%)
var column2_align_Module1 = 'left' // column2 horizontal alignement, LEFT | CENTER | MIDDLE | RIGHT (default:left)
var column2_valign_Module1 = '' // column2 vertical alignement, TOP | MIDDLE | CENTER | BOTTOM | BASELINE (default:none)
var column2_height_Module1 = '0' // column2 height (default:0)
var column2_bgcolour_Module1 = '#004000' // column2 background colour (default:#004000)
var column2_tcolour_Module1 = '#00C000' // column2 text colour (default:#00C000)
var column2_hcolour_Module1 = '#D6EF39' // column2 highlight color, to highlight newly added milw0rm exploits (default:#D6EF39)
var column2_ttheme_Module1 = '' // column2 header text theme (default:Arial Narrow)
var column2_tsize_Module1 = '1' // column2 text size (default:0)

// Functional settings
var count_column_Module1 = '2' // column count, 1 or 2 (default:2)
var count_Module1 = 10 // news count, 1 to 10 (default:10)
var adjust_length_Module1 = 'no' // news length correction 'yes' or 'no' (default:yes)
var adjust_var_Module1 = 55 // maximum characters count after what the correction is made (default:75)

// **********************no modifications required after*******************************
var b_Module1 = '..';
var htmltxt_Module1 = "";
var base_colour_Module1 = column2_tcolour_Module1;
var font_header_Module1 = '+ header_tsize_Module1 + '" face="' + header_ttheme_Module1 + '" color="' + header_tcolour_Module1 + '">';
var font_column1_Module1 = '+ column1_tsize_Module1 + '" face="' + column1_ttheme_Module1 + '" color="' + column1_tcolour_Module1 + '">';
var font_column2_Module1 = '+ column2_tsize_Module1 + '" face="' + column2_ttheme_Module1 + '" color="' + column2_tcolour_Module1 + '">';
var milalerts1;

function wait_Module1(millis_Module1)
{
var date_Module1 = new Date();
var curDate_Module1 = null;
do { curDate_Module1 = new Date(); }
while(curDate_Module1-date_Module1 < millis_Module1);
}

function error_Module1()
{
for (var lid_Module1=1,i_Module1=0;i_Module1<10;i_Module1++,lid_Module1++)
{
document.getElementById('link_Module1'+ lid_Module1).innerHTML= font_column2_Module1 + 'Timeout, refresh';
}
return;
}

function refresh_Module1()
{
for (var lid_Module1=1,i_Module1=0;i_Module1<40;i_Module1+=4,lid_Module1++)
{
document.getElementById('link_Module1'+ lid_Module1).innerHTML= font_column2_Module1 + 'Refreshing...';
}
update_Module1();
return;
}

function update_Module1()
{
wait_Module1(0);
scriptTag_Module1 = document.getElementById('Script_Module1');
headID_Module1 = document.getElementsByTagName("head")[0];
if(scriptTag_Module1) {headID_Module1.removeChild(document.getElementById('Script_Module1'));}
newScript_Module1 = document.createElement('script');
newScript_Module1.type = 'text/javascript';
newScript_Module1.src = feed_Module1 + "?" + Math.random(); //IE7 refresh patch to avoid caching
newScript_Module1.id = 'Script_Module1';
newScript_Module1.defer = false;
headID_Module1.appendChild(newScript_Module1);
newScript_Module1.onreadystatechange=function() {
if(newScript_Module1.readyState=="loaded"){
scriptLoaded_Module1();
return;
}
}
newScript_Module1.onload=function() {
scriptLoaded_Module1();
return;
}
if(newScript_Module1.readyState=="loaded") { //Opera patch
scriptLoaded_Module1();
return;
}
return;
}

function scriptLoaded_Module1()
{
wait_Module1(100);
if (milalerts1==null) {
error_Module1();
return;
}
for (var lid_Module1=1,i_Module1=0;i_Module1<40;i_Module1+=4,lid_Module1++)
{
if (milalerts1[i_Module1+3]=='1'){ column2_tcolour_Module1 = column2_hcolour_Module1;font_column2_Module1 = '+ column2_tsize_Module1 + '" face="' + column2_ttheme_Module1 + '" color="' + column2_tcolour_Module1 + '">'; }
if (adjust_length_Module1 == "yes")
{
var a_Module1 = milalerts1[i_Module1+1];
if (a_Module1.length > adjust_var_Module1)
document.getElementById('link_Module1'+ lid_Module1).innerHTML='+ milalerts1[i_Module1+2] + '" target="_blank" style="text-decoration: none">' + font_column2_Module1 + a_Module1.substr(0,adjust_var_Module1) + b_Module1 + '';
else
document.getElementById('link_Module1'+ lid_Module1).innerHTML='+ milalerts1[i_Module1+2] + '" target="_blank" style="text-decoration: none">' + font_column2_Module1 + milalerts1[i_Module1+1] + '';
}
else
document.getElementById('link_Module1'+ lid_Module1).innerHTML='+ milalerts1[i_Module1+2] + '" target="_blank" style="text-decoration: none">' + font_column2_Module1 + milalerts1[i_Module1+1] + '';

if (count_column_Module1 != "1")
{
document.getElementById('date_Module1'+ lid_Module1).innerHTML='' + font_column1_Module1 + milalerts1[i_Module1+0] + '';
}
column2_tcolour_Module1 = base_colour_Module1;
font_column2_Module1 = '+ column2_tsize_Module1 + '" face="' + column2_ttheme_Module1 + '" color="' + column2_tcolour_Module1 + '">';
}
lid_Module1=1;
i_Module1=0;
return;
}

if (count_column_Module1 == "1") { colspan_Module1 = 1; }
else { colspan_Module1 = 2; }

if (count_Module1 > 0)
{
if (count_Module1 > 10) {count_Module1 = 10}

htmltxt_Module1 +=
'\n+ table_align_Module1 +
'" width="' + table_width_Module1 +
'" cellspacing="' + table_cspacing_Module1 +
'" cellpadding="' + table_cpadding_Module1 +
'" border="' + table_border_Module1 +
'" bordercolor="' + table_bdcolour_Module1 +
'" bgcolor="' + table_bgcolour_Module1 +
'" background="' + table_bgpic_Module1 +
'" hspace="' + table_hspace_Module1 +
'" vspace="' + table_vspace_Module1 +
'" height="' + table_height_Module1 +
'">';

htmltxt_Module1 +=
'\n";
}
else
{
htmltxt_Module1 +=
'Latest ' + count_Module1 + ' ' + header_title1_Module1 +
"from milw0rm";
}

for (var i_Module1=0, lid_Module1=1; i_Module1<count_Module1*4; i_Module1+=4, lid_Module1++)
{
if (count_column_Module1 == "1")
{
htmltxt_Module1 +=
'\n';
column1_tcolour_Module1 = base_colour_Module1;
font_column1_Module1 = '+ column1_tsize_Module1 + '" face="' + column1_ttheme_Module1 + '" color="' + column1_tcolour_Module1 + '">';
}
else
{
htmltxt_Module1 +=
'\n';
column2_tcolour_Module1 = base_colour_Module1;
font_column2_Module1 = '+ column2_tsize_Module1 + '" face="' + column2_ttheme_Module1 + '" color="' + column2_tcolour_Module1 + '">';
}
}
}
else
{
document.write("=== MILW0RM info feed error: Specify value of count > 0 ===");
}

htmltxt_Module1 += '\n
+ header_align_Module1 +
'" valign="' + header_valign_Module1 +
'" height="' + header_height_Module1 +
'" colspan="' + colspan_Module1 +
'" bgcolor="' + header_bgcolour_Module1 +
'">' + font_header_Module1 +
'' + font_header_Module1 +
'|about' + font_header_Module1 +
'refresh';

if (count_Module1 == 1)
{
htmltxt_Module1 +=
'Latest ' + header_title2_Module1 +
"from milw0rm
+ column2_align_Module1 +
'" valign="' + column2_valign_Module1 +
'" height="' + column2_height_Module1 +
'" bgcolor="' + column2_bgcolour_Module1 +
'">
+ lid_Module1 +
'">' + font_column2_Module1 +
'Updating...
+ column1_align_Module1 +
'" valign="' + column1_valign_Module1 +
'" height="' + column1_height_Module1 +
'" bgcolor="' + column1_bgcolour_Module1 +
'">' + font_column1_Module1 +
'
+lid_Module1+'">' + lid_Module1 +
'
+ column2_align_Module1 +
'" valign="' + column2_valign_Module1 +
'" height="' + column2_height_Module1 +
'" width="' + column2_width_Module1 +
'" bgcolor="' + column2_bgcolour_Module1 +
'">
+ lid_Module1 +
'">' + font_column2_Module1 +
'Updating...
';

document.write(htmltxt_Module1);
update_Module1();

by matthews

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...