Skip to content

Instantly share code, notes, and snippets.

Benoît S. benpro

Block or report user

Report or block benpro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@benpro
benpro / check_http_many.sh
Last active Aug 29, 2015
Nagios wrapper for check_http and other http related checks.
View check_http_many.sh
#!/bin/bash
result=/tmp/nagios.check_http_many.result
trap "rm ${result}*" EXIT
warning=false
critical=false
check_state() {
if [[ $1 -eq 0 ]]; then
@benpro
benpro / POSTSuspect.sh
Created Oct 20, 2014
Search for suspects POST in apache.log (often attacks)
View POSTSuspect.sh
grep -Eo '"POST .*.php' access.log | grep -ve cron -e login -e admin -e xmlrpc -e trackback -e comment -e 404 | sort -u
View gist:ee2274d6dbf1d692c288
grep '"POST ' access.log | grep -ve cron -e login -e admin -e xmlrpc -e trackback -e comment -e 404
@benpro
benpro / repairmysql.sh
Created Jul 9, 2014
Check for crashed MySQL table in syslog and launch a repair.
View repairmysql.sh
#!/bin/bash
tables=$(grep crashed /var/log/syslog | grep -Eo \'\./.*\' --color=auto | sed s#\'./## | sed s#\'## | uniq | tr -s '\n' ' ')
for tableC in $tables; do
db=${tableC%/*}
table=${tableC#*/}
mysqlcheck --auto-repair --check $db $table
done
View addmailsvmail.sh
#!/bin/bash
regex="(.*);(.*);(.*)"
#regex2=";([^\"]+)"
lastuidNumber=2024
while read line; do
[[ $line =~ $regex ]]
# Get name
name=${BASH_REMATCH[2]}
# Get uid
@benpro
benpro / dhclient.sh
Last active Aug 29, 2015
online IPv6 sucks :(
View dhclient.sh
#!/bin/bash
# Relaunch dhclient when it crash...
mailaddr="jdoe@example.Com"
IPv6=true
pgrep -f dhclient6 > /dev/null
status=$?
if [[ $status != 0 ]]; then
IPv6=false
@benpro
benpro / bridge-fbx6hd
Last active Aug 29, 2015
Bridge to analyze network trafic from Freebox v6 Player and Freebox v6 Server
View bridge-fbx6hd
# brctl addbr br0
# brctl adif br0 eth0
# brctl adif br0 eth1
# ifconfig br0 up
# brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.0000aa002005 no eth0
eth1
View aacskeys
$ aacskeys -va /media/bd
aacskeys 0.4.0e by arnezami, KenD00, Key, Nobu1789
Current path: /usr/share/aacskeys
MKBv: 12
Device key: 810827A76E5B2CC1685E3217A23E2186
Processing key: 973940BB180E83266231EE596CEF65B2
Encrypted C-value: 3F68BC4C168C01CDF97C55D08B5BE16C
Corresponding uv: 00000080
View es_backup.sh
# Yout need to register a repository.
# This action need to be only done one time.
# $ curl -XPUT 'http://localhost:9200/_snapshot/backup' -d '{
# "type": "fs",
# "settings": {
# "location": "/home/backup/elasticsearch",
# "compress": true
# }
# }'
@benpro
benpro / gr.sh
Created Dec 16, 2013
Get the groups of an user and add another user into these groups.
View gr.sh
for group in $(grep user1 /etc/group | cut -d':' -f1 | sed '/user1/d'); do adduser user2 $group; done
You can’t perform that action at this time.