Compare commits
10 Commits
Author | SHA1 | Date |
---|---|---|
aewens | 99be0c244d | |
aewens | 81bf0a5cca | |
aewens | b3fd8fdbc0 | |
aewens | be8adb6d7a | |
aewens | 67d781bd7c | |
aewens | 90a03da496 | |
Ben Harris | 42c285a0ff | |
Ben Harris | 315f1bfe24 | |
Ben Harris | f2da85e437 | |
tilde services | 13816f1d80 |
|
@ -1,2 +1,5 @@
|
||||||
__pycache__/
|
__pycache__/
|
||||||
.py[cod]
|
.py[cod]
|
||||||
|
db.sqlite
|
||||||
|
up/
|
||||||
|
*.pyc
|
||||||
|
|
77
fhost.py
77
fhost.py
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python2
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from flask import Flask, abort, escape, make_response, redirect, request, send_from_directory, url_for, Response
|
from flask import Flask, abort, escape, make_response, redirect, request, send_from_directory, url_for, Response
|
||||||
|
@ -46,7 +46,7 @@ app.config["FHOST_MIME_BLACKLIST"] = [
|
||||||
|
|
||||||
app.config["FHOST_UPLOAD_BLACKLIST"] = "tornodes.txt"
|
app.config["FHOST_UPLOAD_BLACKLIST"] = "tornodes.txt"
|
||||||
|
|
||||||
app.config["NSFW_DETECT"] = True
|
app.config["NSFW_DETECT"] = False
|
||||||
app.config["NSFW_THRESHOLD"] = 0.608
|
app.config["NSFW_THRESHOLD"] = 0.608
|
||||||
|
|
||||||
if app.config["NSFW_DETECT"]:
|
if app.config["NSFW_DETECT"]:
|
||||||
|
@ -132,6 +132,12 @@ def is_fhost_url(url):
|
||||||
return url.startswith(fhost_url()) or url.startswith(fhost_url("https"))
|
return url.startswith(fhost_url()) or url.startswith(fhost_url("https"))
|
||||||
|
|
||||||
def shorten(url):
|
def shorten(url):
|
||||||
|
# handler to convert gopher links to HTTP(S) proxy
|
||||||
|
gopher = "gopher://"
|
||||||
|
length = len(gopher)
|
||||||
|
if url[:length] == gopher:
|
||||||
|
url = "https://gopher.tilde.team/{}".format(url[length:])
|
||||||
|
|
||||||
if len(url) > app.config["MAX_URL_LENGTH"]:
|
if len(url) > app.config["MAX_URL_LENGTH"]:
|
||||||
abort(414)
|
abort(414)
|
||||||
|
|
||||||
|
@ -233,6 +239,12 @@ def store_file(f, addr):
|
||||||
return sf.geturl()
|
return sf.geturl()
|
||||||
|
|
||||||
def store_url(url, addr):
|
def store_url(url, addr):
|
||||||
|
# handler to convert gopher links to HTTP(S) proxy
|
||||||
|
gopher = "gopher://"
|
||||||
|
length = len(gopher)
|
||||||
|
if url[:length] == gopher:
|
||||||
|
url = "https://gopher.tilde.team/{}".format(url[length:])
|
||||||
|
|
||||||
if is_fhost_url(url):
|
if is_fhost_url(url):
|
||||||
return segfault(508)
|
return segfault(508)
|
||||||
|
|
||||||
|
@ -341,27 +353,35 @@ def fhost():
|
||||||
if maxsizehalf.is_integer():
|
if maxsizehalf.is_integer():
|
||||||
maxsizehalf = int(maxsizehalf)
|
maxsizehalf = int(maxsizehalf)
|
||||||
|
|
||||||
return """<pre>
|
return """
|
||||||
THE NULL POINTER
|
<html>
|
||||||
================
|
<head>
|
||||||
|
<link rel="stylesheet" href="https://tilde.team/css/hacker.css">
|
||||||
|
<title>0x0.tilde.team</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<h1>THE NULL POINTER</h1>
|
||||||
|
<hr>
|
||||||
|
|
||||||
HTTP POST files here:
|
HTTP POST files here:
|
||||||
curl -F'file=@yourfile.png' {0}
|
<pre>curl -F'file=@yourfile.png' {0}</pre>
|
||||||
You can also POST remote URLs:
|
You can also POST remote URLs:
|
||||||
curl -F'url=http://example.com/image.jpg' {0}
|
<pre>curl -F'url=http://example.com/image.jpg' {0}</pre>
|
||||||
Or you can shorten URLs:
|
Or you can shorten URLs:
|
||||||
curl -F'shorten=http://example.com/some/long/url' {0}
|
<pre>curl -F'shorten=http://example.com/some/long/url' {0}</pre>
|
||||||
|
|
||||||
File URLs are valid for at least 30 days and up to a year (see below).
|
<p>File URLs are valid for at least 30 days and up to a year (see below).
|
||||||
Shortened URLs do not expire.
|
Shortened URLs do not expire.</p>
|
||||||
|
|
||||||
Maximum file size: {1}
|
<p>Maximum file size: {1}</p>
|
||||||
Not allowed: {5}
|
<p>Not allowed: {5}</p>
|
||||||
|
|
||||||
|
|
||||||
FILE RETENTION PERIOD
|
<h3>FILE RETENTION PERIOD</h3>
|
||||||
---------------------
|
|
||||||
|
|
||||||
|
<pre>
|
||||||
retention = min_age + (-max_age + min_age) * pow((file_size / max_size - 1), 3)
|
retention = min_age + (-max_age + min_age) * pow((file_size / max_size - 1), 3)
|
||||||
|
|
||||||
days
|
days
|
||||||
|
@ -385,16 +405,27 @@ retention = min_age + (-max_age + min_age) * pow((file_size / max_size - 1), 3)
|
||||||
30 | ....................
|
30 | ....................
|
||||||
0{2}{3}
|
0{2}{3}
|
||||||
{4}
|
{4}
|
||||||
|
|
||||||
|
|
||||||
ABUSE
|
|
||||||
-----
|
|
||||||
|
|
||||||
If you would like to request permanent deletion, please contact lachs0r via
|
|
||||||
IRC on Freenode, or send an email to lachs0r@(this domain).
|
|
||||||
|
|
||||||
Please allow up to 24 hours for a response.
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
<h3>ABUSE</h3>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<p>If you would like to request permanent deletion, please contact ben or khuxkm via
|
||||||
|
IRC on <a href="https://web.tilde.chat">tilde.chat</a>, or send an email to sudoers@tilde.team.</p>
|
||||||
|
|
||||||
|
<p>Please allow up to 24 hours for a response.</p>
|
||||||
|
|
||||||
|
<h3>UPLOAD DIRECTLY</h3>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<form action="{0}" method="POST" enctype="multipart/form-data">
|
||||||
|
<label for="file">File:</label>
|
||||||
|
<input class="form-control" type="file" name="file"><br><br>
|
||||||
|
<input class="form-control" type="submit" value="Submit">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
""".format(fhost_url(),
|
""".format(fhost_url(),
|
||||||
maxsize, str(maxsizehalf).rjust(27), str(maxsizenum).rjust(27),
|
maxsize, str(maxsizehalf).rjust(27), str(maxsizenum).rjust(27),
|
||||||
maxsizeunit.rjust(54),
|
maxsizeunit.rjust(54),
|
||||||
|
|
Loading…
Reference in New Issue