Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View socketz's full-sized avatar
📵
I may be slow to respond.

socketz socketz

📵
I may be slow to respond.
View GitHub Profile
@socketz
socketz / random_secret.py
Created September 2, 2021 05:54
Generates a random secret key for Django or other kind projects.
#!/usr/bin/env python3
import secrets
import sys
import os
import argparse
RANDOM_STRING_CHARS = '''abcdefghijklmnñopqrstuvwxyzçáéíóúäëïöüâêîôûàèìòùåõýÿABCDEFGHIJKLMNÑOPQRSTUVWXYZÇÁÉÍÓÚÄËÏÖÜÂÊÎÔÛÀÈÌÒÙ0123456789!@$€¢¥£%^&*(-_=+)?¿¡^`´¬|~;,.·<>'"[]{}¨ƒ…†‡ˆ‰šžŠŽ‹›Œœ#«»ºª°±µÐæÆþ'''
class bcolors:
@socketz
socketz / PSEventLogging.ps1
Created November 11, 2020 16:03
PSEventLogging.ps1 enables or disables PowerShell event logging disabled by default
<#
.SYNOPSIS
This configures PowerShell event logging.
PREREQUISITES
Must be executed with administrative rights.
RUNNING FROM CMD.EXE
cmd /c powershell -executionpolicy bypass -File <PathToThisFile>
@socketz
socketz / docker_install.sh
Last active May 20, 2020 10:16
Install Docker & docker-compose on Kali Linux 2020.2
#!/bin/bash
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian buster stable"
@socketz
socketz / fake_ftp.py
Last active May 18, 2019 14:59 — forked from neoplacer/fake_ftp.py
Fake FTP Server - Python 3.x
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: @neoplacer
# Contributor: @socketz
"""
Fake FTP Server
~~~~~~~~~~~~~~~
This is a simple fake FTP daemon. It stores the login data (username and
@socketz
socketz / base64_rotation.sh
Last active September 23, 2018 08:42
Bash Base64 encoding / decoding functions with rotation (rotXX / rot13)
#!/bin/bash
function rot_base64_e(){
USAGE="\nrot_base64_e <input_file_or_string> <rotation> [<output> empty for print]\nUsage example: rot_base64_e file.txt 13 output.txt\n"
if [ -f "$1" ]; then
CONTENT=$(cat $1)
elif [ -n "$1" ]; then
CONTENT=$1
else
@socketz
socketz / getip.py
Created September 7, 2018 20:38
Python3 get interface IP address
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import socket
import fcntl
import struct
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
fdsock = s.fileno()
@socketz
socketz / connect.sh
Last active June 12, 2019 19:42
Comfortable script for connecting to HackTheBox OpenVPN (alternative to GUI tools)
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
@socketz
socketz / mailcatcher
Last active January 12, 2019 12:02
Service configuration for Mailcatcher Daemon (https://github.com/sj26/mailcatcher) on systemd and init.d path. Put files in /etc/systemd/system/mailcatcher.service and /etc/init.d/mailcatcher. If you choose the mailcatcher.conf option, do not need other files, put this file in /etc/init/mailcatcher.conf.
#!/bin/sh
# Start/stop the mailcatcher daemon.
#
### BEGIN INIT INFO
# Provides: mailcatcher
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Should-Start: $local_fs $remote_fs $network $syslog $named
# Should-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
@socketz
socketz / 0_webproxy.sh
Last active February 3, 2018 11:09
Iodine + Webproxy + Google Chrome Configuration Bash Scripts (Tested on Ubuntu 16.04 x64)
#!/bin/bash
##
## IODINE + WEBPROXY CLIENT SNIPPET
## by @socketz
##
## Put your values
SSH_IP="1.2.3.4"
SSH_USER="user"
@socketz
socketz / ipv4info.user.js
Last active December 30, 2018 07:24
IPv4info Export Tables to CSV
// ==UserScript==
// @namespace https://openuserjs.org/user/socketz
// @name ipv4info.user.js
// @description This script export ipv4info tables to CSV
// @copyright 2017, socketz (socketz.net)
// @license MIT; https://opensource.org/licenses/MIT
// @version 1.0.1
// @match *://ipv4info.com/*
// @match *://*.ipv4info.com/*
// @exclude http://ipv4info.com/tools/*