RE: Some dangerous codes in .bat 03-01-2012, 06:24 PM
#4
They're not really dangerous, I would say they're just annoying. The first one creates just a bunch of folders, which isn't really harmful to the system. First, you would need insane amount of folders to fill up the whole drive and even if you did, it doesn't hurt the system really, you just delete them and everything is back to normal. Making tons of folders is probably as dangerous, as trying to destroy a building by throwing sheets of A4 sized paper on it.
Additionally, the code isn't really good, it contains a lot of repetition: remember, repeating and duplicating portions code is bad, it should be designed to be generic and allow to be reused, which makes it both simpler, easier to manage and look better. I suggest looking up and learning about a FOR loop, if you want to repeat some code a specified amount of times.
Also, you don't need to put "@" before every echo command, by using "@echo off" you basically tell it that you don't want to print any of the following commands, only their outputs, so it's kind of pointless to use "@echo off" and then manually suppress it for almost all commands anyway.
Second is a bit worse, since it deletes some files (it doesn't really infect anything, it just replaces the file with the script, which is not infecting. Infecting would be if it would embedded itself into the original file, so it would be launched secretly whenever the original file is launched), but you can recover deleted files if you do it right away or recover it from a backup if you have one.
And same with adding many new users. You can always remove them, it's even easy if you use a timestamps when they were added. Simply delete all users that were added after certain date, which will be basically when the script was run.
So no, they are not really dangerous, what they do can be reversed, in some cases quite easily, so they're rather annoying. To make something really dangerous, you need to dig more into the system and options that are there and find stuff you can exploit and that's difficult to restore back.
Additionally, the code isn't really good, it contains a lot of repetition: remember, repeating and duplicating portions code is bad, it should be designed to be generic and allow to be reused, which makes it both simpler, easier to manage and look better. I suggest looking up and learning about a FOR loop, if you want to repeat some code a specified amount of times.
Also, you don't need to put "@" before every echo command, by using "@echo off" you basically tell it that you don't want to print any of the following commands, only their outputs, so it's kind of pointless to use "@echo off" and then manually suppress it for almost all commands anyway.
Second is a bit worse, since it deletes some files (it doesn't really infect anything, it just replaces the file with the script, which is not infecting. Infecting would be if it would embedded itself into the original file, so it would be launched secretly whenever the original file is launched), but you can recover deleted files if you do it right away or recover it from a backup if you have one.
And same with adding many new users. You can always remove them, it's even easy if you use a timestamps when they were added. Simply delete all users that were added after certain date, which will be basically when the script was run.
So no, they are not really dangerous, what they do can be reversed, in some cases quite easily, so they're rather annoying. To make something really dangerous, you need to dig more into the system and options that are there and find stuff you can exploit and that's difficult to restore back.
I love creativity and creating, I love science and rational thought, I am an open atheist and avid self-learner.




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)