Problem when running script

clive_at_clara.net
Date: 11/17/03

  • Next message: Thor Larholm: "Security researchers organization"
    Date:         Mon, 17 Nov 2003 09:28:41 -0500
    To: NTBUGTRAQ@LISTSERV.NTBUGTRAQ.COM
    
    

    I have a batch file that checks to see which services are running on a
    machine and comapares it with an earlier version to see if there are any
    differences.
    Whilst testing this script I have been running it on my XP box and have
    been experiencing various lockups.

    The batch file below makes the first file ( make sure there exists a gsd331
    dir on your machine first).

    <snip>
    :ServicesRunning
      Echo Checking for running services and writing to
    %systemdrive%\gsd331\PreServices.txt
      echo Services Running > %systemdrive%\gsd331\PreServices.txt
      for /F "tokens=*" %%I in ('%systemdrive%\gsd331\sc query type^=^
    service') do (
                      for /f "tokens=* delims=," %%M in ('echo %%I' ^|^ findstr /I
    "Display_name"') do (
                    echo %%M >> %systemdrive%\gsd331\PreServices.txt
                    echo ^.^
                    )
      )
    </Snip>

    The next batch file makes a similiar file and then compares the two. Try
    stopping a service and you should see it appear as a difference.

    <Snip>
    :ServicesRunning
    Echo Checking running services and writing to
    %systemdrive%\gsd331\PostServices.txt
    echo Services Running > %systemdrive%\gsd331\PostServices.txt
      for /F "tokens=*" %%I in ('%systemdrive%\gsd331\sc query type^=^
    service') do (
                      for /f "tokens=* delims=," %%M in ('echo %%I' ^|^ findstr /I
    "Display_name"') do (
                    echo %%M >> %systemdrive%\gsd331\PostServices.txt
                    echo ^.^
                    )
      )
    echo File written. Checking against %systemdrive%\gsd331\PreServices.txt
    file.

    rem Uses FC.exe to check for differences between the two files. Displays any
    rem differences.
    Echo Comparing.
    Echo.
    rem fc /C /L %systemdrive%\gsd331\PreServices.txt
    %systemdrive%\gsd331\PostServices.txt
    </Snip>

    This seems odd that these two files can cause the machine to grind to a
    halt, but when it has been run a few times, generally 3 or four times, then
    the machine will error. No blue screen and it just appears to hang. I have
    noticed that findstr is left running in task manager but I can't kill it.

    Has anyone seen this sort of behaviour before and have I found a new bug?

    If anyone has a way to get this to work without crashing then I would be
    grateful.

    Clive

    --------------------------------------------------------------------
    mail2web - Check your email from the web at
    http://mail2web.com/ .

    -----
    Marcus Ranum's new book "The Myth of Homeland Security" is now out and
    is available from http://www.amazon.com/ranum In this hard-hitting
    review of the homeland security business, Ranum shows us how the problem
    is vastly harder than it's being made to sound, and how special
    interests, *** covering, and bureaucracy are threatening to derail any
    chance of making progress.
    -----


  • Next message: Thor Larholm: "Security researchers organization"
  • Quantcast