rapid7/metasploit-framework — pull request #629 by alexmaloteaux (2012-07-21 01:58:35+00:00)
Title: Add persistence module for linux and osx

This patch will create a pesistence mixin shared between osx / linux ans win persistence post module.

For Osx , the persistence is done through launchd by adding a crafted plist file in /Users/username/Library/LaunchAgents for normal user or /Library/LaunchDaemons for root. Keepalive is a feature of launchd

For Linux there is 4 differents methods :

1) Crontab : this method is the recommended one and will add a @reboot entry in the user crontab config while keeping previous configuration.
2) Autostart : This method works only if Xorg is detected. For normal user, it will add a desktop file in ~/.config/autostart and for root /etc/xdg/autostart will be used.
3) INIT : This method will add en entry in /etc/rc.local (only root)
4) Profile : This method will add en entry in the user shell profile file (bashrc, zshrc , cshrc ....).

Keepalive is done through a bashscript.