Skip to content

Instantly share code, notes, and snippets.

View noize-e's full-sized avatar

noiz-e noize-e

View GitHub Profile
@noize-e
noize-e / README.md
Created July 27, 2023 23:38
Firewall Setup Script

Firewall Setup Script

This script is designed to set up a basic firewall configuration on a Linux system using iptables. It is intended to enhance security by allowing only specific types of network traffic while blocking others. The script performs the following tasks:

  1. Environment Setup:
    • The script is written in Bash (#!/usr/bin/env bash), which specifies the interpreter to use.
    • The script sets two important options:
      • set -o nounset: This option ensures that using unset variables will cause an error.
      • set -o pipefail: This option ensures that a pipeline returns a failure status if any command in the pipeline fails.
@noize-e
noize-e / EncryptPayload.js
Last active February 14, 2024 10:21
Secure Data Transmission with Node.js and Asymmetric Encryption
import forge from 'node-forge';
const encryptAESKey = (AESKey, publicKey) => {
const publicKeyPem = forge.pki.publicKeyFromPem(publicKey);
const rsaEncryptedAesKey = publicKeyPem.encrypt(AESKey, 'RSA-OAEP');
return forge.util.encode64(rsaEncryptedAesKey);
}
const encryptText = (text, key, iv) => {
set -o nounset
set -o pipefail
PATH="/sbin"
EXT=enp3s0
INT_NET=192.168.0.0/24
echo "Flushing rules"
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
@noize-e
noize-e / postgres-cheatsheet.md
Created December 9, 2022 08:51 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@noize-e
noize-e / Install update WordPress puglins directly.md
Created September 20, 2021 02:23 — forked from dianjuar/Install update WordPress puglins directly.md
Install update WordPress plugins without providing ftp access

Install WordPress plugins directly (without FTP)

Put this on your wp-config.php

/* That's all, stop editing! Happy blogging. */
define('FS_METHOD', 'direct');
@noize-e
noize-e / aws-tf-user.sh
Created May 11, 2021 06:40
Add new user into AWS Transfer Family Server
ssh-keygen -t rsa -b 4096 -f ~testuser/sftp_key -N ''
chown testuser ~testuser/sftp_key*
aws transfer import-ssh-public-key --server-id ${SftpServer.ServerId} --ssh-public-key-body "$(cat ~testuser/sftp_key.pub)" --user-name sftpuser --region ${AWS::Region}
@noize-e
noize-e / Pipfile
Created April 7, 2021 19:38
Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
pytz = "*"
pyexcel = "*"
requests = "*"
chardet = "*"
@noize-e
noize-e / berkley_client.py
Last active April 7, 2022 21:20
BerkleyDB client for database creation and user registration
from passlib.hash import sha512_crypt as sha512
import bsddb3
import string
import random
import sys
""" BerkleyDB Python Client (write & read)
unix terminal command to dump a berkley database
@noize-e
noize-e / json_digest.py
Last active March 31, 2021 20:45
Digest a JSON file
import json
import sys
"""JSON Digest
Python script to digest a JSON structure.
Tasks:
1. Get each key name and corresponding value
a. Get the current value.
@noize-e
noize-e / vsftpd.virtual
Created March 22, 2021 11:24
vsftpd virtual users
auth required pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user crypt=crypt
account required pam_userdb.so db=/etc/vsftpd/vsftpd-virtual-user crypt=crypt
session required pam_loginuid.so