Re: cisco log parsing

2002-05-30 Thread drieux


On Wednesday, May 29, 2002, at 12:29 , Hernan Marcelo Salvarezza wrote:

> Hello people
[..]
> the scripts works fine with a small log but when i try to run it in the
> long log file it displays all the log file
> just as if it is being opened with cat.

way strange...


> I am trying to get just the number,setup time and disconnect time from
> the log,,just this values in a single
> line like this
>
> 53353454545 18:10 18:20

>> From the script
>
> my $dtgT = '\d|:|\.';   #numbers or colons or dots
> my $upT = 'SetupTime';
> my $downT = 'DisconnectTime';
> my $prefT = '38\#';
>
> my $find = qr/(.*)\s+ (\d+\.\d+\.\d+\.\d+)\s* $prefT (\d+), \s* $upT\s*
> ([$dtgT]+)\s*$downT\s* ([$dtgT]+)/xo;

notice that there are five things being picked up


my $find = qr/(.*)\s+   # $1 - get the dtg String?
 (\d+\.\d+\.\d+\.\d+)\s* # $2 simple dotQuad Grovellor
 $prefT
 (\d+)   # $3 = that number thing
 ,\s*# comma with or without spaces
 $upT\s* # the SetUpTime Token
 ([$dtgT]+)  # $4 - the up time
 \s*$downT\s*# the downT Token
 ([$dtgT]+)  # $5 the down time
 /xo;# so that we can whack in answers.

since all you say that you want are the last three then you could
reconstruct it as


my $find = qr/\d+\.\d+\.\d+\.\d+\s* # simple dotQuad Grovellor
 $prefT
 (\d+)   # $1 = that number thing
 ,\s*# comma with or without spaces
 $upT\s* # the SetUpTime Token
 ([$dtgT]+)  # $2 - the up time
 \s*$downT\s*# the downT Token
 ([$dtgT]+)  # $3 the down time
 /xo;# so that we can whack in answers.




> so the question is  how should i form the regexp to just get the number
> from the entire log file?
> how should i form the regexp  get only the disconnect time?
>
>
> Log File:
>
> May 10 14:25:00  13310: %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 1,
> ConnectionId 0 0 0 0, SetupTim
> e 17:30:58.645 UTC Fri May 10 2002, PeerAddress 38#533147631,
> PeerSubAddress , DisconnectCause 2F  , Disconnect
> Text no resource., ConnectTime 17:30:58.655 UTC Fri May 10 2002,
> DisconnectTime 17:30:58.655 UTC Fri May 10 200
> 2, CallOrigin 1, ChargedUnits 0, InfoType 2, TransmitPackets 0,
> TransmitBytes 0, ReceivePackets 0, ReceiveBytes
>  0

is that one line entry in the file???

> May 10 15:03:05  13311: %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 1,
> ConnectionId 0 0 0 0, SetupTim
> e 18:09:04.262 UTC Fri May 10 2002, PeerAddress 38#5347631,
> PeerSubAddress , DisconnectCause 2F  , DisconnectTe
> xt no resource., ConnectTime 18:09:04.262 UTC Fri May 10 2002,
> DisconnectTime 18:09:04.262 UTC Fri May 10 2002,
>  CallOrigin 1, ChargedUnits 0, InfoType 2, TransmitPackets 0,
> TransmitBytes 0, ReceivePackets 0, ReceiveBytes 0

and this the next line entry???

> May 10 15:03:38  %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 2,
> ConnectionId DF125DE2 637711D6
>  BD90A185 393856AE, SetupTime 18:09:15.110 UTC Fri May 10 2002,
> PeerAddress , PeerSubAddress , DisconnectCause
> 10  , DisconnectText normal call clearing., ConnectTime 18:09:37.970 UTC
> Fri May 10 2002, DisconnectTime 18:09:
> 37.970 UTC Fri May 10 2002, CallOrigin 2, ChargedUnits 0, InfoType 2,
> TransmitPackets 451, TransmitBytes 18040,
>  ReceivePackets 0, ReceiveBytes 0


