secgroundzero / warberry

WarBerryPi - Tactical Exploitation
2.22k stars 288 forks source link

Python dependency list #27

Closed ghost closed 8 years ago

ghost commented 8 years ago

For the python dependencies, I would do two things:

Create a requirements.txt with all the python modules needed. This would enable to provide a single python installer command e.g. pip install -r requirements.txt

As was already mentioned by @dyzajash , check python modules at runtime e.g.

python_modules = set(["python-nmap", "netaddr", "ipaddress", "urllib", "urllib2", "requests"])
def check_missing_modules():
    for module in modules:
        try:
            __import__(module)
        except ImportError:
            print_missing(module)
ghost commented 8 years ago

The same can be done for system packages:

  1. Provide a single apt-get install command
  2. Check the packages at runtime
import apt
cache = apt.Cache()
packages = ["nbtscan", "python-scapy", "tcpdump", "nmap", "ppp", "netdiscover", "macchanger"]

def check_missing_packages():
    for package in packages:
        print package
        try:
            if cache[package].is_installed:
                continue
        except KeyError:
                print('%s is NOT installed') % package

check_missing_packages()
secgroundzero commented 8 years ago

Thank you the suggestions. This is something i am looking into and should be done soon.

secgroundzero commented 8 years ago

the above 2 examples will only check for the missing packages not install them correct?

ghost commented 8 years ago

No they will only check them. If you wish to install them I could provide some code, but it is my opinion that the user should be in control and manualy do this. This should not be done in the background.. what do you think?

secgroundzero commented 8 years ago

added both methods for manual and auto installation. thank you