Essayez d'utiliser un outil Python peut-être qui vous permet de voir ce qui se passe lorsque vous exécutez une commande.
Il semble que vous puissiez vérifier à l'avance les opérations sur les fichiers telles que la création, la suppression, le déplacement et la modification des autorisations en exécutant des commandes.
** Précautions **
That being said, maybe should :warning: NEVER :warning: be used to run untrusted code on a system you care about!
A process running under maybe can still do serious damage to your system because only a handful of syscalls are blocked.
Currently, maybe is best thought of as an (alpha-quality) "what exactly will this command I typed myself do?" tool.
Installer avec pip
# pip install maybe
Ajoutez simplement peut-être
avant d'exécuter la commande
$ maybe COMMAND [ARGUMENT]...
$ ls
file1 file2 file3
** Supprimer le fichier **
$ maybe rm -f ./*
maybe has prevented rm -f ./file1 ./file2 ./file3 from performing 3 file system operations:
delete /home/*******/test/file1
delete /home/*******/test/file2
delete /home/*******/test/file3
Do you want to rerun rm -f ./file1 ./file2 ./file3 and permit these operations? [y/N] y
$
Demande si tu veux vraiment le faire
** Ajouter un répertoire / fichier **
$ maybe mkdir test ;maybe touch test/file1
maybe has prevented mkdir test from performing 1 file system operations:
create directory /home/*******/test/test
Do you want to rerun mkdir test and permit these operations? [y/N] y
maybe has prevented touch test/file1 from performing 1 file system operations:
create file /home/*******/test/test/file1
Do you want to rerun touch test/file1 and permit these operations? [y/N] y
** Démarrer un démon **
# maybe /etc/init.d/docker start
Starting docker:
maybe has prevented /etc/init.d/docker start from performing 26 file system operations:
write 33 bytes to /var/log/docker
create file /root/nohup.out
write 7 bytes to /var/log/docker
write 35 bytes to /var/log/docker
write 1 bytes to /var/log/docker
create file /var/run/docker.pid
write 4 bytes to /var/run/docker.pid
write 91 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 5 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 7 bytes to /root/nohup.out
write 6 bytes to /root/nohup.out
write 7 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
write 1 bytes to /root/nohup.out
Do you want to rerun /etc/init.d/docker start and permit these operations? [y/N]
Recommended Posts