#!/usr/local/bin/perl5
#
# $debugvalue   - zero     - dont print debug messages
#               - non-zero - print debug  messages
$debugvalue=0;
#
# returns status of the program
# 0 - everything worked
# 1 - the data returned is different then expected
#   - this is an error condition
# 2 - request for url failed
#   - this is probably due to a time out error
#   - or an incorrect password (Authorization Required)
$our_return_code=0;
$userid='mqwsdgxt';
#
# if the user overrides the devault timeout value
# the next timeoutvalue will be set to the new value
#
$timeoutvalue=""; 
$timeoutsgiven=0;
$timeouterrors=0;
print "password? ";
$password=<STDIN>;
$password=~s/\n//;
use CGI;
use HTTP::Headers;
use LWP::UserAgent;
use HTTP::Request;
#$q= new CGI;
#
#user agent is your browser
#
#
#create the url object
#
use URI::URL;
#
#create the headers
#
$hdrs = new HTTP::Headers(Accept => 'text/plain', User-Agent=> 'MegaBrowser/1.0');
#
#
#  1) this is run at the unix command line
#     with
#             perl mikewatch.pl
#  2) it then grabs some data from the web site
#          http://cco-dev.cisco.com/stack
#     and writes it to a file
#
#  define URL to work on
#
$showstack="System+was+restarted+by+error+%2D+a+SegV+exception%2C+PC+0x6006EF1C%0D%0A3600+Software+%28C3640%2DJS%2DM%29%2C+Version+11.2%286%29F%2C+SHARED+FEATURE%2C+RELEASE+SOFTWARE+%0D%0A%28fc1%29%0D%0ACompiled+Mon+12%2DMay%2D97+20%3A14+by+ajchopra+%28current+version%29%0D%0AImage+text%2Dbase%3A+0x600088B0%2C+data%2Dbase%3A+0x607E8000%0D%0AStack+trace+from+system+failure%3A%0D%0AFP%3A+0x60A93CC8%2C+RA%3A+0x6006EF1C%0D%0AFP%3A+0x60A93CE8%2C+RA%3A+0x6005BBC8%0D%0AFP%3A+0x60A93D00%2C+RA%3A+0x6005B724%0D%0AFP%3A+0x60A93D20%2C+RA%3A+0x60057DF8%0D%0AFP%3A+0x60A93D88%2C+RA%3A+0x60062CE8%0D%0AFP%3A+0x60A93DB8%2C+RA%3A+0x6004EA94%0D%0AFP%3A+0x60A93DD0%2C+RA%3A+0x6004EA78%0D%0A";
$urldata="submit=Send&deliv=Screen&showstack=$showstack";
#
# this is url i execute to display the screens
# its commented out
#
#$url = new URI::URL("http://cco-dev.cisco.com/stack$urldata");
#
#this url is executed when you fill in the screen with data
#     click on 
#                deliv=Screen
#                submit=Send
$url = new URI::URL("http://cco-dev.cisco.com/cgi-bin/Support/Stackdecoder/stackdecoder.pl?$urldata");
#
#creates a request object
#
$req = new HTTP::Request(GET, $url, $hdrs);
$ua = new LWP::UserAgent;
#
#  give it the password required to get onto cisco's web.
#
$netloc="cco-dev.cisco.com";
$realm="CCO";
$passwordrc=$ua->credentials( $netloc, $realm, $userid , $password);
#
#get the time out value
#
$ztimeoutvalue=$ua->timeout();
if ( $debugvalue != 0 ) {
   print "TIMEOUT=$ztimeoutvalue\n";
}

