Skip to content

Commit

Permalink
started integrating server and website; created tunnels
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkevsterrr committed Nov 20, 2016
1 parent 7b0d903 commit f5ea729
Show file tree
Hide file tree
Showing 30 changed files with 530 additions and 27 deletions.
26 changes: 14 additions & 12 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
CLI = 11
CLI_RESP = 12

BS = AES.block_size
BS = 16
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS)
unpad = lambda s: s[:-ord(s[len(s)-1:])]
unpad = lambda s : s[0:-ord(s[-1])]

replace_seps = lambda m: m.replace("|::|", SEP).replace("!::!", END_SEP)
save_seps = lambda m: m.replace(SEP, "|::|").replace(END_SEP, "!::!")

Expand Down Expand Up @@ -82,7 +83,7 @@ def connect(self):
client.send("%ld" % b)
self.keys[client] = pad("%ld" % ((a ** client_secret) % shared_prime))
client.settimeout(None) # Remove the timeout
self.send(MSG, "PinaColada")
self.send(MSG, "0", "PinaColada")
print("[*] Successfully connected.")
self.receive(client)

Expand Down Expand Up @@ -128,16 +129,16 @@ def get(self, request):
def cli_init(self):
self.cli = pexpect.spawn("sudo python cli.py")
self.cli.expect(re.escape(prompt))
return self.cli.before
return self.cli.before + prompt

def cli_communicate(self, data):
self.cli.sendline(data)
self.cli.expect(re.escape(prompt))
return self.cli.before
return self.cli.before + prompt

def send(self, message_type, data):
def send(self, message_type, requester, data):
#print "SENDING: <%d, %s>" %(message_type, data)
self.socket.send(self.encrypt(self.pack_data(message_type, self.name, data), self.socket))
self.socket.send(self.encrypt(self.pack_data(message_type, requester, data), self.socket))

def encrypt(self, string, sock):
iv = Random.new().read(AES.block_size)
Expand All @@ -163,13 +164,14 @@ def print_msg(self, message):
print message

def handle(self, data):
message_type, name, data = self.unpack_data(data)
message_type, name, d = self.unpack_data(data)
print "DATA FOR CLI: %s" % d
message_type = int(message_type)
print message_type, name, data
print message_type, name, d
if message_type == CLI_INIT:
self.send(CLI_RESP, self.cli_init())
self.send(CLI_RESP, name, self.cli_init())
if message_type == CLI:
self.send(CLI_RESP, self.cli_communicate(data))
self.send(CLI_RESP, name, self.cli_communicate(d))
self.print_msg(data)
####################################################################
#
Expand All @@ -196,4 +198,4 @@ def receive(self, sock):
if os.getuid() != 0:
print BAD + "Please run me as root!"
sys.exit()
c = PinaColadaSocket("Client", SERVER_PORT, SERVER_IP).connect()
PinaColadaSocket("Client", SERVER_PORT, SERVER_IP).connect()
2 changes: 1 addition & 1 deletion core.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def get_available_interfaces(self):
interfaces = ni.interfaces()
available = []
for iface in interfaces:
if ni.AF_INET in ni.ifaddresses(iface) and "lo0" != iface:
if ni.AF_INET in ni.ifaddresses(iface) and "lo" not in iface:
available.append(iface)
return available

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed pinacolada-website/pinacolada_website/__init__.pyc
Binary file not shown.
Binary file not shown.
Binary file removed pinacolada-website/pinacolada_website/views/index.pyc
Binary file not shown.
5 changes: 5 additions & 0 deletions pinacolada_website/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from flask import Flask
app = Flask(__name__)

from pinacolada_website.views import index
app.register_blueprint(index.mod)
Binary file added pinacolada_website/static/background.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions pinacolada_website/static/bootstrap.min.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions pinacolada_website/static/bootstrap.min.js

Large diffs are not rendered by default.

160 changes: 160 additions & 0 deletions pinacolada_website/static/cover.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/*
* Globals
*/

/* Links */
a,
a:focus,
a:hover {
color: #fff;
}

/* Custom default button */
.btn-secondary,
.btn-secondary:hover,
.btn-secondary:focus {
color: #333;
text-shadow: none; /* Prevent inheritance from `body` */
background-color: #fff;
border: .05rem solid #fff;
}


/*
* Base structure
*/

html,
body {
height: 100%;
background-color: #333;
}
body {
color: #fff;
text-align: center;
text-shadow: 0 .05rem .1rem rgba(0,0,0,.5);
}

/* Extra markup and styles for table-esque vertical and horizontal centering */
.site-wrapper {
display: table;
width: 100%;
height: 100%; /* For at least Firefox */
min-height: 100%;
-webkit-box-shadow: inset 0 0 5rem rgba(0,0,0,.5);
box-shadow: inset 0 0 5rem rgba(0,0,0,.5);
}
.site-wrapper-inner {
display: table-cell;
vertical-align: top;
}
.cover-container {
margin-right: auto;
margin-left: auto;
}

