Skip to content

Instantly share code, notes, and snippets.

View gil-obradors's full-sized avatar

Gil Obradors gil-obradors

View GitHub Profile
@gil-obradors
gil-obradors / Llistat sectorials bages
Created March 9, 2015 14:53
llistat sectorials bages, dades antenes
#!/bin/bash
for i in 10.228.17.6 10.228.17.7 10.228.17.8 10.228.34.66 10.228.20.247 10.228.20.246 10.228.20.99 10.228.21.232 10.228.21.229 10.228.20.197 10.228.20.198 10.228.17.130 10.228.21.130 10.228.33.35 10.228.21.197 10.228.20.131 10.228.18.130 10.228.20.229 10.228.32.132 172.25.128.170 ; do /guifibages/bin/clients-rocket $i ; done
### MNBFBagesNord (10.228.17.7 AirOS v5.5.8)
Airmax
Name IP Priority Quality CCQ Signal Distance
MNRamonFarguel 10.228.17.163 None 52 98 -72.00 0.1Km
SFBPinedaRevol 10.228.17.196 None 56 99 -78.00 5.4Km
MNCanAlberti 10.228.17.208 None 61 99 -72.00 4.2Km
@gil-obradors
gil-obradors / SSL cheats
Created March 21, 2015 10:19
SSL cheats
# Create CA
openssl genrsa -out ca.key 4096
openssl req -new -x509 -nodes -sha1 -days 1825 -key ca.key -out ca.crt
# Create Intermediate
openssl genrsa -out intermediate.key 4096
openssl req -new -sha1 -key intermediate.key -out intermediate.csr
# CA signs Intermediate
openssl x509 -req -days 1825 -in intermediate.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out intermediate.crt
@gil-obradors
gil-obradors / configurador.sh
Last active September 28, 2019 15:05
Configuracions especials meves
#!/bin/bash
[[ "$TRACE" ]] && { set -x; set -o functrace; }
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
logfile="/tmp/$(basename $0).$$.log"
exec > >(tee -ia $logfile)
exec 2> >(tee -ia $logfile >&2)
is_root_user() {
# Function to check that the effective user id of the user running
# the script is indeed that of the root user (0)
@gil-obradors
gil-obradors / WINBOX
Last active November 10, 2019 17:58
Winbox installer, launcher and web mimo executer for debian/ubuntu
#/bin/bash
sudo apt-get update
sudo apt-get install wine-stable ttf-mscorefonts-installer
sudo mkdir -p /opt/winbox/
sudo wget https://mt.lv/winbox64 -O /opt/winbox/winbox.exe
sudo chmod 777 /opt/winbox -R
cat << EOF | sudo tee /opt/winbox/winbox.desktop
[Desktop Entry]
Version=1.1
@gil-obradors
gil-obradors / nginx redirec.conf
Last active February 11, 2018 18:19
nginx redirect
server {
listen 80;
server_name h135;
return 301 https://h135:8006;
}
server {
listen 443;
ssl on;
@gil-obradors
gil-obradors / ubnt-discovery
Created December 3, 2018 11:11
ubnt-discovery link
sudo apt install openjdk-8-jdk openjdk-11-jdk snap
wget https://www.ubnt.com/downloads/tools/beta/discovery-tool/ubnt-discovery.zip
mkdir -p /opt/ubnt-discovery
sudo unzip ubnt-discovery.zip -d /opt/ubnt-discovery/
touch /usr/bin/ubnt-discovery
echo -e "#!/bin/bash \n /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /opt/ubnt-discovery/ubnt-discovery-v2.5.1.jar " > /usr/bin/ubnt-discovery
### Protocl CDP i LLDP
tcpdump '(ether[12:2]=0x88cc or ether[20:2]=0x2000)'
@gil-obradors
gil-obradors / mikrotik.yml
Created December 23, 2018 19:29
Mikrotik Playbook
---
- name: prova routers_commands
hosts: mikrotik
connection: network_cli
remote_user: guifibages
gather_facts: false
tasks:
- name: run command on remote devices
routeros_command:
commands: /system routerboard print
@gil-obradors
gil-obradors / csv.py
Created January 8, 2019 17:25
Play python3 csv ipaddress
#!/usr/bin/python3
import csv,ipaddress
with open('IPv4Address.csv', newline='') as csvfile:
data = list(csv.reader(csvfile))
print(data[1][0])
print(type(data))
print(str(ipaddress.IPv4Address(3232235521)))
@gil-obradors
gil-obradors / check-auth.py
Created April 17, 2019 18:59 — forked from 62mkv/check-auth.py
Python script to calculate SIP REGISTER Digest authentication (in order to check password validity)
from md5 import md5
# header from 401 response on REGISTER
# Authorization: Digest username="883140776410950", realm="gw_youmagic", algorithm=MD5, uri="sip:GW_Youmagic", nonce="1476157437:0a1418a40f8ee1c9a55f1587ab931c14", response="3ff479ccc24874f66aae45dac889d099"
login = '883140776410950'
uri = 'sip:GW_Youmagic'
nonce = '1476157437:0a1418a40f8ee1c9a55f1587ab931c14'
realm = 'gw_youmagic'
password = '----------'