From: Steve K. on
Tad McClellan wrote:
>Steve Kostecke <spamtrap(a)ntp.isc.org> wrote:
>> "Tad McClellan" <tadmc(a)augustmail.com> wrote in message
>> news:slrneib43v.9e3.tadmc(a)magna.augustmail.com...
>>> samiam(a)mytrashmail.com <samiam(a)mytrashmail.com> wrote:
>
>>>> At first I thought to use VBScript, but then I realized that Perl
>>>> is portable, doesn't necessarily have to be installed on the
>>>> server, and
>>>
>>>
>>> What "server"?
>>>
>>> A server is not normally required to run Perl programs.
>>>
>>> Is this a stealth CGI question?
>>
>> His question was obviously pertaining to Perl being used for a file
>> parsing solution. The question itself had nothing to do with CGI and
>> I think you knew that.
>
>
> Yes, I did.
>
> But it appeared that the OP did not. Now he does.

What made you think he did not?? Simply because he said "server" some
how automagically translates into your min into "web server" ? Has it
even occurred to you he could of simply meant a remote server he has
been working on? For instance, you SSH or Remote-Desktop/VNC in and you
work; not exactly a new concept. This can be for any number of purposes,
and he never said one thing abut www, web, http, nor cgi.

Lets take a look at what he DID say:

samiam(a)mytrashmail.com wrote:
> Hello,
>
> I know this is a trivial parse / grep job for any Perl rake worth his
> salt,

Hmm, "trivial parse / grep job ", looks right up Perl's alley.

> but does anyone have guidance on how this Perl newbie might pull
> a string from one file and use this string to pull the lines in
> another file out, and also pull the first line before (matching
> criteria) and the first line after (matching criteria.)

Text parsing stuff, still very valid for Perl, don'cha think?

> I have described this in detail below.
>
> At first I thought to use VBScript,

VBScript has many applications outside of web scripting. He makes no
mention of web, http, or cgi so no reason to go there. (See "Scripting
Host" on Windows.)

> but then I realized that Perl is
> portable, doesn't necessarily have to be installed on the server, and
> probably has MUCH better string processing power than VBScript.

In this context, he could of either meant a "remove server" or he could
of been referring to any old box. Still no mention of anything web
related.

> I also considered grep, but still thought I could reuse the Perl
> solution in more places.

So please tell me how anything he said can be seen as a CGI question,
and how it was even remotely fair to accuse him like you did of making a
"stealth CGI question" when everything he wrote was HOW to do some
"trivial parse / grep job" with Perl. Even with CGI questions it's often
been said it will go answered if the question is still _directed_ at the
Perl side of things, so I really see no point at all as trying to paint
him as trying to do something wrong with words like "stealth", as if
you're just simply witch hunting.


From: samiam on

Hi Steve,

Very able defense. Thank you.

You are, of course, correct: There is no cgi or Web Server involved in
this equation. I didn't know "cgi was off limits" or taboo in this
group. Why is cgi a no-no?

My application of this perl parser is to report the output of security
related registry changes on voice recognition servers. They are stand
alone w2k boxes being brought into lock-down compliance.

Thanks to someone named Brigmar over on Tek-Tips, I have a very elegant
solution, far more terse than I imagined. In little over 20 lines of
code, he conditionally pulls data from FILE-A and uses this data to
conditionally pull from FILE-B and then posts it all in a CSV file. Do
you think his code is especially economical and clean?

http://home.comcast.net/~tankomail/Brigmar_Report_script.pl

The only thing I have failed at doing is pulling the:
%%before and %% after registry keys and putting these into additional
columns in the CSV file.

I figure with this model, there is a whole world of pasing tasks I
could do with this as my code base.

Do you have a line into how I could add the two additional column
values?

The simple project is summed at the bottom as well as links to the 2
data files, Brigmar's excellent script on which all is based and a few
pasted data samples from the 2 linked data files.

Thanks for your input!

L,
S
-----------------------------------------
DATA FILES AND INITIAL SCRIPT FROM BRIGMAR from Tek Tips.

http://home.comcast.net/~tankomail/test.dsc FILE-A data
http://home.comcast.net/~tankomail/server1.aud FILE-B data
http://home.comcast.net/~tankomail/Brigmar_Report_script.pl Brigmar
Script
http://home.comcast.net/~tankomail/logfile.csv - The CSV files the
script creates

Below is a snippet of FILE-A data which matches FILE-B data.

For instance - the fail line 5.4.6.24 in FILE-B matches the # cached
logon credentials # section in FILE-A vis-a-vis the section
containing the same 5.4.6.24 CSR#.

FILE-A is no more than sections delimited by #Section Title# , the
Registry key that needs to be changed, and identified by CSR numbers.

The goal is to pull the registry entry from each failed CSR section
(Identified in FILE-B) and pull from FILE-A:
1.) #section title#
2.) CSR#
3.) %%before and %% after registry keys

