mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
Merge branch 'master' of sametmax-github:sametmax/0bin
This commit is contained in:
commit
abaee22924
@ -1,6 +1,8 @@
|
|||||||
0bin
|
0bin
|
||||||
====
|
====
|
||||||
|
|
||||||
|
Have try here: <a href="0bin.net">0bin.net</a>
|
||||||
|
|
||||||
0bin is client side encrypted pastebin that can run without a database.
|
0bin is client side encrypted pastebin that can run without a database.
|
||||||
|
|
||||||
It allows anybody to host a pastebin while welcoming any type of content to be pasted in it. The idea is that one can (probably...) not be legally entitled to moderate the pastebin content (http://www.zdnet.com/blog/security/pastebin-to-hunt-for-hacker-pastes-anonymous-cries-censorship/11336) as one has no way to decrypt it.
|
It allows anybody to host a pastebin while welcoming any type of content to be pasted in it. The idea is that one can (probably...) not be legally entitled to moderate the pastebin content (http://www.zdnet.com/blog/security/pastebin-to-hunt-for-hacker-pastes-anonymous-cries-censorship/11336) as one has no way to decrypt it.
|
||||||
|
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 122 KiB |
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import math
|
||||||
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
STATIC_FILES_ROOT = os.path.join(ROOT_DIR, 'static')
|
STATIC_FILES_ROOT = os.path.join(ROOT_DIR, 'static')
|
||||||
|
|
||||||
@ -28,4 +29,5 @@ GROUP = None
|
|||||||
|
|
||||||
# limit size of pasted text in bytes. Be carefull allowing too much size can slow down user's
|
# limit size of pasted text in bytes. Be carefull allowing too much size can slow down user's
|
||||||
# browser
|
# browser
|
||||||
MAX_SIZE = 500 * 1000
|
MAX_SIZE = 1024 * 500
|
||||||
|
MAX_SIZE_KB = int(math.ceil(MAX_SIZE / 1024.0))
|
||||||
|
@ -154,14 +154,12 @@ class Paste(object):
|
|||||||
self.expiration = self.expiration + '#%s' % datetime.now()
|
self.expiration = self.expiration + '#%s' % datetime.now()
|
||||||
|
|
||||||
# write the paste
|
# write the paste
|
||||||
try:
|
|
||||||
with open(self.path, 'w') as f:
|
with open(self.path, 'w') as f:
|
||||||
f.write(unicode(self.expiration) + '\n')
|
f.write(unicode(self.expiration) + '\n')
|
||||||
f.write(self.content + '\n')
|
f.write(self.content + '\n')
|
||||||
if self.comments:
|
if self.comments:
|
||||||
f.write(comments)
|
f.write(comments)
|
||||||
except Exception as e:
|
|
||||||
import ipdb; ipdb.set_trace()
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
9
start.py
9
start.py
@ -32,8 +32,7 @@ app = Bottle()
|
|||||||
@app.route('/')
|
@app.route('/')
|
||||||
@view('home')
|
@view('home')
|
||||||
def index():
|
def index():
|
||||||
max_size_kb = int(math.ceil(settings.MAX_SIZE / 1024.0))
|
return {'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB}
|
||||||
return {'max_size': settings.MAX_SIZE, 'max_size_kb': max_size_kb}
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/paste/create', method='POST')
|
@app.route('/paste/create', method='POST')
|
||||||
@ -49,6 +48,10 @@ def create_paste():
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
if content:
|
if content:
|
||||||
|
# check size of the paste. if more than settings return error without saving paste.
|
||||||
|
# prevent from unusual use of the system.
|
||||||
|
# need to be improved
|
||||||
|
if len(content) < settings.MAX_SIZE:
|
||||||
expiration = request.forms.get('expiration', u'burn_after_reading')
|
expiration = request.forms.get('expiration', u'burn_after_reading')
|
||||||
paste = Paste(expiration=expiration, content=content)
|
paste = Paste(expiration=expiration, content=content)
|
||||||
paste.save()
|
paste.save()
|
||||||
@ -89,7 +92,7 @@ def display_paste(paste_id):
|
|||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
abort(404, u"This paste doesn't exist or has expired")
|
abort(404, u"This paste doesn't exist or has expired")
|
||||||
|
|
||||||
return {'paste': paste, 'keep_alive': keep_alive}
|
return {'paste': paste, 'keep_alive': keep_alive, 'max_size': settings.MAX_SIZE, 'max_size_kb': settings.MAX_SIZE_KB}
|
||||||
|
|
||||||
|
|
||||||
@clize.clize
|
@clize.clize
|
||||||
|
@ -259,6 +259,10 @@ button.btn, input[type="submit"].btn {
|
|||||||
top:-4px;
|
top:-4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#alert-template {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
/** Progress bar */
|
/** Progress bar */
|
||||||
|
|
||||||
.progress {
|
.progress {
|
||||||
|
@ -221,6 +221,8 @@ zerobin = {
|
|||||||
},
|
},
|
||||||
message: function(type, message, title, flush, callback) {
|
message: function(type, message, title, flush, callback) {
|
||||||
|
|
||||||
|
$(window).scrollTop(0);
|
||||||
|
|
||||||
if (flush) {$('.alert-'+type).remove()}
|
if (flush) {$('.alert-'+type).remove()}
|
||||||
|
|
||||||
$message = $('#alert-template').clone().attr('id', null)
|
$message = $('#alert-template').clone().attr('id', null)
|
||||||
|
@ -42,9 +42,9 @@
|
|||||||
<a class="brand" href="/"><span>ø</span>bin<em>.net</em></a>
|
<a class="brand" href="/"><span>ø</span>bin<em>.net</em></a>
|
||||||
<div class="nav-collapse">
|
<div class="nav-collapse">
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li class="active"><a href="#">Home</a></li>
|
<li class="active"><a href="/">Home</a></li>
|
||||||
<li><a href="#download">Download 0bin</a></li>
|
<li><a href="https://github.com/sametmax/0bin">Download 0bin</a></li>
|
||||||
<li><a href="#faq">Faq</a></li>
|
<!-- <li><a href="#faq">Faq</a></li> -->
|
||||||
</ul>
|
</ul>
|
||||||
<p class="navbar-text pull-right"><i>"A client side encrypted PasteBin..."</i></p>
|
<p class="navbar-text pull-right"><i>"A client side encrypted PasteBin..."</i></p>
|
||||||
</div><!--/.nav-collapse -->
|
</div><!--/.nav-collapse -->
|
||||||
|
@ -74,4 +74,4 @@
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
||||||
%rebase base
|
%rebase base max_size=max_size
|
||||||
|
Loading…
Reference in New Issue
Block a user