Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Creating Install Modules

Douglas Berdeaux edited this page Nov 23, 2022 · 10 revisions

Does your tool require a module? Welp, you can send the info/repo over to (RackunSec@gmail), OR, you could make one yourself! I planted an example install modules here that you can reference. Also, you can reference any other modules that may have similar steps to install as your application.

Install Modules Location

All installation modules are located in ./files/install_modules and are simple Python files.

Classes and Methods

Why reinvent the wheel every time we write a new installation module? By default all of the Summon classes are instantiated in the template install_module.py file. Simply copy this file and work in your copy. If you do not require some of the classes, don;t remove them because they may be used for other operations, such as checking the installation status, etc.

File Operations

  • Downloading Files: files.download_file(uri,path,clobber) -- URI to file, Path to save to, Clobber is a Boolean
  • Unzip Files: files.unzip_file(file,path) -- File name to unzip, path to where it lives

Application Operations

  • Install via Apt: apps.apt_install()
  • Uninstall via Apt: apps.apt_remove(app)
  • Gem Install: apps.ruby_gem_install(["gem1","gem2","etc"])
  • DPKG Install: apps.dpkg_install(deb_file) -- deb_file is the .deb package file.
  • Git Clone: git_clone(uri,path,repo_dir) -- URI to .git (requires .git extension), Path to clone to (requires trailing /), repo_dir is what the repository will be called. This method returns a Boolean for success.

Python Operations

  • PIP Install: python.pip_install(app) -- app short name (pip name)
  • PIP Uninstall: python.pip_uninstall(app) -- app short name (pip name)
  • PIP Install -r Requirements.txt: python.pip_reqs(app,path) -- application name, path to the repository
  • PIP Install .: python.pip_install_dot(path) -- path to the repository
  • Poetry Install: python.poetry_install(path,app) -- Path to the repo, app is just the application name

Command Executions

  • Execute Command: shell.run_cmd(["ls","-l"])

Writing Your Code

Place all of your installation code between the two down and up arrow lines:

    def install(self):
        ## Pre-install checks:
        ## Pre-install checks:
        if self.force: ## we are destroying all old artifacts:
            self.uninstall()
        ## Installation instructions go here:
        ##vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

## CODE GOES HERE

        ##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ## Done. Do not edit below.
        return True

Once done, update this line to contain the location of your binary once installed. This line will be used to "check" if the installation process happened successfully or not and update your local Summon applications repository.

self.install_path_check ="" ## This file will exist when the application is properly installed.

Finally, update the following array of file and folder locations to blow away if the user uses --force during an installation.

self.badpaths=[] ## Destroy local repo (/redteam/(CATEGORY)/repo) and binary in $PATH.

Clone this wiki locally