# #the default time out is 180 seconds which is 3 minutes #the software that run is slower then well slow #so we will allow the user to specify a new value #for the timeout by on the command line placing # # timeout=nnnn # #where nnnn are digits 0 thru 9 # #any other timeout values are ignored # #if the user gives mutiple time out values #the last one is used # # # if args were passed to the program look # for timeout argument # if ( $#ARGV >= 0 ) { # # look at each argument passed and see if its timeout= # foreach $argumentpassed (@ARGV) { # # search for timeout= # we dont care about case so # Timeout= # timeout= # TIMEOUT= # tImeOuT= # will all match if ($argumentpassed =~ /^timeout=/i ) { $timeoutsgiven++; # #get the time out value # $timeoutvalue=$argumentpassed; if ( $debugvalue != 0 ) { print "timeout ($timeoutsgiven) value given\n"; print "TIMEOUT='$timeoutvalue'\n"; } # #remove the leading # timeout= #from the timeout value # $timeoutvalue=~s/^timeout=//i; if ( $debugvalue != 0 ) { print "timeoutvalue=$timeoutvalue\n"; } # # if timeout= # was given with no time ignore it # and dont create a timeout value if ( $timeoutvalue eq "" ) { print "warning timeout value is null $argumentpassed\n"; } # #verify that the timeout value is #an unsigned number. #if it contains anyother digits dont use the time out value # if ( $timeoutvalue !~ /^[0-9]+$/ ) { print "error timeout is not numeric or begins with a sign\n"; print " $argumentpassed\n"; $timeoutvalue=""; $timeouterrors++; } } } } # #if the user entered several timeout= values #print a warning message that several were given #and only the last value will be used # if ( $timeoutsgiven > 1 ) { print "warning mutiple timeout values given\n"; if ( $timeoutvalue eq "" ) { print "last timeout was null so were not using a time out value\n"; } else { print "using timeout value of '$timeoutvalue'\n"; } } # #if the time out value is numeric #set a new timeout value for the user # if ( $timeoutvalue =~ /^[0-9]+$/ ) { if ( $debugvalue != 0 ) { print " setting timeout value of $timeoutvalue\n"; } # #set a new timeout value # $ua->timeout($timeoutvalue); # #redundant - get the value of the new timeout # $newtimeout=$ua->timeout(); if ( $debugvalue != 0 ) { print "NEW TIMEOUT=$newtimeout\n"; } } # # run the url and get the data # $resp = $ua->request($req); # # # this is what the correct output looks like $outputshouldlooklikethis='<HTML> <HEAD> <TITLE>Stack Decoder</TITLE> </HEAD> <BODY BGCOLOR=#FFFFFF> <img src="/images/Icon_Stack.gif"><BR> <A href="/cgi-bin/imagemap/toolbar"> <iMG BORDER=0 SRC="/images/toolbar.gif" ISMAP></A> <HTML> <HEAD> <TITLE>Stack Results</TITLE> <H2>Stack Decoder Results</H2> <B>Stack Trace Version: 11.2(6)F</B> <br>Original Trace: <br> <pre>System was restarted by error - a SegV exception, PC 0x6006EF1C 3600 Software (C3640-JS-M), Version 11.2(6)F, SHARED FEATURE, RELEASE SOFTWARE (fc1) Compiled Mon 12-May-97 20:14 by ajchopra (current version) Image text-base: 0x600088B0, data-base: 0x607E8000 Stack trace from system failure: FP: 0x60A93CC8, RA: 0x6006EF1C FP: 0x60A93CE8, RA: 0x6005BBC8 FP: 0x60A93D00, RA: 0x6005B724 FP: 0x60A93D20, RA: 0x60057DF8 FP: 0x60A93D88, RA: 0x60062CE8 FP: 0x60A93DB8, RA: 0x6004EA94 FP: 0x60A93DD0, RA: 0x6004EA78

</pre><br><HR> Session ID: 000000003A4145421D7D<br> <h3>General Diagnosis:</h3> <FONT COLOR=GREEN><DT>Hardware:<DD>No failures detected.</FONT><FONT COLOR=RED><DT>Software:<DD>Ranked bug citations are listed.</FONT><br><H3>Bug Citations</H3> <B>Below are possible bug report citations that may be relevant to the cause of your Stack Trace. Citations with the highest score are the closest fit, with those having scores of 0.90 or higher being the most likely candidates.<B> <P> <p><h3>Symbols</h3><p>nfas_t321_timeout<br> U0_T321Expiry<br> L3_ProcessEvent<br> L3_Go<br> L3IF_StartL3<br> TaskBegin<br> <p><HR><h3>DECODED TRACE</h3><P> <TABLE BORDER> <TR><TH>Score<TH>Severity<TH>Bugid<TH>Version</TH><TH>Fixed in:</TH><TH>Feature<TH>Title<TR> <TR><TD>Content-Length: 2210</TD><TD></TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid= target = new"></A></TD><TD></TD><TD></TD><TD></TD><TD <TR><TD>27DDTS-SEARCH-STRING: (VERSION &lt;MATCHES&gt; ?11.??2* &lt;OR&gt; INTEGRATED &lt;MATCHES&gt; ?11.??2*) &lt;AND&gt; ([80]nfas_t321_timeout,[60]U0_T321 <TR><TD>0.94</TD><TD>3</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdj16901 target = new">CSCdj16901</A></TD><TD> 11.2(0)</TD><TD> 1 <TR><TD>0.88</TD><TD>1</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdj43873 target = new">CSCdj43873</A></TD><TD> 11.2(0)</TD><TD> <TR><TD>0.88</TD><TD>2</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdm85145 target = new">CSCdm85145</A></TD><TD> 11.2(18)</TD><TD <TR><TD>0.88</TD><TD>3</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdk33785 target = new">CSCdk33785</A></TD><TD> 11.2(13)</TD><TD></TD><TD>isdn</TD><TD>Inserting cable into BRI reloads router <TR><TD>0.84</TD><TD>2</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdk02552 target = new">CSCdk02552</A></TD><TD> 11.2(0)</TD><TD> 12.0(0.8) 11.3(4.1) 11.3(4.1)T 11.3(4.1)NA 11.3(4.1)AA 11.2(16) 11.3 <TR><TD>0.71</TD><TD>1</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdj25607 target = new">CSCdj25607</A></TD><TD> 11.2(0) 11.3(0)</TD><TD></TD><TD>isdn</TD><TD>software-forced reload running core/bri <TR><TD>0.71</TD><TD>2</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdk45046 target = new">CSCdk45046</A></TD><TD> 11.2(12.2)</TD><TD></TD><TD>isdn</TD><TD>2524 router crashed <TR><TD>0.70</TD><TD>2</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdk58214 target = new">CSCdk58214</A></TD><TD> 11.2(15)</TD><TD> 11.2(19.4)P</TD><TD>isdn</TD><TD>c2500 crashed in crashdump after IS <TR><TD>0.69</TD><TD>3</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdm04331 target = new">CSCdm04331</A></TD><TD> 11.2(0)</TD><TD></TD><TD>isdn</TD><TD>L3If_StartL3 - router crash running 11.2(17)P but <TR><TD>0.60</TD><TD>4</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdi63402 target = new">CSCdi63402</A></TD><TD> 11.2(0)</TD><TD> 11.2(0.18)</TD><TD>isdn</TD><TD>get isdn table out of data space and in <TR><TD>0.60</TD><TD>2</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdj37495 target = new">CSCdj37495</A></TD><TD> 11.2(8.0)</TD><TD></TD><TD>as</TD><TD>DMS line on 5300 can not accept more than 36 remote <TR><TD>0.60</TD><TD>2</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdk32594 target = new">CSCdk32594</A></TD><TD> 11.2(0)</TD><TD> 12.0(3.1) 12.0(3.1)S 11.3(8.1)T 12.0(0) 3.0(0) 11.3(8.1) 11.3(8.1)NA 11.3 <TR><TD>0.60</TD><TD>2</TD><TD><A href="http://www-tac.cisco.com/cgi-bin/ddtsview.pl?bugid=CSCdi69782 target = new">CSCdi69782</A></TD><TD> 11.2(25)</TD><TD></TD><TD>isdn</TD><TD>ISDN layer 2 goes NOT ACTIVE, REQUIRES reload to cle

