]> Pileus Git - vpaste/commitdiff
Add blacklist and more spam checking
authorAndy Spencer <andy753421@gmail.com>
Mon, 7 Jan 2013 05:12:28 +0000 (05:12 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 7 Jan 2013 05:13:38 +0000 (05:13 +0000)
blacklist [new file with mode: 0644]
index.cgi

diff --git a/blacklist b/blacklist
new file mode 100644 (file)
index 0000000..ec208c1
--- /dev/null
+++ b/blacklist
@@ -0,0 +1,5 @@
+^31\.184\.238\.[0-9]*$
+^67\.215\.237\.98$
+^67\.215\.238\.210$
+^91\.232\.96\.28$
+^178\.33\.237\.125$
index 29bdb1d8cdb0cdce662bdd89e60b2d554fcae121..4b587dc4541966806409feb004e5eecd2da9f297 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -153,7 +153,9 @@ function do_upload {
        body=$(cat -)
        spam=$(echo -n "$body" | cut_file "ignoreme")
        text=$(echo -n "$body" | cut_file "(text|x)")
+       bans=$(echo -n "$REMOTE_ADDR" | grep -f blacklist)
        [ ! -z "$spam" ] && message "Spam check.."
+       [ ! -z "$bans" ] && message "You have been banned"
        [   -z "$text" ] && message "No text pasted"
 
        # Format and save message
@@ -162,6 +164,7 @@ function do_upload {
                vim: $(get_modeline)
                Date: $(date -R)
                From: $REMOTE_ADDR
+               User-Agent: $HTTP_USER_AGENT
 
                $text
        EOF
@@ -324,6 +327,7 @@ function do_help {
                                            <a href="htaccess?ft=apache">htaccess</a>
                                            <a href="robots.txt?ft=robots">robots.txt</a>
                                            <a href="sitemap.xml?ft=xml">sitemap.xml</a>
+                                           <a href="blacklist?raw">blacklist</a></dd>
                                        <dt>Patches</dt>
                                        <dd><a href="2html.patch?ft=diff">2html.patch</a></dd>
                                        <dt>Subversion</dt>