IP Unique Apache logs

#!/bin/bash

FILE=/usr/local/apache/logs/access_log;
for ip in `cat $FILE |cut -d ' ' -f 1 |sort |uniq`;
do { COUNT=`grep ^$ip $FILE |wc -l`;
if [[ "$COUNT" -gt "10" ]]; then echo "$COUNT:   $ip";
fi }; done

Posted in astuces, bash | Leave a comment

Trouver les fichiers plus grand que 10 Mo

find / -size +10000000c -printf "%15s %pn"
Posted in astuces, linux | Leave a comment

Trouver les fichiers modifiés dans les deux jours

find / -mtime 2 -o -ctime 2
Posted in astuces, bash, linux | Leave a comment

NB SYN SUR UN PORT PARTICULIER

Exemple sur le port 80:

tcpdump -ne dst port 80 and ‘tcp[13] & 2 == 2′

Pratique  pour detecter un SYN FLOOD

Posted in astuces, bash, linux, network, reseau | Leave a comment

STATS NOMBRE DE CONNEXION LINUX

Exemple sur le port 80

netstat -tan | grep ‘:80 ‘ | awk ‘{print $6}’ | sort | uniq -c

Posted in astuces, bash, linux | 1 Comment

ALERTE MAIL DANS /etc/hosts.deny

ALL: ALL :SPAWN echo “Service %d IP %a Utilisateur %c” | /bin/mail -s “Alerte tcpd” user@domain.fr : DENY

Posted in bash | Tagged | Leave a comment

supprimer en masse des signets dans scuttle


DELETE sc_bookmarks,
sc_tags FROM sc_tags,
sc_bookmarks WHERE sc_tags.bId = sc_bookmarks.bId AND sc_tags.tag = "tag_des_signets_à_supprimer"

Posted in astuces | Leave a comment

Liste des paquets installés classés par taille

dpkg-query -W –showformat=’${Installed-Size} ${Package}n’ | sort -n [administration] [bash] [debian] [linux]

Posted in astuces | Leave a comment

Réinitialiser le mot de passe d’un utilisateur mediawiki

UPDATE user SET user_password = MD5(CONCAT(user_id, ‘-’, MD5(‘somepass’))) WHERE user_name = ‘someuser’; [administration] [mediawiki] [mysql]

Posted in astuces | Leave a comment

gestion des routes sous Linux

#ajouter une route par defaut
route add default gw 192.168.0.1

#afficher les routes
route -n

# supprimer une route
route del -net 192.168.0.1/24 [administration] [linux] [reseau] [routage]

Posted in astuces | Leave a comment