![]() | วิเคราะห์ Radius ด้วย Pascal | ![]() |
| Radius คืออะไร |
root 195 193 0 Oct 27 ? 0:02 /usr/local/etc/radius/bin/radiusd www 5877 199 0 14:30:23 ? 0:00 /usr/local/etc/httpd/httpd www 5821 199 0 13:55:01 ? 0:00 /usr/local/etc/httpd/httpd root 179 1 0 Oct 27 ? 0:00 /usr/lib/sendmail -bd -q1h
| Crontab คือการตั้งเวลาให้โปรแกรมประมวลผล |
NAME
crontab - user crontab file
SYNOPSIS
crontab [ filename ]
crontab [-elr] username
DESCRIPTION
The crontab utility manages a user's access with cron by
copying, creating, listing, and removing crontab files. If
invoked without options, crontab copies the specified file,
or the standard input if no file is specified, into a direc-
tory that holds all users' crontabs.
minute (0-59),
hour (0-23),
day of the month (1-31),
month of the year (1-12),
day of the week (0-6 with 0=Sunday).
0 * * * * /usr/local/etc/radius/bin/startup 59 23 * * * /usr/local/etc/radius/bin/runacct
| โปรแกรม startup : run ทุกชั่วโมง อัตโนมัติ |
#!/bin/sh /usr/local/etc/radius/bin/radiusd > /tmp/report /usr/bin/mail webmaster@yonok.ac.th < /tmp/report rm /tmp/report
| โปรแกรม runacct : run วันละ 1 ครั้ง อัตโนมัติ |
#!/bin/sh cp /usr/local/etc/radius/radacct/door.yonok.ac.th/detail /export/home/account/data ###### /usr/bin/date +%d > /tmp/date /usr/bin/date +%m > /tmp/month /usr/bin/date +%y > /tmp/year DATE=`cat /tmp/date` MONTH=`cat /tmp/month` YEAR=`cat /tmp/year` TODAY="$DATE$MONTH$YEAR" cd /export/home/account/data cp detail ../backup mv detail $TODAY ###### cd /tmp rm date month year rm /usr/local/etc/radius/radacct/door.yonok.ac.th/detail #end
| ตัวอย่างผลลัพธ์จาก Radius ที่จะใช้ pascal สรุปผลออกมา |
Tue Feb 1 04:09:07 2000
Client-Id = 203.146.9.254
Client-Port-Id = 2
User-Name = "guest006"
Acct-Status-Type = Start
User-Service-Type = 7
Acct-Session-Id = "00000B0D"
Tue Feb 1 04:09:12 2000
Client-Id = 203.146.9.254
Client-Port-Id = 2
User-Name = ""
Acct-Status-Type = Start
User-Service-Type = Framed-User
Acct-Session-Id = "00000B0F"
Framed-Protocol = PPP
Tue Feb 1 04:09:13 2000
Client-Id = 203.146.9.254
Client-Port-Id = 2
User-Name = ""
Acct-Status-Type = 3
User-Service-Type = Framed-User
Acct-Session-Id = "00000B0F"
Framed-Protocol = PPP
Framed-Address = 203.146.9.249
Tue Feb 1 04:28:06 2000
Client-Id = 203.146.9.254
Client-Port-Id = 2
User-Name = ""
Acct-Status-Type = Stop
User-Service-Type = Framed-User
Acct-Session-Id = "00000B0F"
Framed-Protocol = PPP
Framed-Address = 203.146.9.249
Acct-Session-Time = 1133
Tue Feb 1 04:28:11 2000
Client-Id = 203.146.9.254
Client-Port-Id = 2
User-Name = "guest006"
Acct-Status-Type = Stop
User-Service-Type = 7
Acct-Session-Id = "00000B0D"
Acct-Session-Time = 1144
Tue Feb 1 05:57:02 2000
Client-Id = 203.146.9.254
Client-Port-Id = 7
User-Name = "staff001"
Acct-Status-Type = Start
User-Service-Type = 7
Acct-Session-Id = "00000B10"
Tue Feb 1 05:57:07 2000
Client-Id = 203.146.9.254
Client-Port-Id = 7
User-Name = ""
Acct-Status-Type = Start
User-Service-Type = Framed-User
Acct-Session-Id = "00000B12"
Framed-Protocol = PPP
Tue Feb 1 05:57:08 2000
Client-Id = 203.146.9.254
Client-Port-Id = 7
User-Name = ""
Acct-Status-Type = 3
User-Service-Type = Framed-User
Acct-Session-Id = "00000B12"
Framed-Protocol = PPP
Framed-Address = 203.146.9.244
Tue Feb 1 07:22:53 2000
Client-Id = 203.146.9.254
Client-Port-Id = 4
User-Name = "guest007"
Acct-Status-Type = Start
User-Service-Type = 7
Acct-Session-Id = "00000B13"
Tue Feb 1 07:22:56 2000
Client-Id = 203.146.9.254
Client-Port-Id = 4
User-Name = ""
Acct-Status-Type = Start
User-Service-Type = Framed-User
Acct-Session-Id = "00000B15"
Framed-Protocol = PPP
Tue Feb 1 07:22:57 2000
Client-Id = 203.146.9.254
Client-Port-Id = 4
User-Name = ""
Acct-Status-Type = 3
User-Service-Type = Framed-User
Acct-Session-Id = "00000B15"
Framed-Protocol = PPP
Framed-Address = 203.146.9.247
Tue Feb 1 07:32:49 2000
Client-Id = 203.146.9.254
Client-Port-Id = 4
User-Name = ""
Acct-Status-Type = Stop
User-Service-Type = Framed-User
Acct-Session-Id = "00000B15"
Framed-Protocol = PPP
Framed-Address = 203.146.9.247
Acct-Session-Time = 592
Tue Feb 1 07:32:52 2000
Client-Id = 203.146.9.254
Client-Port-Id = 4
User-Name = "guest007"
Acct-Status-Type = Stop
User-Service-Type = 7
Acct-Session-Id = "00000B13"
Acct-Session-Time = 599
Tue Feb 1 07:32:55 2000
Client-Id = 203.146.9.254
Client-Port-Id = 8
User-Name = "guest009"
Acct-Status-Type = Start
User-Service-Type = 7
Acct-Session-Id = "00000B16"
Tue Feb 1 07:33:09 2000
Client-Id = 203.146.9.254
Client-Port-Id = 8
User-Name = ""
Acct-Status-Type = Start
User-Service-Type = Framed-User
Acct-Session-Id = "00000B18"
Framed-Protocol = PPP
Tue Feb 1 07:33:09 2000
Client-Id = 203.146.9.254
Client-Port-Id = 8
User-Name = ""
Acct-Status-Type = 3
User-Service-Type = Framed-User
Acct-Session-Id = "00000B18"
Framed-Protocol = PPP
Framed-Address = 203.146.9.243
Tue Feb 1 07:36:17 2000
Client-Id = 203.146.9.254
Client-Port-Id = 7
User-Name = ""
Acct-Status-Type = Stop
User-Service-Type = Framed-User
Acct-Session-Id = "00000B12"
Framed-Protocol = PPP
Framed-Address = 203.146.9.244
Acct-Session-Time = 5950
Tue Feb 1 07:36:22 2000
Client-Id = 203.146.9.254
Client-Port-Id = 7
User-Name = "staff001"
Acct-Status-Type = Stop
User-Service-Type = 7
Acct-Session-Id = "00000B10"
Acct-Session-Time = 5960
Tue Feb 1 07:54:28 2000
Client-Id = 203.146.9.254
Client-Port-Id = 5
User-Name = "guest008"
Acct-Status-Type = Start
User-Service-Type = 7
Acct-Session-Id = "00000B19"
Tue Feb 1 07:54:32 2000
Client-Id = 203.146.9.254
Client-Port-Id = 5
User-Name = ""
Acct-Status-Type = Start
User-Service-Type = Framed-User
Acct-Session-Id = "00000B1B"
Framed-Protocol = PPP
Tue Feb 1 07:54:32 2000
Client-Id = 203.146.9.254
Client-Port-Id = 5
User-Name = ""
Acct-Status-Type = 3
User-Service-Type = Framed-User
Acct-Session-Id = "00000B1B"
Framed-Protocol = PPP
Framed-Address = 203.146.9.246
Tue Feb 1 08:05:42 2000
Client-Id = 203.146.9.254
Client-Port-Id = 6
User-Name = "staff011"
Acct-Status-Type = Start
User-Service-Type = 7
Acct-Session-Id = "00000B1C"
Tue Feb 1 08:05:51 2000
Client-Id = 203.146.9.254
Client-Port-Id = 6
User-Name = ""
Acct-Status-Type = Start
User-Service-Type = Framed-User
Acct-Session-Id = "00000B1E"
Framed-Protocol = PPP
Tue Feb 1 08:05:51 2000
Client-Id = 203.146.9.254
Client-Port-Id = 6
User-Name = ""
Acct-Status-Type = 3
User-Service-Type = Framed-User
Acct-Session-Id = "00000B1E"
Framed-Protocol = PPP
Framed-Address = 203.146.9.245
Tue Feb 1 08:22:52 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = "dorm"
Acct-Status-Type = Start
User-Service-Type = 7
Acct-Session-Id = "00000B1F"
Tue Feb 1 08:22:56 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = ""
Acct-Status-Type = Start
User-Service-Type = Framed-User
Acct-Session-Id = "00000B21"
Framed-Protocol = PPP
Tue Feb 1 08:22:57 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = ""
Acct-Status-Type = 3
User-Service-Type = Framed-User
Acct-Session-Id = "00000B21"
Framed-Protocol = PPP
Framed-Address = 203.146.9.248
Tue Feb 1 09:02:16 2000
Client-Id = 203.146.9.254
Client-Port-Id = 8
User-Name = ""
Acct-Status-Type = Stop
User-Service-Type = Framed-User
Acct-Session-Id = "00000B18"
Framed-Protocol = PPP
Framed-Address = 203.146.9.243
Acct-Session-Time = 5347
Tue Feb 1 09:02:19 2000
Client-Id = 203.146.9.254
Client-Port-Id = 8
User-Name = "guest009"
Acct-Status-Type = Stop
User-Service-Type = 7
Acct-Session-Id = "00000B16"
Acct-Session-Time = 5364
Tue Feb 1 09:09:24 2000
Client-Id = 203.146.9.254
Client-Port-Id = 5
User-Name = ""
Acct-Status-Type = Stop
User-Service-Type = Framed-User
Acct-Session-Id = "00000B1B"
Framed-Protocol = PPP
Framed-Address = 203.146.9.246
Acct-Session-Time = 4493
Tue Feb 1 09:09:29 2000
Client-Id = 203.146.9.254
Client-Port-Id = 5
User-Name = "guest008"
Acct-Status-Type = Stop
User-Service-Type = 7
Acct-Session-Id = "00000B19"
Acct-Session-Time = 4501
Tue Feb 1 09:18:51 2000
Client-Id = 203.146.9.254
Client-Port-Id = 8
User-Name = "yonok013"
Acct-Status-Type = Start
User-Service-Type = 7
Acct-Session-Id = "00000B22"
Tue Feb 1 09:18:58 2000
Client-Id = 203.146.9.254
Client-Port-Id = 8
User-Name = ""
Acct-Status-Type = Start
User-Service-Type = Framed-User
Acct-Session-Id = "00000B24"
Framed-Protocol = PPP
Tue Feb 1 09:18:59 2000
Client-Id = 203.146.9.254
Client-Port-Id = 8
User-Name = ""
Acct-Status-Type = 3
User-Service-Type = Framed-User
Acct-Session-Id = "00000B24"
Framed-Protocol = PPP
Framed-Address = 203.146.9.243
Tue Feb 1 10:15:09 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = ""
Acct-Status-Type = Stop
User-Service-Type = Framed-User
Acct-Session-Id = "00000B21"
Framed-Protocol = PPP
Framed-Address = 203.146.9.248
Acct-Session-Time = 6735
Tue Feb 1 10:15:12 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = "dorm"
Acct-Status-Type = Stop
User-Service-Type = 7
Acct-Session-Id = "00000B1F"
Acct-Session-Time = 6742
Tue Feb 1 10:15:36 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = "staff009"
Acct-Status-Type = Start
User-Service-Type = 7
Acct-Session-Id = "00000B25"
Tue Feb 1 10:15:41 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = ""
Acct-Status-Type = Start
User-Service-Type = Framed-User
Acct-Session-Id = "00000B27"
Framed-Protocol = PPP
Tue Feb 1 10:15:41 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = ""
Acct-Status-Type = 3
User-Service-Type = Framed-User
Acct-Session-Id = "00000B27"
Framed-Protocol = PPP
Framed-Address = 203.146.9.248
Tue Feb 1 10:42:04 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = ""
Acct-Status-Type = Stop
User-Service-Type = Framed-User
Acct-Session-Id = "00000B27"
Framed-Protocol = PPP
Framed-Address = 203.146.9.248
Acct-Session-Time = 1583
Tue Feb 1 10:42:07 2000
Client-Id = 203.146.9.254
Client-Port-Id = 3
User-Name = "staff009"
Acct-Status-Type = Stop
User-Service-Type = 7
Acct-Session-Id = "00000B25"
Acct-Session-Time = 1591
|
โปรแกรม router.pas
โปรแกรมนี้ผมเขียนขึ้นเมื่อมกราคมปี 41 เพื่อใช้งาน .. ซึ่งถ้าเขียนใหม่ จะเขียนได้ดีกว่านี้มาก ท่านใดเขียนใหม่แล้ว ลดขั้นตอนลงได้ ช่วยส่งมาด้วยนะครับ ผมจะลง source ให้ครับ |
uses crt;
var
F : Text;
I,err : integer;
FOUT : Text;
FOUTNAME : String[12];
l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11 : string;
ok : integer;
kpuser : string[8];
kpport : char;
kptimeuse : string[7];
kpdatetime: string[30];
keepdata : string;
timesecond,timeminute,timehour,timeall : real;
procedure openfileout;
begin
Assign(F, ParamStr(1));
{$I-} Reset(F); {$I+}
if IOResult = 0 then
begin
FOUTNAME := ParamStr(1) + 'x.txt';
Assign(FOUT, FOUTNAME); Rewrite(FOUT);
Writeln('File name is : ',Paramstr(1));
end
else
Writeln('File not found');
end;
procedure readuntilfound;
var getline : string;
getch : char;
begin
ok := 0;
getch := char(0);
getline := '';
l1 :=''; l3:=''; l4:=''; l5 := ''; l8:='';
readln(f, getline); if getline[1] <> char(9) then l1 := getline;
readln(f, getline); l2 := getline;
readln(f, getline); l3 := getline;
readln(f, getline); l4 := getline;
readln(f, getline); l5 := getline;
readln(f, getline); l6 := getline;
readln(f, getline); l7 := getline;
readln(f, getline); if length(getline) < 5 then exit;
l8 := getline;
if (l5[21]+l5[22]+l5[23]+l5[24] = 'Stop') and (l6[22] = '7') then
begin
ok := 1;
kpdatetime := l1;
kpport := l3[19];
kpuser := l4[15]+l4[16]+l4[17]+l4[18]+l4[19]+l4[20]+l4[21]+l4[22];
kptimeuse := '';
for I := 22 to length(l8) do
begin
if l8[i] in ['0','1','2','3','4','5','6','7','8','9'] then
kptimeuse := kptimeuse + l8[i]
end;
val(kptimeuse,timeall,err);
keepdata := kpuser+' '+kpport+' '+kpdatetime+' '+kptimeuse;
keepdata := keepdata + char(13) + char(10);
write(keepdata);
end;
readln(f, getline); if length(getline) < 5 then exit;
l9 := getline;
readln(f, getline); if length(getline) < 5 then exit;
l10 := getline;
readln(f, getline); if length(getline) < 5 then exit;
l11 := getline;
writeln(getline);
readln;
end;
procedure keepinfile;
begin
write(fout,keepdata);
end;
begin
clrscr;
if length(paramstr(1)) > 0 then
begin
openfileout;
while not eof(f) do
begin
readuntilfound;
if ok = 1 then keepinfile;
end;
close(fout);
end
else
Writeln('What is the input-file.')
end.
| ทำรายงานใน excel |