Low Caliber Club
Low Caliber Club
    Low Caliber Forum  Hop To Forum Categories  Gaming General    A request
Page 1 2 

Moderators: Manowar, Midknight
Go
New
Find
Notify
Tools
Reply
  
A request
 Login/Join
 
Peregrine
posted Hide Post
Below is an ip parser for Lars joinlogger mutator. What it does is: updates ip.log with new entries only, sorts them ascending IP order. Prints a iplist.html which shows all the IPs and all the names used with an IP. The select is a bit stupid chise preventing search by names but... If you send me a log file you have (joinlogger and chatlogger of Lars installed) I can tailor a script for you

#!/usr/bin/perl

# store Rune.log to @ary
open(INF,"Rune.log") or print "Can't open Rune.log: $!";
@ary = <INF>;
close(INF);
$padding="\nend of file\n";
push (@ary, $padding);

@iplines=();

foreach $line (@ary) {
if ($line =~ /^ScriptLog:\s\[RUNEPLAYER_JOIN\]/i) {
push (@iplines, $line);
}
}

# open the already stored IPs to @ips
open(INF2,"ip.log") or print "Can't open ip.log - maybe not created yet: $!";
@ips = <INF2>;
close(INF2);

# make the new IPs to same format as the already existing ones
foreach $line (@iplines) {
chomp($line);
($d1,$d2,$name,$ip,$d3,$d4,$time,$date)=split /\s+/, $line;
$_=$ip;
s/IP=//;
$ip=$_;
@tmp=split /\./, $ip;
foreach $_ (@tmp) {
if (/(.{3})/) {
;
} elsif (/(.{2})/) {
$_=join '', '0',$_;
} else {
$_=join '', '00',$_;
}
push (@tmp2, $_);
}
$temp=join '', @tmp2;
$line=join ' ', $temp,$name,$ip;
push (@ips, $line);
@tmp2=();
}

#add new IPs to new array with old ones
foreach $chmp (@ips) {
chomp($chmp);
}

#sort by IP number
@sorted = sort @ips;

#delete exactly same lines
for ($x=0; $x <= $#sorted-1; $x++) {
if ($sorted[$x] ne $sorted[$x+1]) {
push (@matched, $sorted[$x]);
}
}
push (@matched, $sorted[$#sorted]);

#open ip.log to writing
open(OUTF,">ip.log") or print "Can't open ip.log for writing: $!";

# and lets print the lines to ip.log
foreach $line2 (@matched) {
chomp($line2);
print OUTF "$line2\n";
}

close(OUTF);

for ($x=0; $x <= $#matched-1; $x++) {

if ($matched[$x] == $matched[$x+1]) {
@arg2=split /\s+/, $matched[$x+1];
$matched[$x+1]=join ' ', $matched[$x], $arg2[1];
} else {
push (@another, $matched[$x]);
}
}
push (@another, $matched[$#matched]);

# rest is just for HTML format
open(OUTF2,">iplist.html") or print "Can't
open iplist2.html for writing: $!";

print OUTF2 <<SHTML;

<html><head><title>IP list</title>
</head>
<body>
<table border=1 cellpadding=1>

SHTML

$count=0;
foreach $line3 (@another) {
$count++;
chomp($line3);
@htmlformat=split /\s+/, $line3;
$bla1=shift (@htmlformat);
$yname=shift (@htmlformat);
$yip=shift (@htmlformat);
push (@htmlformat, $yname);
print OUTF2 "<tr><td align=center>- $count -</td><td>$yip</td><td>";
if (scalar(@htmlformat) > 1) {
print OUTF2 "<SELECT NAME=\"names\">";
foreach $line4 (@htmlformat) {
print OUTF2 "<OPTION>$line4\n";
}
print OUTF2 "</SELECT>\n</td></tr>"
} else {
print OUTF2 "$htmlformat[0]</td></tr>";
}
}

print OUTF2 <<EHTML;
</table></body></html>
EHTML

close(OUTF2);
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
Peregrine
posted Hide Post
Oh, its supposed to be server.log, not rune.log...
 
Posts: 83 | Registered: Sun June 22 2003Reply With QuoteReport This Post
  Powered by Social Strata Page 1 2  
 

    Low Caliber Forum  Hop To Forum Categories  Gaming General    A request

© Low Caliber Club 2002-4
Gallery | Chat | Archive | Tutorials | Red Carpet

Constitution

Members

Forum

Stats

Wiki