#!/usr/bin/python

import os, subprocess
import sys, traceback
import struct, time

#---------------------------------------------------------Installation Functions---------------------------------------------------------#

def intallAll():
	cmd = os.system("apt-get install -y wget git curl")
	cmd = os.system("apt-get install -y gqrx-sdr aircrack-ng sqlmap arduino wireshark sslstrip nmap hping3 amap-align kismet reaver cutycapt binwalk john proxychains apktool nikto ettercap-graphical etherape netdiscover driftnet netcat bkhive ophcrack hydra dsniff wifite foremost galleta guymager p0f volatility funkload slowhttptest sslsplit btscanner wifite samdump2 macchanger")
	armitage()
	beef()
	bluelog()
	bluemaho()
	bluepot()
	blueranger()
	burpsuite()
	casefile()
	dirbuster()
	evilgrade()
	exploitdb()
	faraday()
	fern()
	fierce()
	findmyhash()
	hashcat()
	libnfc()
	maltego()
	metasploit()
	mfcuk()
	mfdread()
	mfok()
	pixieWPS()
	reconNG()
	setoolkit()
	theharvester()
	webshells()
	websploit()
	wifihoney()
	wpscan()
	time.sleep(2)

def armitage():
	cmd = os.system("apt-get install -y wget")
	cmd = os.system("wget \"http://www.fastandeasyhacking.com/download/armitage150813.tgz\" -O Armitage.tgz")
	cmd = os.system("tar -xvzf Armitage.tgz")
	cmd = os.system("sudo mv armitage /opt/metasploit")
	cmd = os.system("sudo chmod +x /opt/metasploit/armitage")
	cmd = os.system("rm -rf Armitage.tgz")
	armitage = open("/usr/bin/armitage", "a+")
	armitage.write("java -XX:+AggressiveHeap -XX:+UseParallelGC -jar /opt/metasploit/armitage.jar $@")	
	armitage.close()
	cmd = os.system("chmod +x /usr/bin/armitage")
	time.sleep(2)

def beef():
	#Install Requeriments
	cmd = os.system("apt-get install curl git build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev autoconf libc6-dev libncurses5-dev automake libtool bison subversion")
	cmd = os.system("bash < <(curl -sk https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)")
	cmd = os.system("echo '[[ -s \"$HOME/.rvm/scripts/rvm\" ]] && . \"$HOME/.rvm/scripts/rvm\"' >> ~/.bashrc")
	cmd = os.system("source ~/.bashrc")
	cmd = os.system("source $HOME/.rvm/scripts/rvm")
	cmd = os.system("rvm install 1.9.2")
	cmd = os.system("rvm use 1.9.2 --default")
	#Install BeEF
	cmd = os.system("git clone git://github.com/beefproject/beef.git /usr/share/beef")
	cmd = os.system("cd /usr/share/beef && gem install bundler")
	cmd = os.system("cd /usr/share/beef && bundle install")
	#beef = open("/usr/bin/beef", "a+")
	#beef.write("cd /usr/share/beef/ && ./beef")
	#beef.close()
	#cmd = os.system("chmod +x /usr/bin/beef")
	print "Beef-XSS has been successfully installed on /usr/share/beef"
	time.sleep(2)

def bluelog():
	cmd = os.system("apt-get install -y git libbluetooth-dev")
	cmd = os.system("git clone https://github.com/MS3FGX/Bluelog.git /usr/share/bluelog")
	cmd = os.system("make -C /usr/share/bluelog")
	cmd = os.system("ln -s /usr/share/bluelog/bluelog /usr/bin/bluelog")
	time.sleep(2)
	
def bluemaho():
	cmd = os.system("apt-get install -y git")
	cmd = os.system("git clone git://git.kali.org/packages/bluemaho.git /usr/share/bluemaho")
	print "Bluemaho has been successfully installed on /usr/share/bluemaho"
	time.sleep(2)
	
def bluepot():
	cmd = os.system("apt-get install -y git")
	cmd = os.system("git clone git://git.kali.org/packages/bluepot.git /usr/share/bluepot")
	bpot = open("/usr/bin/bluepot", "a+")
	bpot.write("sudo java -jar /usr/share/bluepot/bluepot.jar")
	bpot.close()
	cmd = os.system("chmod +x /usr/bin/bluepot")
	time.sleep(2)

def blueranger():
	cmd = os.system("apt-get install -y git")
	cmd = os.system("git clone git://git.kali.org/packages/blueranger.git /usr/share/blueranger")
	cmd = os.system("chmod +x /usr/share/blueranger/blueranger.sh")
	cmd = os.system("ln -s /usr/share/blueranger/blueranger.sh /usr/bin/blueranger")
	time.sleep(2)
	
def burpsuite():
	cmd = os.system("apt-get install -y curl")
	cmd = os.system("curl https://portswigger.net/DownloadUpdate.ashx?Product=Free -o burpsuite_free.jar")
	cmd = os.system("mkdir /usr/share/burpsuite && mv burpsuite_free.jar /usr/share/burpsuite")
	burp = open("/usr/bin/burpsuite", "a+")
	burp.write("java -jar -Xmx1024m /usr/share/burpsuite/burpsuite_free.jar")
	burp.close()
	cmd = os.system("chmod +x /usr/bin/burpsuite")
	time.sleep(2)