and push this data into CSV format for viewing with Excel.

--------------------------
FILE-B Aud file:

5.7.1.2~Password Expires Requirement~FAIL~FAIL~
5.4.6.62~Force Unlock Logon~FAIL~FAIL~
5.4.6.24~Cached logon credentials~FAIL~FAIL~1010
5.4.6.27~Smart Card Behavior~FAIL~FAIL~11
5.4.6.20~Auto Admin Login Settings~PASS~PASS~00
5.4.6.9~Sharing of Devices - Floppys~PASS~PASS~11
5.4.6.9~Sharing of Devices - CDRoms~PASS~PASS~11
5.4.6.7~Sharing of Devices - DASD~PASS~PASS~00
5.4.6.16~IPSec Security for Kerberos RSVP Traffic~PASS~PASS~11
5.4.6.17~Hide Computer Name~FAIL~FAIL~
---------------------------

Find the fail lines, get the CSR at the beginning of the line and match
to registry change section in FILE-A
-------------------------
FILE-A dsc file:

# cached logon credentials #
dialog set,text1,"5.4.6.24 Cached logon
credentials" **********Wish to add these descriptions to csv
dialog set,text2,"5.4.6.24 Cached logon credentials"
%%before = @REGREAD(HLM,SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon,CachedLogonsCount,)
REGISTRY WRITE,HLM,SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon,CachedLogonsCount,2
%%after = @REGREAD(HLM,SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon,CachedLogonsCount,)
%%stat = FAIL
%%stat2 = FAIL
if @equal(%%before,"2")
%%stat = PASS
end
if @equal(%%after,"2")
%%stat2 = PASS
end
list add,debug,"Cached logon credentials:Setting Before Run" %%before
"Setting After Run:" %%after
list add,log,"5.4.6.24~Cached logon
credentials~"%%stat"~"%%stat2"~"%%before%%after
list savefile,log,%%logfile
list savefile,debug,%%debugfile
wait 0.2

