Skip to content

Instantly share code, notes, and snippets.

💭
Gone fishing!

Mathieu Aubin mathieu-aubin

💭
Gone fishing!
Block or report user

Report or block mathieu-aubin

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
@mathieu-aubin
mathieu-aubin / grabua.sh
Last active Jun 13, 2019
Grab User-Agents from access logs with typical structure
View grabua.sh
#!/usr/bin/env bash
zcat /var/log/*/access.log*.gz | grep -v 'robots.txt' | awk -F\" '($2 ~ "^GET /"){print $6}' | \
grep -Eiv "^-$|^$|Wordpress|WOW|Wget|Curl|WhatsApp|Twitter|GoogleBot|AdsBot|Baidu|Crawl|TurnitinBot|random|knowledge|smurl|thither|urlcheck|Traackr|Spider|^Z$|Zoom|chr\(|test|scrapy|ruby|SafeDNS|Research|Whatweb|semrush|seobility|slack|scan|yahoo|requests|reqwest|queue|serende|yakuza|zmeu|zoxh|xenu|semantic|siri|tagvisit|wapp|p40|PHP|cfnetwork|Pattern|python|seeker|scamadviser|\\x|pinterest|Pocket|thumbor|photon|null|okhttp|panscient|pa11y|OnalyticaBot|fetch|my_linux|powered|node\.js|newspaper|zgrab|gnowit|gzip|lighthouse|Datanyze|7777|MAUI|J2ME|seznam|proxy|detection|libwww|survey|hakai|nmap|go-http-client|PROBT|Nimbostratus|^Mozilla\/[[:digit:]].[[:digit:]][[:digit:]]?$|5.01682558|Mozilla\/5.0 Mozilla\/5.0|Zend|user-agent|symfony|poster|Writter|Rome|project25499|SMTB|^Mozilla [[:digit:]].[[:digit:]]|^Mozilla\/[[:digit:]].[[:digit:]]$|^Mozilla$|WebDav|Ahrefs|aiHitBot|CloudFlare|Dataprovider|
View mysql_export_users.sh
#!/bin/bash
SQLLOGIN='root';
SQLPWD='PASSWORD';
FINAL_SQL_FILE='mysql-exported_users.sql';
UHEADTMP=$(mktemp -t mysqltmp_uheader_XXXXXXX);
USRTMP=$(mktemp -t mysqltmp_usr_XXXXXXX);
USRGRTMP=$(mktemp -t mysqltmp_usrgr_XXXXXXX);
@mathieu-aubin
mathieu-aubin / url-endecode.sh
Created Feb 5, 2019
url encoding and decoding in bash
View url-endecode.sh
#!/bin/bash
url-encode ()
{
if [[ ! -z ${2} || -z ${1} ]]; then
echo "error: this command needs one and only one value";
echo " enclose spaces or special chars with quotes";
return 1;
fi;
local string strlen encoded pos proto c o;
View perlbrew-completion.bash
if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit
fi
export PERLBREW="command perlbrew"
_perlbrew_compgen() {
COMPREPLY=( $($PERLBREW compgen $COMP_CWORD ${COMP_WORDS[*]}) )
}
complete -F _perlbrew_compgen perlbrew
@mathieu-aubin
mathieu-aubin / c7repos.sh
Last active Jun 28, 2018
Centos 7 basic repository installation (C7Repos)
View c7repos.sh
#!/bin/bash
bash <(curl -4sLk https://bit.ly/c7repos)
# Deprecated -- use the gitHUB repository instead
@mathieu-aubin
mathieu-aubin / lowsrc.js
Created Jun 11, 2017 — forked from takien/lowsrc.js
Alternate to lowsrc. usage: <img src="lowres.jpg" data-src="highres.jpg" />
View lowsrc.js
/**
* Laod large image at last.
* requires jQuery
* @author: takien
*/
jQuery(document).ready(function($){
$('img').each(function(){
var hires = $(this).data().src;
if((hires != undefined) && (hires != '')){
$(this).attr('src',hires);
@mathieu-aubin
mathieu-aubin / qstats
Last active Nov 12, 2018
Bash QuickStats
View qstats
#!/bin/bash
#
# qstats (bash QuickStats)
#
# Copyright 2017 Mathieu Aubin <mathieu@zeroserieux.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
@mathieu-aubin
mathieu-aubin / redir.sh
Created Nov 13, 2016 — forked from bertjwregeer/redir.sh
Simple script that prints a list of redirects, and what the final HTTP result was...
View redir.sh
function count_redir {
curl -L -I -D - -o /dev/null $1 | awk 'BEGIN { redir = 0; status = 200; } tolower($1) ~ /http/ { redir=redir+1; status=$2 } tolower($1) ~ /location:/ { print redir, status, $2 } END { print "Completed, with ", redir-1, "redirects. Final result: ", status }'
}
View unzipALL
#!/bin/bash
# To run as a script, leave as is. Save to file and chmod +x, then execute in the dir where zipfiles are.
# To use as a function, remove line 1, uncomment line 4 and 12 and call using unzip-all in the dir where zipfiles are.
#unzip-all() {
local dir='.';
[[ ! -z "${1// }" ]] && dir=$1;
for z in *.zip; do
q=$(echo $z | cut -f 1 -d '.');
unzip $z -d $dir/$q;
You can’t perform that action at this time.