Maybe ... or maybe not: see what a program does beforehand

Discussion in 'all things UNIX' started by summerheat, Nov 5, 2016.

  1. summerheat

    summerheat Registered Member

    Joined:
    May 16, 2015
    Posts:
    2,199
    If you're executing commands like rm, dd, rsync ... or simply a presumably useful script found on some website which you forgot to adjust to your needs, the results can be dramatic. Just one wrong parameter - and you might run into losing important data.

    A nice way how to see beforehand what a program does is the python script maybe. Its usage is simple. Execute

    Code:
    maybe program
    and you'll see what program does to your files without actually doing it. The picture on above github site shows an example. After it shows you what the program does it offers to re-run it without maybe. maybe works by using ptrace to intercept all syscalls concerning the file system.

    On my Fedora system pip was already installed with the python3-pip package. So simply executing

    Code:
    sudo pip install maybe
    was enough to install maybe.

    I haven't tested it thoroughly yet. But in any case, maybe looks very interesting particularly if you write your own scripts or if you use scripts from someone else and want to test them safely.
     
  2. Amanda

    Amanda Registered Member

    Joined:
    Aug 8, 2013
    Posts:
    2,115
    Location:
    Brasil
    This is really good, I think it remoes the need to test on snapshoted VM's. I'll see if I can install it.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.