Code Monkey home page Code Monkey logo

pipper's Introduction

Pipper

What is Pipper?

Pipper is a simple Python module useful to easily install missing imported libraries through pip without having to do it manually.


Features

  • Works with Windows, Linux and OS X
  • Automatic operating system recognition
  • Automatic retrieving of pip executable's path
  • Automatic installation of pip if it is not already installed

Usage

from pipper import pip_install_module

try:
  import module_name
except:
  pip_install_module("module_name")

Examples of use

Very basic example
from pipper import pip_install_module

try:
  import requests
except:
  pip_install_module("requests")
  import requests
More sophisticated example considering you have not downloaded pipper yet
import sys
import urllib
import subprocess

def download(file_url,local_filename):
	web_file = urllib.urlopen(file_url)
	local_file = open(local_filename, 'w')
	local_file.write(web_file.read())
	web_file.close()
	local_file.close()

def solve_dependencies(module_name,download_url=None):
	try:
		from pipper import pip_install_module
	except:
		print "[!] pipper not found in the current directory.. Downloading pipper.."
		download("https://raw.githubusercontent.com/D35m0nd142/Pipper/master/pipper.py","pipper.py")
		from pipper import pip_install_module

	if(download_url is not None):
		print "\n[*] Downloading %s from '%s'.." %(module_name,download_url) 
		download(download_url,module_name)
		if(sys.platform[:3] == "win"): # in case you are using Windows you may need to install an additional module
			pip_install_module("win_inet_pton")
	else:
		pip_install_module(module_name)
    
try:
	import requests
except:
	solve_dependencies("requests")
	import requests
  
try:
	import socks
except:
	solve_dependencies("socks.py","https://raw.githubusercontent.com/D35m0nd142/LFISuite/master/socks.py")
	import socks

Dependencies

  • Python 2.7.x
  • Python extra modules: urllib, subprocess

Author: D35m0nd142
Follow me: https://twitter.com/d35m0nd142

pipper's People

Contributors

d35m0nd142 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.