Projet

Général

Profil

Actions

Privatebin » Historique » Révision 10

« Précédent | Révision 10/39 (diff) | Suivant »
sacha, 15/01/2021 10:27


Privatebin

A la mode du moment (janvier 2021) on a des liens de contenus pédophiles postés sur le Privatebin/Pastebin/Paste, j'ai fait un petit script pour gérer le problème.

Pour retirer un contenu je vous propose d'utiliser le script sur le serveur qui héberge le Privatebin: gaia:/root/pedokill.sh

Les url de privatebin ressemblent à: https://pastebin.aquilenet.fr/?ASH#PASSWORD
exemple: https://pastebin.aquilenet.fr/?abe546d271f749b1#E8Zu84zJUPjFLmzgC3Hg5iJL38WDRfGcAJLxW6XC6DG6

Pour utiliser le script il suffit de l’exécuter avec en paramètre le ASH#PASSWORD.
Exemple: /root/pedokill abe546d271f749b1#E8Zu84zJUPjFLmzgC3Hg5iJL38WDRfGcAJLxW6XC6DG6

N'hésitez pas à me (Sacha) tenir au jus des améliorations ;)

Une idée est de dégager la première ligne de log qui est celle de l'émetteur du contenu.

J'ai identifiée un motif identique qui est le referer 4ox.fun (je ne vous conseille pas de visiter le site) et ajouté dans l'apache du privatebin (en espérant que ça bloquera bien ce referer):

        # Block pedosite
        RewriteEngine on
        RewriteCond %{HTTP_REFERER} 4ox.fun|.*nowhere [NC]
        RewriteRule .* - [F]

J'ai fait le ménage en utilisant ce referer:

for i in $(zgrep 4ox.fun /var/log/apache2/pastebin.aqln.access.log* |awk '{print $7}'|sort|uniq); do /root/pedokill.sh $i;done

(c'est bugé il y a des réponses qui n'ont pas le chemin mais du coup le pad ne sera pas effacé puisqu'il n'existe pas, le script vérifie que le chemin existe)

et vérifie s'il y en a de nouveaux:

tail -F /var/log/apache2/pastebin.aqln.access.log |grep 4ox.fun |awk '{if ($9 =="200") print $7} '

/root/pedokill.sh

#!/bin/bash

# pedokill.sh
# ------------
# Sacha@Aquilenet 20210115
# Archive et supression d'un lien Privatebin

privatebinpath="/srv/www/aquilenet.fr/PrivateBin/data"

if [ -z "$1" ];  then
        echo "Entrer le hash après \"https://pastebin.aquilenet.fr/?\" "
exit 1
fi

ash=$(echo $1|cut -d# -f1)
pass=$(echo $1|cut -d# -f2)
pagepath="$privatebinpath/${ash:0:2}/${ash:2:2}/$ash.php"

if [ -f $pagepath ]; then
        echo "Archive du lien et logs d'accès"
        archivepath="$privatebinpath/archive/$ash"
        mkdir -p $archivepath/{logs,privatebin_file}
        cp $pagepath $archivepath/privatebin_file
        echo $pass > $archivepath/privatebin_file/pass
        zgrep $ash /var/log/apache2/pastebin.aqln.access.log* > $archivepath/logs/$ash.log
        cd $archivepath/logs/ && tar czvf $(date +"%Y%m%d-%H%M")_$ash.tar.gz $archivepath/logs/$ash.log
        rm -f $archivepath/logs/$ash.log

        echo "Efface le lien PasteBin: \"https://pastebin.aquilenet.fr/?$ash\""
        rm -f $pagepath && rdmdir $privatebinpath/${ash:0:2}/${ash:2:2}
else
        echo "Mauvais lien !"
fi

Mis à jour par sacha il y a environ 3 ans · 10 révisions