Skip to content

Instantly share code, notes, and snippets.

View aweher's full-sized avatar
💡
Open for ideas

Ariel Weher aweher

💡
Open for ideas
View GitHub Profile
@aweher
aweher / zonas.py
Created May 18, 2020 17:04
Creación de zonas de FW
zonas = ['OUTSIDE', 'DMZ', 'COMERCIAL', 'TECNICA', 'VPN']
def createrule(zonain, zonaout):
if zonain == zonaout:
print(f'add action=jump chain=desde-{zonain} comment="{zonain} a {zonaout}" jump-target=MISMAZONA out-interface-list={zonaout}')
else:
print(f'add action=jump chain=desde-{zonain} comment="{zonain} a {zonaout}" jump-target={zonain}-a-{zonaout} out-interface-list={zonaout}')
for zonain in zonas:
for zonaout in zonas:
@aweher
aweher / python3_ping.py
Created March 19, 2018 12:38
Ping in python 3 without output or using subprocess
def is_alive(host):
ret = os.system('ping -c 3 -t 3 -n -q {} > /dev/null'.format(host))
if ret == 0:
return True
return False
@aweher
aweher / clientspervlan.sh
Last active December 21, 2015 10:39
Count PPPoE clients per VLAN in a Cisco BRAS
#!/bin/bash
if [ $1 ]; then
THEFILE=`date +%s`
COMMAND=`rsh $1 show pppoe session | grep "VLAN: " | awk '{print $3}' | sed s/:// > /tmp/$THEFILE`;
LIST=`cat /tmp/$THEFILE | sort -uh | xargs`;
TOTAL=0
for ITEM in $LIST; do
CANT=`grep $ITEM /tmp/$THEFILE | wc -l`;
echo "VLAN $ITEM has $CANT clients";
TOTAL=$[ $TOTAL + $CANT ];