This is actually the interesting entry - since this one does
not have the numeric value I would be expecting given your
first two note also that there is no PeerAddress value set...

and does this really need to be on the cgi list? or should this
be on say the beginner's mailing list???

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Insertion of table causes syntax error-message

2002-05-30 Thread Richard Krause

Hi all

I'd like to generate a html page in a subroutine of my guestbook but I get a
syntax error pointing to the line where $q->end_html; is written as soon as
I include a table. If executed without the table, the script runs well. (the
table is copied from perldoc.cgi and its content will be replaced later).

This is my code:

#!c:/program files/perl/bin/perl -w

use diagnostics;
 use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $q = CGI::new();

(...)

sub confirmation_no_url{
print $q->header('text/html'),
  $q->start_html(-title=>'comment added to guestbook',
  -style=>{'src'=>'http://129.132.128.47/krausenet/css/richi
.css'},
  -bgcolor=>'black'),
  $q->h1('confirmation: new comment added to guestbook'),
  $q->p('you submitted the following information:'),

#  table({-border=>undef},
#caption('When Should You Eat Your Vegetables?'),
#Tr({-align=>CENTER,-valign=>TOP},
#[
#th(['Vegetable', 'Breakfast','Lunch','Dinner']),
#td(['Tomatoes' , 'no', 'yes', 'yes']),
#td(['Broccoli' , 'no', 'no',  'yes']),
#td(['Onions'   , 'yes','yes', 'yes'])
#]
#)
#  )

   $q->end_html;

(...)

Is there a general problem known with the insertion of tables? perldoc.gci
isn't mentioning anything.

Thanks
Richard



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




URL for security issue?

2002-05-30 Thread John Brooking

Gang,

   A week or three ago, someone referred to a page
that discussed security issues when using CGI input to
send out to a web page. I thought I had bookmarked the
page or saved the email, but I can't find it now.
Could whoever posted it please do so again, or maybe
just email it to me privately? Thanks!

- John


=
"Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still 
alive, and there's nothing I want to do." - They Might Be Giants, http://www.tmbg.com

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: URL for security issue?

2002-05-30 Thread David T-G

John, et al --

...and then John Brooking said...
% 
% Gang,

Hello!


% 
%A week or three ago, someone referred to a page
% that discussed security issues when using CGI input to
% send out to a web page. I thought I had bookmarked the
% page or saved the email, but I can't find it now.
% Could whoever posted it please do so again, or maybe
% just email it to me privately? Thanks!

Actually, I'd appreciate such a thing, too.  I just went back through my
list mailbox looking for "cgi" and "security" in the body and don't see
anything relating to a pointers page; the closet is Ovid's response to
Fred Sahakian outlining some things to check when looking at a CGI script.


% 
% - John


HTH & HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg05077/pgp0.pgp
Description: PGP signature


Re: Insertion of table causes syntax error-message

2002-05-30 Thread Dave K

Richard,
You did take that from the 'Rat' book, but in the book
use CGI qw( standard );
Allows the author to use an implicit $q-> so he can write table
where as you need to write $q->table, $q->Tr, $q->td etc.
HTH
"Richard Krause" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all
>
> I'd like to generate a html page in a subroutine of my guestbook but I get
a
> syntax error pointing to the line where $q->end_html; is written as soon
as
> I include a table. If executed without the table, the script runs well.
(the
> table is copied from perldoc.cgi and its content will be replaced later).
>
> This is my code:
>
> #!c:/program files/perl/bin/perl -w
>
> use diagnostics;
>  use strict;
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
>
> my $q = CGI::new();
>
> (...)
>
> sub confirmation_no_url{
> print $q->header('text/html'),
>   $q->start_html(-title=>'comment added to guestbook',
>   -style=>{'src'=>'http://129.132.128.47/krausenet/css/ric
hi
> .css'},
>   -bgcolor=>'black'),
>   $q->h1('confirmation: new comment added to guestbook'),
>   $q->p('you submitted the following information:'),
>
> #  table({-border=>undef},
> #caption('When Should You Eat Your Vegetables?'),
> #Tr({-align=>CENTER,-valign=>TOP},
> #[
> #th(['Vegetable', 'Breakfast','Lunch','Dinner']),
> #td(['Tomatoes' , 'no', 'yes', 'yes']),
> #td(['Broccoli' , 'no', 'no',  'yes']),
> #td(['Onions'   , 'yes','yes', 'yes'])
> #]
> #)
> #  )
>
>$q->end_html;
>
> (...)
>
> Is there a general problem known with the insertion of tables? perldoc.gci
> isn't mentioning anything.
>
> Thanks
> Richard
>
>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: URL for security issue?

2002-05-30 Thread Scot Robnett

I don't know if this was one of the retransmissions you were looking for,
but here you go just in case.

-

I usually do a combination of things.

* You can check domains, but they can be spoofed,
  so that in itself is not a cure. It's a start.

* Does the site have a static IP? You can set
  the script only to run if called from that IP.
  Once again 'spoofable' but less than a domain
  on its own.

* Use the CGI.pm module's built-in data limit
  function. You can set POST_MAX to a reasonable
  level to avoid buffer overflow issues, or just
  set DISABLE_UPLOADS = 1 if no files are going
  to be uploaded.

* Are you on UNIX? Most of my sites are on some
  flavor of *NIX and I run my scripts suid. You
  can explicitly tell the script that it can
  run -only- as the user, not even as the httpd
  daemon. (#!/usr/bin/perl -U with the script
  directory chmod'd 4711)


Scot Robnett
inSite Internet Solutions
[EMAIL PROTECTED]
[EMAIL PROTECTED]




-Original Message-
From: David T-G [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 30, 2002 11:53 AM
To: Beginners CGI
Cc: John Brooking
Subject: Re: URL for security issue?


John, et al --

and then John Brooking said...
%
% Gang,

Hello!


%
%A week or three ago, someone referred to a page
% that discussed security issues when using CGI input to
% send out to a web page. I thought I had bookmarked the
% page or saved the email, but I can't find it now.
% Could whoever posted it please do so again, or maybe
% just email it to me privately? Thanks!

Actually, I'd appreciate such a thing, too.  I just went back through my
list mailbox looking for "cgi" and "security" in the body and don't see
anything relating to a pointers page; the closet is Ovid's response to
Fred Sahakian outlining some things to check when looking at a CGI script.


%
% - John


HTH & HAND

:-D
--
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.365 / Virus Database: 202 - Release Date: 5/24/2002


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: URL for security issue?

2002-05-30 Thread John Brooking

Actually, I may have just found it. I think it was
"Preventing Cross-site Scripting Attacks" at
http://www.perl.com/pub/a/2002/02/20/css.html. In any
case, that's good reading, and if anyone has any
others to pass along, feel free. If I get enough, I'll
publish a links page of them for future reference.

--- David T-G <[EMAIL PROTECTED]>
wrote:
> Actually, I'd appreciate such a thing, too.  I just
> went back through my
> list mailbox looking for "cgi" and "security" in the
> body and don't see
> anything relating to a pointers page; the closet is
> Ovid's response to
> Fred Sahakian outlining some things to check when
> looking at a CGI script.


=
"Now it's over, I'm dead, and I haven't done anything that I want; or, I'm still 
alive, and there's nothing I want to do." - They Might Be Giants, http://www.tmbg.com

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: URL for security issue?

2002-05-30 Thread Scot Robnett

John,

Thanks for that link. Good reading/advice.

Scot R.



-Original Message-
From: John Brooking [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 30, 2002 12:02 PM
To: David T-G; Beginners CGI
Subject: Re: URL for security issue?


Actually, I may have just found it. I think it was
"Preventing Cross-site Scripting Attacks" at
http://www.perl.com/pub/a/2002/02/20/css.html. In any
case, that's good reading, and if anyone has any
others to pass along, feel free. If I get enough, I'll
publish a links page of them for future reference.

--- David T-G <[EMAIL PROTECTED]>
wrote:
> Actually, I'd appreciate such a thing, too.  I just
> went back through my
> list mailbox looking for "cgi" and "security" in the
> body and don't see
> anything relating to a pointers page; the closet is
> Ovid's response to
> Fred Sahakian outlining some things to check when
> looking at a CGI script.


=
"Now it's over, I'm dead, and I haven't done anything that I want; or, I'm
still alive, and there's nothing I want to do." - They Might Be Giants,
http://www.tmbg.com

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.365 / Virus Database: 202 - Release Date: 5/24/2002

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.365 / Virus Database: 202 - Release Date: 5/24/2002


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: URL for security issue?

2002-05-30 Thread Ovid

--- John Brooking <[EMAIL PROTECTED]> wrote:
> Gang,
> 
>A week or three ago, someone referred to a page
> that discussed security issues when using CGI input to
> send out to a web page. I thought I had bookmarked the
> page or saved the email, but I can't find it now.
> Could whoever posted it please do so again, or maybe
> just email it to me privately? Thanks!
> 
> - John

I'm not sure as to the link, but you can check out my course at
http://www.easystreet.com/~ovid/cgi_course/

I focus heavily on security issues and include many links to better resources.  My 
course deals
heavily with the "hands on" aspects, so I think it's a nice cross between abstract 
reading and
real-world experience.

One note:  in lesson 4, part 2, I screwed up on a couple of points.  I make reference 
to a "salt",
but in reality I'm using a randomly generated string constant which is not, in fact, a 
salt.  I'll
get around to fixing that someday.  There are some other issues that you can read 
about at
http://www.perlmonks.org/index.pl?node_id=136655

Cheers,
Curtis "Ovid" Poe

=
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Problems with perl.beginners.cgi?

2002-05-30 Thread David T-G

Richard --

...and then Richard Krause said...
% 
% Hi all

Hello!


% 
% Is there something wrong with perl.beginners.cgi? No new postings since 28th
% may and I posted hours ago and my message isn't showing up. Is there a
% adress to report this to?

I don't know that there's anything wrong with the newsgroup, but the mail
gatewaying is working dandily; I saw your post from today at 16:02 (your
+0200 time) in my mailbox as <[EMAIL PROTECTED]>
and there have been others as well.


% 
% Regards
% Richard


HTH & HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg05083/pgp0.pgp
Description: PGP signature


Re: Insertion of table causes syntax error-message

2002-05-30 Thread Todd Wade


"Richard Krause" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi all
> (...)
> #td(['Broccoli' , 'no', 'no',  'yes']),
> #td(['Onions'   , 'yes','yes', 'yes'])
> #]
> #)
missing a comma ^ here
> #  )
and   ^ here
>
>$q->end_html;

It looks like to me.

Todd W



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Getting content of a configuration file

2002-05-30 Thread Todd Wade


"Sven" <[EMAIL PROTECTED]> wrote in message
027901c204e8$fa475da0$14e307d5@brian">news:027901c204e8$fa475da0$14e307d5@brian...

...
> $context = $q->param(context);
>
> require "conf.txt";
> open(READ, "conf.txt") or die "Error opening file: conf.txt, Errorcode:
> $!\n";
> close(READ);

I dont understand the open then close. The require is all thats necessary.

> if ($context eq "assembly") { %conf_data = %assembly ; }
> elsif ($context eq "basic") { %conf_data = %basic ; }

Instead of doing this, use symbollic references.

%conf_data = %{$context};

and you are all set. You will have to turn off strict refs for this line of
code when use strict; is in effect.

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]