Skip to content

Instantly share code, notes, and snippets.

@lopes
lopes / hwgste.py
Last active August 7, 2024 13:48
HWg-STEpy is a simple script to get STE info. #python #thermometer #api #xml
#!/usr/bin/env python3
'''HWg-STEpy is a simple script to get STE info.
This script takes advantage of HWg-STE's XML interface
to retrieve temperature and humidity information, then
print them on the screen.
To use this, first edit the `devices' variable below to
include the IP addresses of your STE devices, then run:
@lopes
lopes / pymv.py
Last active August 7, 2024 13:46
Moves and renames files according to their modification dates. #python #files #management
'''
Moves and renames files according to their modification dates.
source directory has a structure like:
SOX-old
+ dir1
+ file1
+ dir2
+ file1
@lopes
lopes / vsdbatch.py
Last active August 7, 2024 13:45
Exports multiple Visio files in batch. #python #files #management #visio
#!/usr/bin/env python3
#vsdbatch.py
'''
vsdbatch
Exports multiple Visio files in batch.
REQUIREMENTS
1. Python 3.6 -- and pip3
@lopes
lopes / thief.py
Last active August 7, 2024 13:45
Retrives and update a certain file according to a URI. #python #web #scrapper #hash
#!/usr/bin/python3
#
# This program retrives and update a certain file according to a URI. In other
# words, the URI is fetched and, if the content of that file is different, the
# new content is written into that file.
#
#
# MIT License
#
# Copyright (c) 2017 José Lopes
@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 / xbox.py
Last active August 7, 2024 13:43
Show the Xbox's backward compatibility game library. #python #web #scrapper #xbox #game
#!/usr/bin/env python3
# Show the Xbox's backward compatibility game library.
# Still needs a lot of tests, its just a kind of alpha
# version.
# José Lopes <[email protected]>
# GPLv3+
##
from re import search
from difflib import context_diff
@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 / aes-cbc.py
Last active November 6, 2024 08:12
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 / peneira.py
Last active August 7, 2024 13:40
Just a simple script to analyse a file system. #python #files #database #postgresql #hash
#!/usr/bin/python
#peneira.py
#
# Analyses a file system path, calculating the hash for each file
# and storing hash and the path for file. Errors will be recorded
# in errors table ---duh!
#
# Author: Jose' Lopes de Oliveira Jr. <[email protected]>
# License: GPLv3+
#
@lopes
lopes / stanford-cryptography-test-using-aes.py
Last active August 7, 2024 13:39
Just a test of AES usage I wrote while coursing Cryptography I on Stanford (via Coursera) #python #cryptography #exercise #aes
#!/usr/bin/python
from Crypto.Cipher import AES
from Crypto.Util import Counter
key = bytes.fromhex('36f18357be4dbd77f050515c73fcf9f2')
ciphertext = bytes.fromhex('69dda8455c7dd4254bf353b773304eec0ec7702330098ce7f7520d1cbbb20fc388d1b0adb5054dbd7370849dbf0b88d393f252e764f1f5f7ad97ef79d59ce29f5f51eeca32eabedd9afa9329')
iv = ciphertext[:16] #not needed for CTR, mult. of 16
cipher = ciphertext[16:]