Skip to content

Commit

Permalink
Added dependency checker
Browse files Browse the repository at this point in the history
  • Loading branch information
Chan9390 committed Dec 26, 2017
1 parent 9151366 commit 2e1b4d8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions datasploit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env python

import dep_check
dep_check.check_dependency()

import re
import sys
import shutil
Expand Down
21 changes: 21 additions & 0 deletions dep_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pip
import sys

def check_dependency():
list_deps = []
missing_deps = []

with open('requirements.txt') as f:
list_deps = f.read().splitlines()

pip_list = sorted([(i.key) for i in pip.get_installed_distributions()])

for req_dep in list_deps:
if req_dep not in pip_list:
missing_deps.append(req_dep)

if missing_deps:
print missing_deps
print "You are missing a module for Datasploit. Please install them using: "
print "pip install -r requirements.txt"
sys.exit()

0 comments on commit 2e1b4d8

Please sign in to comment.