Skip to content

Instantly share code, notes, and snippets.

@lopes
lopes / rc.firewall
Last active August 7, 2024 13:28
My template to configure iptables. #iptables #firewall #linux #conf
#!/bin/bash
#rc.firewall
#
#
# Firewall configuration file.
#
#
# AUTHOR: José Lopes Oliveira Jr. <indiecode.com.br>
#
#
@lopes
lopes / chloe.sh
Last active August 7, 2024 13:29
A deprecated code that was used to manage my receipt files. #shell #shellscript #file
#!/bin/bash
#chloe.sh
# A receipt files' manager.
#
# Author.: José Lopes de Oliveira Júnior
# Website: http://joselop.es
# Licence: GPLv3+
#
@lopes
lopes / puck.sh
Last active August 28, 2024 00:51
A DNS propagation checker in Shell Script. #shell #shellscript #dns
#!/bin/bash
#puck.sh
# A DNS propagation checker. Fetches in many DNS servers around
# the world for IPs assigned to a given domain.
#
# Author: José Lopes de Oliveira Júnior <http://joselop.es>
#
#
@lopes
lopes / war-dialer.sh
Last active August 7, 2024 13:30
An deprecated IPv4 war dialer written in Shell Script. It's more like an example on how to make bitwise operations in Bash. #hack #draft #shell #shellscript #ip
#!/bin/bash
str2int(){
local octet int=0
for octet in $(echo $1 | tr "." " "); do
int=$((int << 8))
int=$((int + octet))
done
echo $int
}
@lopes
lopes / webfortune.sh
Last active August 7, 2024 13:30
An obsolete implementation of Fortunes. It reads the last Pensador's tweet, store it and display for the user. 1 tweet a day. #linux #conf
#!/bin/bash
#webfortune.sh
# Retrieves the last @pensador's tweet. Manages it retrieving one
# tweet per day, by using a file to cache the quote.
#
#
# José Lopes de O. Júnior <http://indiecode.com.br>
#
@lopes
lopes / ervilha.sh
Last active August 7, 2024 13:31
Displays the sequence until its Nth item, passed through $1. The sequence starts with 1 and its next item will be given by the read of the current item. #shell #shellscript #challenge
#!/bin/bash
#ervilha.sh
#
#
# Displays the sequence until its Nth item, passed through $1.
# The sequence starts with 1 and its next item will be given
# by the read of the current item.
# For exemple, if the 4th item is 1211 --three one and one
# two--, the 5th item will be 3112.
#
@lopes
lopes / macaddr.sh
Last active August 7, 2024 13:32
A really simple shell script to identify your NIC's manufacturers according to its MAC addresses. #shell #shellscript #nic #mac
#!/bin/bash
#macaddr.sh
#
# It will catch all of your network interfaces and
# find out what's the manufacturer of each according
# to its OUI.
#
# José Lopes de Oliveira Jr. <indiecode.com.br>
#
# GPLv3
@lopes
lopes / indipv4.py
Last active August 7, 2024 13:32
A class to handle IPv4 addresses. You can try it by running directly this script. #python #ip #prototype
#!/usr/bin/env python
#coding: utf8
"""IP
Provides a class that stores an IPv4 address like an
integer number. But it is transparent to the user.
"""
@lopes
lopes / sync-bkps.sh
Last active August 7, 2024 13:33
Syncs backups from different servers in a single file server. #shell #shellscript #files #backup
#!/bin/bash
#sync-bkps.sh
#
# Syncs backups from different servers in a single
# place, using rsync. This "single place", in this
# case is a shared folder in a Windows 2008 system.
# So, we have to mount it using Samba first.
#
# AUTHOR.: José Lopes de Oliveira Jr. <indiecode.com.br>
# LICENSE: GPLv3+
@lopes
lopes / pack.sh
Last active August 7, 2024 13:34
Packs an entire directory by zipping and encrypting it. #shell #shellscript #cryptography #files
#!/bin/bash
#pack.sh
#
# Zips and crypts a directory.
#
# TODO
# - Ask confirmation before delete.
##
OUTPUT="$(basename $(pwd))" #current dirname