Script to automatically remove viruses from connected USB devices

Just a few days ago I posted about a script that automatically removes reggeatón from USB devices, a whole controversy has been generated in this regard, specifically on the moral aspect of whether or not it is correct to eliminate a certain type of 'musical' genre from USB devices.

Although the post of the previous script was not to the liking of several, for the matter of whether it is ethical or not to eliminate (discriminate) music for being reggeaton, personally I think that this issue took over the post and it was forgotten a bit (almost completely LOL!) The script and its lines of code as such.

I already said it in the previous post:

By the way, the script as such It's not that I only erase reggeatón, the script will clear whatever the filter matchesIf you want me to delete all the .exe or everything related to (for example) crack or messi, it is a matter of putting it in the filter, it's that simple.

Not even the water 😀

To have a script on our computer that automatically deletes the files autorun.inf (for example), which are almost in all cases malicious files that will run viruses in Windows when connecting the USB would be:

1. Have the script:

Download Script
See Script

2. Give you execute permissions, well doing right-click on it + Permissions tab + marking the option that indicates that it is an executable, or using the terminal with:

chmod +x *.sh

3. Create a file called filter.lst located in the same folder where the previous script is, the content of filter.lst should be:

autorun.inf

4. Ready. Nothing more to add ... the script should be added to the startup applications either by adding it to /etc/rc.local or using the options of your desktop environment.

This is using exactly the same antireggeaton.sh script from the previous post, the one that generated so much controversy 😀

As you can see, the script by itself is not harmful, the script It will only delete what you indicate in filter.lst, they can tell you to delete reggeatón, autorun.inf, .exe files, erotic content folders, etc, whatever they please pla

Anyway there is not much more to add 😉


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   patz said

    why not use crontab instead of an annoying loop?

    1.    KZKG ^ Gaara said

      1. Because the manual cycle can work every 5 seconds, 20 seconds, etc, a much shorter / shorter time than the minimum that crontab allows (1 minute).
      2. Because to write in crontab, you don't need root privileges? . I imagine that if I mention writing in crontab and clarify that administration privileges are needed, some user would complain about the fact of requiring administration privileges to use the script 🙂

      1.    dhunter said

        From "man crontab".

        Crontab is the program used to install, remove or list the tables used to serve the cron (8) daemon. Each user can have their own crontab.

        "Crontab -e" edit the user's cron.

        1.    KZKG ^ Gaara said

          Nice, I didn't know this… I rarely use crontab -e, I just edit the file :)

  2.   davidlg said

    When I was in windows if I don't remember wrong I did this:
    create the autorun.inf file and I don't know if I wrote something in it and then tell it to be read-only

    1.    sieg84 said

      or create a folder with that name (autorun.inf)

  3.   Cala said

    Good good post!

  4.   guillermoz0009 said

    Very good contribution =)

    1.    KZKG ^ Gaara said

      Thanks

  5.   Christopher castro said

    Some autorun serve as portable apps

  6.   George said

    Be careful with deleting the autorun, Claro and Personal 3g modems have one to manage the connection in win (they are modems / pendrive with the drivers and little programs). When I used xp on my pen drives, I created a folder called autorun.inf and hid it. A virus never deleted or settled in years, maybe because the viruses (and this script) had programmed to delete the file with that name and not folders

  7.   Kakashi said

    good both posts !!

    1.    KZKG ^ Gaara said

      Thank you

  8.   ismaf6 said

    The download does not work for me… ??? It will still be possible

    1.    KZKG ^ Gaara said

      It is now fixed, a small permission error in the file.

      1.    Carlos said

        download does not work now 🙂

  9.   Claudio said

    Forbidden

    You don't have permission to access /antireggeaton.sh on this server.

    and I can't download the file!

    1.    eliotime3000 said

      Sign in with sudo or as superuser (or root) and try again.

    2.    KZKG ^ Gaara said

      Ready solved, sorry for the mistake 🙂

  10.   eliotime3000 said

    Until they finally listened to me. It was about time, but it is necessary to add the function of reading autoruns, since many times these autoruns will find the path to execute these annoying viruses.

    1.    KZKG ^ Gaara said

      And how does an autorun evil differ from another who is not? 🙂

      1.    eliotime3000 said

        By the executable it is meant to open. If the autorun is programmed to open a trusted executable, such as a driver installer for a USB modem, then it is allowed. However, if it is programmed to open an executable that is hidden in an invisible folder and / or is accompanied by a file with a strange extension (even with a DLL included), then it is more likely to be a virus.

  11.   miguel.fernandez said

    Forbidden

    You don't have permission to access /antireggeaton.sh on this server.
    Apache Server at http://ftp.desdelinux.net Port 80

    WOW !! I come from ipimtzag.rimed.cu !! LOL !!

    1.    KZKG ^ Gaara said

      Ready, fixed 🙂
      By the way, how about Rimed these days? 😀

  12.   wolvelopez said

    hehehe, the reggetón thing is the cane. Yesterday I had a bad time asking all my colleagues for pen drives and putting them on my computer without them knowing anything ...

  13.   st0rmt4il said

    Surely it will help me in my windows environment

    Thank you!

  14.   Claudio said

    Good. How do I run the script? Also, does someone explain how to add it, from terminal, to startup? I did it graphically but I would like to know how from the console.

  15.   ApprenticeGeek said

    Excuse my ignorance, in linux there is something that allows me to remove the read-only, system and hidden attributes from windows files.

    1.    snack said

      Look at the chattr command.

  16.   msx said

    Erasing reggashitón, cumbia shit and the like is not only ethically and morally CORRECT, it is a duty towards the rest of "thinking" humanity.

    Very good contribution bro.

  17.   e2fletcher said

    I designed a similar one in Python. a little more rudimentary but efficient. Where can I upload it to share and publish it here?

  18.   Daniela Pedrozo said

    give a clear answer…. that you really do not understand anything

  19.   daianis charriz said

    yes, you're right baby

  20.   river said

    Hello; I am inexperienced in Linux and I am starting, can you help me to make a script with these instructions, it is to modify the grub, for the nets that comes by default I start in Linux and I want to modify that it starts with windows, because most use win, and I want to do it in 200 nets.
    It is easier to write a script by usb and execute it. Below I add the lines
    Thank you

    1- We open a terminal:
    "Alt + f2"
    we type «gnome-terminal»
    enter
    2- We use the root user, in Pixart we type «su root», in Ubuntu «sudo -s».
    We type the password and press enter. (when you type the password no
    appears) .- passd student
    3- We make a backup copy of "grub.cfg" which is the file that we are going to edit.
    We type «cp /boot/grub/grub.cfg /boot/grub/grub_original.cfg» we press the
    enter key (if all is well it doesn't complain, note the space between cfg and / boot).
    4- Now we are going to open the configuration file, we type «gedit
    /boot/grub/grub.cfg »and press the enter key (note the space between gedit and
    / boot). Gedit (plain text editor) will open.
    5- We look for the item "set default =" 0 ″ ". Well, you can imagine what goes between
    quotes ... yes! the default option in grub! So, following the example above,
    we should put "set default =" 4 ″ ".
    6- Now we are going to modify the time GRUB waits to start by default.
    We look for the item "set timeout = 10", and we change it to "set timeout = 30".
    7- File-> Save, File-> Exit, and restart the system, directly from the
    terminal «reboot» and press enter,

  21.   dargo said

    For me to delete all the ".lnk", do I just have to use this "* .lnk" as a filter?