def casefile():
	cmd = os.system("apt-get install -y wget")
	cmd = os.system("wget \"https://www.paterva.com/malv41/maltego_v4.1.0.10552.deb\" -O Casefile.deb")
	cmd = os.system("dpkg -i Casefile.deb")
	cmd = os.system("rm -rf Casefile.deb")
	time.sleep(2)

def dirbuster():
	cmd = os.system("apt-get install -y wget")
	cmd = os.system("wget \"http://downloads.sourceforge.net/project/dirbuster/DirBuster%20%28jar%20%2B%20lists%29/1.0-RC1/DirBuster-1.0-RC1.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fdirbuster%2Ffiles%2FDirBuster%2520%2528jar%2520%252B%2520lists%2529%2F1.0-RC1%2F&ts=1370262745&use_mirror=nchc\" -O DirBuster.tar.bz2")
	cmd = os.system("tar -xjvf DirBuster.tar.bz2")
	cmd = os.system("mv DirBuster-1.0-RC1 /usr/share/dirbuster")
	cmd = os.system("rm DirBuster.tar.bz2")
	dirbust = open("/usr/bin/dirbuster", "a+")
	dirbust.write("java -Xmx256M -jar /usr/share/dirbuster/DirBuster-1.0-RC1.jar")
	dirbust.close()
	cmd = os.system("chmod +x /usr/bin/dirbuster")
	time.sleep(2)

def evilgrade():
	cmd = os.system("apt-get install -y git librpc-xml-perl libdata-dump-perl")
	cmd = os.system("git clone https://github.com/infobyte/evilgrade /usr/share/evilgrade")
	cmd = os.system("chmod +x /usr/share/evilgrade/evilgrade")
	dirbust = open("/usr/bin/evilgrade", "a+")
	dirbust.write("cd /usr/share/evilgrade/ && ./evilgrade")
	dirbust.close()
	cmd = os.system("chmod +x /usr/bin/evilgrade")
	time.sleep(2)

def exploitdb():
	cmd = os.system("apt-get install -y git")
	cmd = os.system("git clone git://git.kali.org/packages/exploitdb.git /usr/share/exploitdb")
	cmd = os.system("ln -s /usr/share/exploitdb/searchsploit /usr/bin/searchsploit")
	time.sleep(2)

def faraday():
	cmd = os.system("apt-get install -y git python-pip curl sudo")
	cmd = os.system("git clone https://github.com/infobyte/faraday.git /usr/share/faraday-dev")
	cmd = os.system("cd /usr/share/faraday-dev && ./install.sh")
	cmd = os.system("cd /usr/share/faraday-dev && ./faraday-server.py")
	srv = open("/lib/systemd/system/python-faraday.service", "w+")
	srv.write('''ice
[Unit]
Description=python-faraday Server
Requires=couchdb.service
After=couchdb.service

[Service]
Type=simple
ExecStart=/usr/share/python-faraday/faraday-server.py

[Install]
WantedBy=multi-user.target
''')
	srv.close()
	far = open("/usr/share/faraday-dev/python-faraday", "w+")
	far.write('''#!/bin/sh
systemctl start python-faraday
sleep 3
cd /usr/share/python-faraday && ./faraday.py "$@"
systemctl stop python-faraday
''')
	far.close()
	cmd = os.system("cp /usr/share/faraday-dev/python-faraday /usr/bin/python-faraday")
	cmd = os.system("chmod +x /usr/bin/python-faraday")
	#cmd = os.system("ln -s \"/usr/share/faraday-dev/faraday.py\" /usr/bin/faraday")
	#user = os.system("who -H | sed \'1d\' | cut -d \" \" -f 1")
	#user = subprocess.check_output("who -H | sed \'1d\' | cut -d \" \" -f 1", shell=True) #Obtiene el nombre de Usuario que se logueo
	#user = user.replace('\n', '').replace('\r', '')
	#cmd = os.system("cp /usr/share/python-faraday/python-faraday /usr/bin/python-faraday")
	#cmd = os.system("cp /usr/share/python-faraday/python-faraday.service /lib/systemd/system/python-faraday.service")
	#cmd = os.system("mv /home/%s/faraday/install.sh /usr/share/python-faraday" % user)
	time.sleep(2)

def fern():
	cmd = os.system("apt-get install -y python-qt4 macchanger xterm aircrack-ng subversion
 python-scapy")
	cmd = os.system("git clone https://github.com/savio-code/fern-wifi-cracker.git /usr/share/Fern-wifi-cracker")
	cmd = os.system("mv /usr/share/Fern-wifi-cracker/Fern-Wifi-Cracker /usr/share/fern-wifi-cracker/")
	cmd = os.system("rm -rf /usr/share/Fern-wifi-cracker")
	tim
e.sleep(2)

def fierce():
	cmd = os.system("apt-get install -y git python3-pip")
	cmd = os.system("sudo cpan -i Net::DNS")
