#23996 - 2002-06-27 09:21 PM
Kixtart script to read xx lines in
|
WirelessDJ
Fresh Scripter
Registered: 2002-03-29
Posts: 12
|
I have been using a utilty called Dumpsec.exe it is wonderful for NT security audits. One task I have at hand is to dump every user account on every server I have.
Well I have been able to do that, but the output is another story. I need a kixtart script to be able to read in "Fixed width columns" (not comma or tab delimite). Does anyone know how to do this?
USERID Row 1-19 FullName Row 20-44 description Row 45-??
Ideally it would be nice to open the text file, read these in from a text file, and compare them to a variable
if $userID = Administrator then ... if $FullName = Jenny then ... etc
Any ideas how do this with kix 4?
Thank you ahead of time for the response
|
|
Top
|
|
|
|
#23998 - 2002-06-27 09:36 PM
Re: Kixtart script to read xx lines in
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
If you want a comma delimited output of domain accounts, quick and easy checkout DumpDomain.exe [ 27 June 2002, 21:36: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#23999 - 2002-06-27 09:58 PM
Re: Kixtart script to read xx lines in
|
WirelessDJ
Fresh Scripter
Registered: 2002-03-29
Posts: 12
|
I would love to use DumpDomain, but we are not allowed to use *any* utilities unless they are already in-house or custom written. It's nutz, but I have gotten use to it. Actually, I just thought of something
Kixtart can't read text files over 64K?
some of my files are 5MB in size!
|
|
Top
|
|
|
|
#24000 - 2002-06-27 10:08 PM
Re: Kixtart script to read xx lines in
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Well I can "customize" it for you.
|
|
Top
|
|
|
|
#24001 - 2002-06-27 10:12 PM
Re: Kixtart script to read xx lines in
|
WirelessDJ
Fresh Scripter
Registered: 2002-03-29
Posts: 12
|
Howard, I really appreciate the offer but the place I work at has extremely strict rules. it takes them months to adopt new software, and even when they do, it has to go through tons of testing.
Guys, should I give up trying to use kixtart to do this task?
"It's amazing what you can accomplish with NOTHING"
|
|
Top
|
|
|
|
#24002 - 2002-06-27 10:14 PM
Re: Kixtart script to read xx lines in
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
I have never opened such a large file with KiXtart. You could use COM to access the FileSystemObject from Kixtart. Do a search on the board for "FileSystemObject".
|
|
Top
|
|
|
|
#24003 - 2002-06-27 10:21 PM
Re: Kixtart script to read xx lines in
|
WirelessDJ
Fresh Scripter
Registered: 2002-03-29
Posts: 12
|
What do you mean? use COM to access the FileSystemObject from Kixtart to dump the users from the servers or to open the files that I have already dumped?
Kixtart would work if I had a way to dump all users on each server FROM a kix script. But I don't have any clue how that would be accomplished.
|
|
Top
|
|
|
|
#24004 - 2002-06-27 10:22 PM
Re: Kixtart script to read xx lines in
|
WirelessDJ
Fresh Scripter
Registered: 2002-03-29
Posts: 12
|
What do you mean? use COM to access the FileSystemObject from Kixtart to dump the users from the servers or to open the files that I have already dumped?
Kixtart would work if I had a way to dump all users on each server FROM a kix script. But I don't have any clue how that would be accomplished.
|
|
Top
|
|
|
|
#24005 - 2002-06-27 10:27 PM
Re: Kixtart script to read xx lines in
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
You can use COM+ADSI to dump the users from a SAM database. There are many examples of that on the board. Or you can use COM and the FileSystemObject to open and read the files you already have.
|
|
Top
|
|
|
|
#24006 - 2002-06-28 12:00 AM
Re: Kixtart script to read xx lines in
|
kholm
Korg Regular
   
Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
|
Wireless, Don't give up Read the dumpfile line by line and split the lines like this:
code:
$RC = Open(1,'Dumpfile.txt') $Line = ReadLine(1) While @Error = 0 $UserID = Trim(Left($Line, 19)) $FullName = Trim(SubStr($Line,20,24)) $Description = SubStr($Line,45) ; Your code here : if $userID = Administrator then ... if $FullName = Jenny then ... $Line = ReadLine(1) Loop $RC = Close(1)
-Erik
|
|
Top
|
|
|
|
#24007 - 2002-06-28 12:05 AM
Re: Kixtart script to read xx lines in
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Kholm, have used KiXtart to open and Readline 5MB files like Wireless has? If so, how does it perform? [ 28 June 2002, 00:14: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#24009 - 2002-06-28 03:38 PM
Re: Kixtart script to read xx lines in
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Hmm. just thinking... wondering if you could use the WSHPipe method to pass lines of text to KiXtart...
Brian
|
|
Top
|
|
|
|
#24010 - 2002-06-28 04:16 PM
Re: Kixtart script to read xx lines in
|
WirelessDJ
Fresh Scripter
Registered: 2002-03-29
Posts: 12
|
kholm,
that script seems to be reading a 5.5 mb file! I have to check to see incase it blows up at the end
What about trailing spaces??
if the user ID is
"JOE" and the text file shows "JOE " then it will not match
|
|
Top
|
|
|
|
#24011 - 2002-06-28 04:20 PM
Re: Kixtart script to read xx lines in
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
That's when you use Rtrim(). Have you thought about using Kixtart to create your data files instead of just parsing them? that way you can create them anyway you desire.
|
|
Top
|
|
|
|
#24012 - 2002-06-28 08:04 PM
Re: Kixtart script to read xx lines in
|
WirelessDJ
Fresh Scripter
Registered: 2002-03-29
Posts: 12
|
I would prefer to use kixtart to create the data files. but from what I understand, you need ADSI installed in order to query a server?
|
|
Top
|
|
|
|
#24014 - 2002-06-28 09:08 PM
Re: Kixtart script to read xx lines in
|
WirelessDJ
Fresh Scripter
Registered: 2002-03-29
Posts: 12
|
so then where do I get this to install on an NT 4 workstation?
|
|
Top
|
|
|
|
#24015 - 2002-06-28 09:32 PM
Re: Kixtart script to read xx lines in
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Link:ADSI [ 28 June 2002, 22:12: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 641 anonymous users online.
|
|
|