Use ‘maybe’ to See What a Command or Script Will Do, Without Running It

Have you ever worried about what the script or command you are going to run is gonna do to your filesystem? Don’t worry, maybe is here to help you with that. Specially, if you are new to Linux, you are going to like it.

maybe tells you what a script or command does without actually running it

maybe is a small tool that allows you to run a command to see what it does to your filesystem without actually letting it do anything. It will show you a list of operations that was supposed to be performed by that command and then you can decide whether you want to permit those operations or not.

maybe In Action
maybe In Action

maybe is written in python. It uses the python-ptrace library to run the commands under the control of ptrace. In layman’s terms, when maybe is used to run a command, it makes that command believe that it is doing what it is trying to do, while in actuality, all of its operations are blocked and intercepted by maybe and then logged.

So, for example: if you have a long bash script you need to run, you can run it with maybe. And you won’t have to worry about if that script will delete some important directory from your system or do something fishy.

Suggested readEasily Find Bugs In Shell Scripts With ShellCheck

Is maybe Completely Safe?

The developer of maybe, Philipp Emanuel Weidmann, doesn’t claim that it is completely safe to run anything with maybe. In fact, he claims very little. In his words,

Currently, maybe is best thought of as an (alpha-quality) “what exactly will this command I typed myself do?” tool.

So, you should never use maybe to run untrusted code on your primary machine. Because maybe might not be able to block all the operations that the command you are trying to run performs. Thus, some of those operations can still do serious damage to your system even after running with maybe.

Installation on Ubuntu

For installing maybe, you will need a Python environment set up on your system with the pip command available.

Now, for installing maybe, use the following command:

pip install maybe

That’s all. You should be ready to use maybe.

So, what do you think about maybe? Let us know!

Source

Leave a Reply