</pre></table> <P> <HR> [<B><A href="/stack/stackdecoder.shtml">Stack Decoder</A></B>] [<B><A href="/common/find_home.shtml">CCO Home Page</A></B>] [<B><A href="/stack/Stack_help.html">Help</A></B>]'; # # # # # #

if ($resp->is_success) { if ( $debugvalue != 0 ) { print "url request worked\n"; } # #compare all the lines returned #they must all be equal execpt the one line that says # "Session ID: 000000003A4145421D7D<br>" #and those 2 must be close # @list1=split('\n', $outputshouldlooklikethis); $returned_html_output=$resp->content; $returned_html_output=~s///g; @list2=split('\n', $returned_html_output); $errors=0; $line=0; # #compare all the lines. #if any are different exit in error # foreach $data (@list1) { if ($data ne $list2[$line] ) { # # lines are different # if ($data eq "Session ID: 000000003A4145421D7D<br>" && $list2[$line] =~ "Session ID: [0-9A-Fa-f]+<br>" ) { # # its the session id line so the difference is ok # if ( $debugvalue != 0 ) { print "Session Id lines different but thats ok\n"; print "----->1:'$data'\n"; print "----->2:'$list2[$line]'\n"; } } else { # #lines are different. something is wrong # print "line $line Not Equal\n"; print "----->1:'$data'\n"; print "----->2:'$list2[$line]'\n"; $errors=1; $our_return_code=1; } } $line++; } # #the returned list better have the same number of lines #as the list devined in this program. if its shorter #the prior logic will catch the error. if its longer #the following logic will catch the error # #push(@list2,(extra,krap,to,put,on,to,list2,to,force,an,error)); if ( $#list2 > $#list1 ) { print "we expected $#list1 lines but received $#list2 lines\n"; print "this means too much data was returned to us\n"; print "extra lines in list 2 follow\n"; for ($i=($#list1+1); $i<=$#list2; $i++) { print "extra data $i:$list2[$i]\n"; } $our_return_code=1; } # # for debugging write the output to disk # open (DUMPIT,">dumpfile") or die("cant open dumpfile"); print DUMPIT $resp->content; close (DUMPIT); } else { # # request to view url failed - its probably a TIME OUT ERROR # print "FAILED: $url\n"; print "Text follows:\n"; print $resp->message; print "\n\n"; $our_return_code=2; } if ( $debugvalue != 0 ) { print "all done rc=$our_return_code\n"; } exit $our_return_code;


Visit the Crazy Atheist Libertarian
Check out "David Dorn" - Hate Monger
Check out Atheists United - Arizona
Visit my atheist friends at Heritics, Atheists, Skeptics, Humanists, Infidels, and Secular Humanists - Arizona
Arizona Secular Humanists
Paul Putz Cooks the Arizona Secular Humanist's Check Book
News about crimes commited by the police and government
News about crimes commited by religious leaders and beleivers
Some strange but true news about the government
Some strange but real news about religion
Interesting, funny but otherwise useless news!
Libertarians talk about freedom
Cool Useless Photos, Cool gif files, Cool jpg files
Legal Library
Gif, JPG, and other images you can use on your web pages
David Dorn Insuranse