Skip to content

Instantly share code, notes, and snippets.

@lopes
lopes / rc.firewall
Last active May 26, 2025 16:47
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 / 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 / cronometr.ino
Last active August 7, 2024 13:34
A stopwatch in Arduino Uno with DFRobot v1.1 board. #clang #arduino #prototype
/**
* cronometr.ino
* Implements a stopwatch in Arduino Uno with DFRobot v1.1 board.
* Author: José Lopes de Oliveira Jr. <jilo.cc>
* License: GPLv3+
*/
#include <LiquidCrystal.h>
@lopes
lopes / Code.gs
Last active August 7, 2024 13:36
Retrieves a quote from YAHOO! Finance and puts into the spreadsheet's cell. #javascript #js #sheets #yahoo #finance
function get_quote() {
/* get_quote
* Retrieves a quote from YAHOO! Finance and puts into the spreadsheet's cell.
*
* It's a pretty simple script that access YAHOO! Finance and get the price of
* previous close price of symbol in the first column cell of actual row.
*
* Usage: Start a spreadsheet where the symbols are disposed in lines and are
* in the first column. Use only symbols without those ".SA"s in the end.
* Access Tools > Script editor... and replace the default code for this
@lopes
lopes / aes-cbc.py
Last active May 7, 2025 01:11
Simple Python example of AES in CBC mode. #python #cryptography #aes #cbc #poc
#!/usr/bin/env python3
#
# This is a simple script to encrypt a message using AES
# with CBC mode in Python 3.
# Before running it, you must install pycryptodome:
#
# $ python -m pip install PyCryptodome
#
# Author.: José Lopes
# Date...: 2019-06-14
@lopes
lopes / aes-ecb.py
Last active August 7, 2024 13:42
Simple Python example of AES in ECB mode. #python #cryptography #aes #ecb #poc
from hashlib import md5
from base64 import b64decode
from base64 import b64encode
from Crypto.Cipher import AES
# Padding for the input string --not
# related to encryption itself.
BLOCK_SIZE = 16 # Bytes
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * \
@lopes
lopes / pilsner.sh
Last active August 7, 2024 13:44
A backup script to be used with my external HDD. #shell #shellscript #backup #files #external #hdd
#!/usr/bin/env bash
#
# The MIT License (MIT)
# Copyright (c) 2016 José Lopes de Oliveira Jr.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
@lopes
lopes / winproxy.py
Last active September 15, 2024 20:31
Sets Windows' proxy configurations easily. #python #windows #proxy #management
'''Sets Windows' proxy configurations easily.
This script allows user to update Windows proxy settings easily,
by using predefined values assigned to proxies identified by
keywords.
Note that it'll also refresh your system to guarantee that all
settings take effect. Although in the tests it seemed unnecessary
(Windows 8.1), it's considered just a guarantee.
@lopes
lopes / abused.py
Last active August 7, 2024 13:51
Connects to a mailbox using IMAP4 and parses all messages in a given box. #python #email #imap #parser #spam #phishing #abuse
#!/usr/bin/env python3
import re
import logging
from imaplib import IMAP4_SSL
from email import message_from_bytes
from email.parser import HeaderParser
from email.header import decode_header, make_header
from email.utils import parsedate_to_datetime, localtime
@lopes
lopes / aes-modes.py
Last active August 7, 2024 13:52
Simple examples on using different block cipher modes of operation (NIST SP 800-38A) with AES. #python #cryptography #aes #nist #cipher
#!/usr/bin/env python3
#
# Simple examples on using different block cipher modes
# of operation (NIST SP 800-38A) with AES.
#
# Warning: this script is just an example! You must be
# very confident on your work (or insane) to implement
# this kind of code in production, because it's safer
# to use wide tested frameworks like PyNaCl.
#