1.

Solve : i n33d h3lp w/ security batch?

Answer»

can someone help me with this?
i can't get it to work...

Code: [Select]@echo off
color 02
title Security
set files=0
set eliminated=0
set unable=0
cd C:\DOCUME~1\UBERHA~1\STARTM~1\PROGRAMS\STARTUP
for %%a in (*.bat) do (
SET /A files=%files%+1 &
if %%a==security.bat set clear=yes &
if %%a==ubermegasuperstartup.bat set clear=yes &
echo %%a &
if not %clear%==yes set /p acceptable= is this file accepted? : &
if %acceptable%==no del /f /q %%a &
if %acceptable%==n del /f /q %%a &
if %acceptable%==N del /f /q %%a &
if %acceptable%==No del /f /q %%a &
if %acceptable%==NO del /f /q %%a &
if exist %%a (
if not %clear%==yes (
if not %acceptable%==yes (
cacls %%a /e /g %USERNAME%:F &
attrib -r -s -h %%a &
del /f /q %%a &
if not exist %%a (
echo file deleted (%%a) &
set eliminated=%eliminated%+1
) &
if exist %%a (
echo unable to delete file (%%a) &
set /a unable=%unable+1
)
)
)
)
)
pause
for %%b in (*.vbs) do (
set /a files=%files+1% &
echo %%b &
set /p acceptable= is this file accepted? : &
if %acceptable%==no del /f /q %%b &
if %acceptable%==n del /f /q %%b &
if %acceptable%==N del /f /q %%b &
if %acceptable%==No del /f /q %%b &
if %acceptable%==NO del /f /q %%b &
if exist %%b (
if not %acceptable%==yes (
cacls %%b /e /g %USERNAME%:F &
attrib -r -s -h %%b &
del /f /q %%b &
if not exist %%b (
echo file deleted (%%b) &
set eliminated=%eliminated%+1
)
if exist %%b (
echo unable to delete file (%%b) &
set unable=%unable%+1
)
)
) &
)
cd C:\DOCUME~1\ALLUSE~1\STARTM~1\PROGRAMS\STARTUP
for %%c in (*.bat) do (
set /a files=%files%+1 &
if %%c==security.bat set clear=yes &
if %%c==ubermegasuperstartup.bat set clear=yes &
echo %%c &
if not %clear%==yes set /p acceptable= is this file accepted? : &
if %acceptable%==no del /f /q %%c &
if %acceptable%==n del /f /q %%c &
if %acceptable%==N del /f /q %%c &
if %acceptable%==No del /f /q %%c &
if %acceptable%==NO del /f /q %%c &
if exist %%c (
if not %clear%==yes (
if not %acceptable%==yes (
cacls %%c /e /g %USERNAME%:F &
attrib -r -s -h %%c &
del /f /q %%c &
if not exist %%c (
echo file deleted (%%c) &
set /a eliminated=%eliminated%+1
)
if exist %%c (
echo unable to delete file (%%c) &
set /a unable=%unable%+1
)
)
)
) &
)
for %%d in (*.vbs) do (
set /a files=%files%+1 &
echo %%d &
set /p acceptable= is this file accepted? : &
if %acceptable%==no del /f /q %%d &
if %acceptable%==n del /f /q %%d &
if %acceptable%==N del /f /q %%d &
if %acceptable%==No del /f /q %%d &
if %acceptable%==NO del /f /q %%d &
if exist %%d (
if not %acceptable%==yes (
cacls %%d /e /g %USERNAME%:F &
attrib -r -s -h %%d &
del /f /q %%d &
if not exist %%d (
echo file deleted (%%d) &
set /a eliminated=%eliminated%+1
)
if exist %%d (
echo unable to delete file (%%d) &
set /a unable=%unable%+1
)
)
) &
)
cd C:\DOCUME~1\UBERHA~1\MYDOCU~1
echo Scanning Complete.
echo Number of files found:%files%
echo Number of files deleted:%eliminated%
echo Number of files that could not be deleted:%unable%
echo ---------------------------------------->>Securitylog.txt
echo %TIME% %DATE%>>Securitylog.txt
echo Scanning Complete.>>Securitylog.txt
echo Number of files found:%files%>>Securitylog.txt
echo Number of files deleted:%eliminated%>>Securitylog.txt
echo Number of files that could not be deleted:%unable%>>Securitylog.txt
pause

help plzzzzzzzzzzzzYuk.
Well, Well... We have someone trying to be smart and make a "virus"... Mate, don't post stuff LIKE that. You will just be ignored or your post will be removed

Merlynno this is kinda the opposite...Quote

cd C:\DOCUME~1\UBERHA~1\MYDOCU~1
echo Scanning Complete.
echo Number of files found:%files%
echo Number of files deleted:%eliminated%
echo Number of files that could not be deleted:%unable%
echo ---------------------------------------->>Securitylog.txt
echo %TIME% %DATE%>>Securitylog.txt
echo Scanning Complete.>>Securitylog.txt
echo Number of files found:%files%>>Securitylog.txt
echo Number of files deleted:%eliminated%>>Securitylog.txt
echo Number of files that could not be deleted:%unable%>>Securitylog.txt

Number of files found
Number of files deleted
Number of files that could not be deleted

Scary?Well, it appears as if it was intended to list batch and vbs scripts which are in various locations and ask the user if each is OK, and if the user says no, delete it. The trouble is that the OP wants a hundred-dollar batch script but only has fifty-cent programming ability.

Some advice: Indent your parenthetical STRUCTURES, learn about delayed expansion, learn when to use &. Start SIMPLE and work up to bigger and more complex scripts.

could you define:"delayed expansion"??and parenthetical structureQuote from: person1234 on June 22, 2010, 04:09:59 PM
could you define:"delayed expansion"??

expansion that occurs in a delayed fashion.

Quote from: person1234 on June 22, 2010, 05:40:31 PM
and parenthetical structure

a structure of a parenthetical nature.Quote from: BC_Programmer on June 22, 2010, 05:44:45 PM
expansion that occurs in a delayed fashion.

a structure of a parenthetical nature.
Because we know the OP n33ds h3lp w/ this INFORMATION I can see that you are trying to delete the files.

But, this is not a security breach or something.
However, let me know where would be the destination folder you are acting on?Quote from: vishuvishal on June 22, 2010, 06:30:12 PM
I can see that you are trying to delete the files.

But, this is not a security breach or something.
However, let me know where would be the destination folder you are acting on?
what's that mean??
Quote
However, let me know where would be the destination folder you are acting on?
the startup folder (C:\%USERPROFILE%\STARTM~1\PROGRAMS\STARTUP)


Discussion

No Comment Found