/* Padding for spacing */
.inner {
padding: 2rem;
}


/*
* Header
*/

.masthead {
margin-bottom: 2rem;
}

.masthead-brand {
margin-bottom: 0;
}

.nav-masthead .nav-link {
padding: .25rem 0;
font-weight: bold;
color: rgba(255,255,255,.5);
background-color: transparent;
border-bottom: .25rem solid transparent;
}

.nav-masthead .nav-link:hover,
.nav-masthead .nav-link:focus {
border-bottom-color: rgba(255,255,255,.25);
}

.nav-masthead .nav-link + .nav-link {
margin-left: 1rem;
}

.nav-masthead .active {
color: #fff;
border-bottom-color: #fff;
}

@media (min-width: 48em) {
.masthead-brand {
float: left;
}
.nav-masthead {
float: right;
}
}


/*
* Cover
*/

.cover {
padding: 0 1.5rem;
}
.cover .btn-lg {
padding: .75rem 1.25rem;
font-weight: bold;
}


/*
* Footer
*/

.mastfoot {
color: rgba(255,255,255,.5);
}


/*
* Affix and center
*/

@media (min-width: 40em) {
/* Pull out the header and footer */
.masthead {
position: fixed;
top: 0;
}
.mastfoot {
position: fixed;
bottom: 0;
}
/* Start the vertical centering */
.site-wrapper-inner {
vertical-align: middle;
}
/* Handle the widths */
.masthead,
.mastfoot,
.cover-container {
width: 100%; /* Must be percentage or pixels for horizontal alignment */
}
}

@media (min-width: 62em) {
.masthead,
.mastfoot,
.cover-container {
width: 42rem;
}
}
4 changes: 4 additions & 0 deletions pinacolada_website/static/jquery.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions pinacolada_website/static/tether.min.js

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions pinacolada_website/templates/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!doctype html>
<title>Chapter 404: The Lost Page</title>
<style type=text/css>
body, html {
height: 100%;
margin: 0;
padding: 0;
}

body {
background: url({{ url_for('static', filename='ship.png') }}) no-repeat center right;
}

body:after {
content: "";
display: block;
position: absolute;
top: 0;
bottom: 0;
width: 30px;
background: url({{ url_for('static', filename='mask.png') }}) repeat-y left;
}

a { color: #004B6B; }
a:hover { color: #6D4100; }

h1 {
font-family: 'Garamond', 'Georgia', serif;
font-weight: normal;
color: #222;
font-size: 36px;
padding: 50px 0 10px 50px;
margin: 0;
}

p {
font-family: 'Georgia', serif;
color: #000;
font-size: 17px;
padding: 10px 0 0 90px;
margin: 0;
width: 360px;
}
</style>
<h1>Chapter 404: The Lost Page</h1>
<p>A careful and diligent search has been made for the desired page, but it just cannot be found.
<p>And so they returned to <a href=/>familiar waters</a>.
67 changes: 67 additions & 0 deletions pinacolada_website/templates/index/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">

<title>Cover Template for Bootstrap</title>

<!-- Bootstrap core CSS -->
<link href="../../static/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="../../static/cover.css" rel="stylesheet">
</head>
<style>
body {
background: linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), url('../../static/background.gif');
background-repeat: no-repeat;
background-size: cover;
}
</style>
<body>

<div class="site-wrapper">

<div class="site-wrapper-inner">

<div class="cover-container">

<div class="masthead clearfix">
<div class="inner">
<h3 class="masthead-brand">Pi&ntildea Colada</h3>
<nav class="nav nav-masthead">
<a class="nav-link active" href="#">Home</a>
<a class="nav-link" href="#">Features</a>
<a class="nav-link" href="#">Connect to Core</a>
</nav>
</div>
</div>

<div class="inner cover">
<h1 class="cover-heading"></h1>
<p class="lead">Pi&ntildea Colada is the ultimate wifi pineapple. idk what else to put here.</p>
</div>

</div>

</div>

</div>

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha384-THPy051/pYDQGanwU6poAc/hOdQxjnOEXzbT+OuUAFqNqFjL+4IGLBgCJC3ZOShY" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
<script src="../../static/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>
<script src="../../static/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>
Empty file.
11 changes: 11 additions & 0 deletions pinacolada_website/views/index.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from flask import Blueprint, render_template, session, redirect, url_for, \
request, flash, g, jsonify, abort

mod = Blueprint('index', __name__)

@mod.route('/')
def index():
return render_template(
'index/index.html'
)

Loading

0 comments on commit f5ea729

Please sign in to comment.