:checktwentyseven
%%check = @INIREAD(checks,checktwentyseven)
if @equal(%%check,off)
goto checktwentyeight
end
---------------------------
Steve K. wrote:
> Tad McClellan wrote:
> >Steve Kostecke <spamtrap(a)ntp.isc.org> wrote:
> >> "Tad McClellan" <tadmc(a)augustmail.com> wrote in message
> >> news:slrneib43v.9e3.tadmc(a)magna.augustmail.com...
> >>> samiam(a)mytrashmail.com <samiam(a)mytrashmail.com> wrote:
> >
> >>>> At first I thought to use VBScript, but then I realized that Perl
> >>>> is portable, doesn't necessarily have to be installed on the
> >>>> server, and
> >>>
> >>>
> >>> What "server"?
> >>>
> >>> A server is not normally required to run Perl programs.
> >>>
> >>> Is this a stealth CGI question?
> >>
> >> His question was obviously pertaining to Perl being used for a file
> >> parsing solution. The question itself had nothing to do with CGI and
> >> I think you knew that.
> >
> >
> > Yes, I did.
> >
> > But it appeared that the OP did not. Now he does.
>
> What made you think he did not?? Simply because he said "server" some
> how automagically translates into your min into "web server" ? Has it
> even occurred to you he could of simply meant a remote server he has
> been working on? For instance, you SSH or Remote-Desktop/VNC in and you
> work; not exactly a new concept. This can be for any number of purposes,
> and he never said one thing abut www, web, http, nor cgi.
>
> Lets take a look at what he DID say:
>
> samiam(a)mytrashmail.com wrote:
> > Hello,
> >
> > I know this is a trivial parse / grep job for any Perl rake worth his
> > salt,
>
> Hmm, "trivial parse / grep job ", looks right up Perl's alley.
>
> > but does anyone have guidance on how this Perl newbie might pull
> > a string from one file and use this string to pull the lines in
> > another file out, and also pull the first line before (matching
> > criteria) and the first line after (matching criteria.)
>
> Text parsing stuff, still very valid for Perl, don'cha think?
>
> > I have described this in detail below.
> >
> > At first I thought to use VBScript,
>
> VBScript has many applications outside of web scripting. He makes no
> mention of web, http, or cgi so no reason to go there. (See "Scripting
> Host" on Windows.)
>
> > but then I realized that Perl is
> > portable, doesn't necessarily have to be installed on the server, and
> > probably has MUCH better string processing power than VBScript.
>
> In this context
From: Sherm Pendley on
samiam(a)mytrashmail.com writes:

> You are, of course, correct: There is no cgi or Web Server involved in
> this equation. I didn't know "cgi was off limits" or taboo in this
> group. Why is cgi a no-no?

If the answer to your question would be the same if you were writing in
some other language, then it's not a Perl question, and therefore off-
topic here.

A contrived example: "I print some HTML from my Perl CGI. The page renders
fine in FireFox, but not in IE." That's not a Perl question, it's an HTML
question; the answer is "fix the HTML". The fact that the HTML is the
output from a Perl script doesn't make it a Perl question.

Another contrived example: "I'm returning the correct MIME type from my
CGI script, but IE ignores that and parses it as HTML anyway." Once again,
that's not a Perl question, since IE would be doing precisely the same
thing if your CGI were written in Python, Ruby, or whatever.

It isn't just a question of netiquette and/or courtesy either. Understanding
a problem is a critical step in solving it. Quite often, in the process of
narrowing down the exact nature of a bug, in preparation of deciding which
group to ask questions in, I find that I've found the bug myself and don't
need to ask in any group at all.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
From: samiam on
Ahhh...of course. Makes sense. Thanks!

Just to be clear, my question is in fact, strictly a Perl parsing
question :)

L,
S


Sherm Pendley wrote:
> samiam(a)mytrashmail.com writes:
>
> > You are, of course, correct: There is no cgi or Web Server involved in
> > this equation. I didn't know "cgi was off limits" or taboo in this
> > group. Why is cgi a no-no?
>
> If the answer to your question would be the same if you were writing in
> some other language, then it's not a Perl question, and therefore off-
> topic here.
>
> A contrived example: "I print some HTML from my Perl CGI. The page renders
> fine in FireFox, but not in IE." That's not a Perl question, it's an HTML
> question; the answer is "fix the HTML". The fact that the HTML is the
> output from a Perl script doesn't make it a Perl question.
>
> Another contrived example: "I'm returning the correct MIME type from my
> CGI script, but IE ignores that and parses it as HTML anyway." Once again,
> that's not a Perl question, since IE would be doing precisely the same
> thing if your CGI were written in Python, Ruby, or whatever.
>
> It isn't just a question of netiquette and/or courtesy either. Understanding
> a problem is a critical step in solving it. Quite often, in the process of
> narrowing down the exact nature of a bug, in preparation of deciding which
> group to ask questions in, I find that I've found the bug myself and don't
> need to ask in any group at all.
>
> sherm--
>
> --
> Web Hosting by West Virginians, for West Virginians: http://wv-www.net
> Cocoa programming in Perl: http://camelbones.sourceforge.net