BL๐Ÿ…พG News


Actu G33k & admin stuff.

โ‹… Aucun commentaire

alt

The new MODstat for BASH 2017: https://git.echosystem.fr/Erreur32/MOTDs32

Ce projet MOTDs32 est un fork de l'excelent MODstat ,

J'avais mis en place un systรจme complรฉmentaire ร  MODstat, mais cela fesait doublon lors de la connexion SSH.

Le dernier push (2015) de MODstat ne me plait pas non plus, avec une banner trop rigolote (laissant apparaitre un รขne...) avec Fortune ( proverbe ), inutile pour moi ^^.

j'ai donc optรฉ pour une fusion des deux scripts: MODstat + Stats32 = MOTDs32

(2017) New project MOTDs32 by  ๐Ÿ…ด๐Ÿ†๐Ÿ†๐Ÿ…ด๐Ÿ†„๐Ÿ†32

 
https://git.echosystem.fr/Erreur32/MOTDs32

,--.   ,--. ,-----. ,--------.,------.         ,----.  ,---.
|   `.'   |'  .-.  ''--.  .--'|  .-.  \  ,---. '.-.  |'.-.  \
|  |'.'|  ||  | |  |   |  |   |  |  \  :(  .-'   .' <  .-' .'
|  |   |  |'  '-'  '   |  |   |  '--'  /.-'  `)/'-'  |/   '-.
`--'   `--' `-----'    `--'   `-------' `----' `----' '-----'

	   |  +	๏ผณ๏ฝ”๏ฝ๏ฝ”๏ฝ“๏ผ“๏ผ’   |
	   
	   
System requirements
===================
     o Unix/Linux operating system with bash




Pour avoir des jolies stats (ร  jours) ร  chaque connexion dans votre terminal.


โ€“ Installation:



~$ git clone https://git.echosystem.fr/Erreur32/MOTDs32.git
~$ cd MOTDs32
~$ /install.sh




https://asciinema.org/a/155050

Voilร  , Terminรฉ !!

vous pouvez customiser des options dans le fichier de config :

 ~$ nano  /etc/motdstat/motdstat.conf




Exemple:

https://git.echosystem.fr/Erreur32/MOTDs32#sample-motd32-report
        echosystem.fr  > status at 13:40 > 5min load is 0.52 on 8 cpu(s)

      Disk status        |      Memory status       |     Service status
partition      free  usg | Memory      used kB  [%] | service(s)        (count)
/              4.8G  74% | Memory:    61306164  92% | tcp/0.0.0.0:2222
/home          1.5T  12% | Swap:          3560   0% | tcp6/:::2222
                         | Buffers:    1271468      | tcp/0.0.0.0:25
                         | Cached:    51665940      | tcp6/:::25
                         |                          | tcp/127.0.0.1:8080
                         |                          | tcp6/:::80
                         |                          | tcp6/:::443
                         |                          | udp/37.187.162.229:123
                         |                          | udp/127.0.0.1:123
                         |                          | udp/0.0.0.0:123
                         |                          | udp6/fe80::ec4:7aff:fe0f
                         |                          | udp6/2001:41d0:d:2e5:::1
                         |                          | udp6/::1:123
             __                             __                      ___
.-----.----.|  |--.-----.-----.--.--.-----.|  |_.-----.--------.  .'  _|.----.
|  -__|  __||     |  _  |__ --|  |  |__ --||   _|  -__|        |__|   _||   _|
|_____|____||__|__|_____|_____|___  |_____||____|_____|__|__|__|__|__|  |__|
                              |_____|
/bin/sh :

 13:40:01 up 66 days, 19:10,  2 users,  load average: 0.26, 0.52, 0.60
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
erreur32 pts/0    213.173.170.22   Tue15    2days  1.62s  0.27s sshd: erreur32 [priv]
erreur32 pts/2    2a01:e35:8aa3:87 11:05   19:02   1.83s  0.00s sshd: erreur32 [priv]

Debian GNU/Linux 8.8 (jessie) (3.16.0-4-amd64).
Kernel Info:    Linux 3.16.0-4-amd64 x86_64

-----------     ---     ------------    ----------
System load :   0.26    IP Address:
Memory usage:   12.7%   System uptime:  66 days
Usage on /  :   74%     Swap usage:     0.0%
Local Users :   2       Processes:      285
-----------     ---     ------------    ----------

  Fri Jul 21 13:40:01 CEST 2017



It's a MODstat fork
A lot of customisation has been done with ./install



Enjoy !


by ๐Ÿ…ด๐Ÿ†๐Ÿ†๐Ÿ…ด๐Ÿ†„๐Ÿ†32

Hosted on

๐Ÿ…ด๐Ÿ…ฒ๐Ÿ…ท๐Ÿ”ต๐Ÿ†‚๐Ÿ†ˆ๐Ÿ†‚๐Ÿ†ƒ๐Ÿ…ด๐Ÿ…ผ



โ‹… Aucun commentaire

BANIP

Simple script Debian pour bannir une ip/range avec iptables facilement ;)

banip image

banip.sh

#!/bin/bash
# Script name : Ban/Unban IP with Iptables

function help {
    echo "Syntax: $0 -[L][u] target(s)"
    echo " Parameters come first. Target is expressed as an IP address."
    echo " No specified parameter will ban the IP."
    echo " -L to list currently banned IPs."
    echo " -u to unban IP(s)."
    exit 1
}

# If no arguments are passed, call the "help" function.
if [ -z "$1" ]; then
    help
fi

# Define some variables
ACTION="-A"
txtred=$(tput setaf 1)
txtyel=$(tput setaf 3)
txtcya=$(tput setaf 6)
txtrst=$(tput sgr0)

while getopts "huL" OPTION
do
    case $OPTION in
        h)
            help
            ;;
        u)
            ACTION="-D"
            shift $(($OPTIND - 1))
            ;;
        L)
            ACTION="-L"
            shift $(($OPTIND - 1))
            ;;
        \?)
            help
            ;;
    esac
done

if [ $ACTION == "-L" ]; then
    echo $txtcya"List of Banned IPs:"$txtrst
    iptables -L INPUT -v -n | grep DROP
else
    # ban work loop
    for ZTARGET in "$@"
    do
        echo $txtcya"Applying action $txtred$ACTION$txtcya to $txtyel$ZTARGET"$txtrst
        iptables $ACTION INPUT -s $ZTARGET -j DROP
       # write ip list file in to root 
      echo $txtyel$ZTARGET >> /root/banip-list.txt
    done
fi

by
๐Ÿ…ด๐Ÿ†๐Ÿ†๐Ÿ…ด๐Ÿ†„๐Ÿ†32