Skip to content

Instantly share code, notes, and snippets.

View wesleyit's full-sized avatar

Wesley Rodrigues wesleyit

View GitHub Profile
@wesleyit
wesleyit / simple_uid_auth.py
Created November 19, 2019 18:03
Type your password if an authorized UID is read by NFC reader
import re
import time
import serial
import pykeyboard
k = pykeyboard.PyKeyboard()
ENTER = k.enter_key
password = 'My_Super_P4SSWoRD'
print('Starting serial device...')
ser = serial.Serial(port='/dev/ttyUSB0', baudrate=9600)
@wesleyit
wesleyit / kms_encrypt_decrypt.sh
Created November 19, 2019 17:00
Helper to encrypt and decrypt using AWS KMS
#!/bin/bash
export PROFILE='my-security-profile'
export KEY='12345678-abcd-efgh-ijkl-1234567890'
function encrypt() {
aws --profile "$PROFILE" \
kms encrypt \
--key-id "$KEY" \
--plaintext "file://$1" \
@wesleyit
wesleyit / 20-rwrfid.rules
Created November 6, 2019 21:38
UDEV Rule for Chinese RFID 125KHz R/W
# UDEV Rule for Chinese RFID 125KHz R/W
# Creating a fixed device when connecting to USB
ACTION=="add", \
ATTR{idProduct}=="6850", \
ATTR{idVendor}=="6688", \
RUN+="/bin/sh -c 'rm -f /dev/ttyRFID0; mknod /dev/ttyRFID0 c $major $minor; chown root:root /dev/ttyRFID0; chmod 0660 /dev/ttyRFID0'"
# Removing after disconnecting
ACTION=="remove", \
@wesleyit
wesleyit / sagemaker_local.html
Created October 31, 2019 14:08
In this notebook there is a demo on how to run Sagemaker jobs from your local Jupyter notebooks
<!DOCTYPE html>
<html>
<head><meta charset="utf-8" />
<title>Local Sagemaker</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
@wesleyit
wesleyit / misc_databases_on_docker.sh
Created July 27, 2019 01:00
Many databases running on Docker (for testing purposes)
docker run --name postgres \
-e POSTGRES_USER=pgadmin \
-e POSTGRES_PASSWORD=pgpasswd \
-e POSTGRES_DB=pgdb \
-v /my/own/datadir:/var/lib/postgresql/data \
-d postgres
docker run --name mysql \
-e MYSQL_USER=myadmin \
@wesleyit
wesleyit / test_shellshock.sh
Last active April 2, 2019 16:54
Test for ShellShock Vulnerability (cve-2014-6271)
#!/bin/bash
docker run -d -p 8080:80 --name target hmlio/vaas-cve-2014-6271
cat << EOF | docker exec -i target bash
export EXPLOIT="() { echo 'Hello from Shell'; }; echo 'This machine is vulnerable'"
bash
EOF
@wesleyit
wesleyit / csv_to_mysql_multithreads.py
Created March 2, 2019 22:43
Insert data from a CSV file to MySQL DB with multithreads
import sys
import pandas as pd
import numpy as np
from pandas.io import sql
from sqlalchemy import create_engine
from multiprocessing import Pool as pool
from threading import Lock as lock
# Get the data from CSV into a DataFrame
df = pd.read_csv('../bases/clientes.csv', sep=';')
@wesleyit
wesleyit / start_workspace.py
Created February 26, 2019 13:55
This python script will call a PCOIP client window and give all necessary parameters for a connection.
# pip install pyuserinput
import subprocess
import sys
import time
import pykeyboard
if len(sys.argv) > 1:
ubiqui = sys.argv[1]
@wesleyit
wesleyit / grammarly.html
Created December 26, 2018 19:15
Dummy page for Grammarly checking
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Grammarly - Type your text</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
textarea {
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
@wesleyit
wesleyit / run_threads.py
Last active December 4, 2018 21:31
Run threads with sub processes
from multiprocessing import Pool as pool
from subprocess import Popen as run
from os import listdir as ls
# all files begining with this will be executed
PREFIX = 'python_scripts_'
# set for the number of cores you have
THREADS = 4