Skip to content

Instantly share code, notes, and snippets.

@ChieftainY2k
ChieftainY2k / myscreen.sh
Created June 26, 2024 09:03
Namespaced screen with separate bash history
set -e
NAMESPACE=${NAMESPACE:-default}
echo "************************************************************************************************************"
echo "This screen session is for namespace \"${NAMESPACE}\" "
echo "If you are not the owner of this namespace please exit now (Ctrl-C) , thanks :)"
echo "If you want to use your own screen namespace, use: NAMESPACE=youname $0"
echo "Press ENTER to continue or Ctrl-C to exit"
echo "************************************************************************************************************"
# create the ~/.screenrc file in your home directory.
hardstatus on
hardstatus alwayslastline
hardstatus string '%{= kG}[%H] %{= kw}%?%-Lw%?%{= bw}[%n*%f %t]%{= kw}%?%+Lw%? %= %D, %d %M %Y %C%a'
shell -/bin/bash
@ChieftainY2k
ChieftainY2k / filename_converter.sh
Last active November 15, 2023 10:02
Convert filenames based on the modification timestamp (this is important for multimedia files to be sorted right)
#!/bin/bash
set -e
# Directory containing .AVI files
SOURCE_DIR="./"
# Directory where files will be copied
TARGET_DIR="./sorted"
# Create target directory if it doesn't exist
@ChieftainY2k
ChieftainY2k / visChangeBlocker.js
Last active September 21, 2023 07:34
Bookmarklet to disable visibility change events (to keep websites playing content even when out of focus) (based on https://greasyfork.org/en/scripts/429635-always-on-focus/code )
javascript:(function(){window.onblur=null;window.blurred=false;Object.defineProperty(document,"hasFocus",{get:function(){return true}});Object.defineProperty(document,"webkitHidden",{get:function(){return false}});["hidden","mozHidden","msHidden","webkitHidden"].forEach(function(t){Object.defineProperty(document,t,{value:false,configurable:true})});["visibilitychange","webkitvisibilitychange","mozvisibilitychange","msvisibilitychange"].forEach(function(t){document.removeEventListener(t,document["on"+t])});var e=function(t){["blur","mouseleave","mouseout"].includes(t.type)&&(t.target instanceof HTMLInputElement||t.target instanceof HTMLAnchorElement||t.target instanceof HTMLSpanElement)&&t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()};["blur","mouseleave","mouseout"].forEach(function(t){window.addEventListener(t,e,true),document.addEventListener(t,e,true)})})();
@ChieftainY2k
ChieftainY2k / jsAlert.js
Created September 18, 2023 11:22
ZED PROXY XSS alert(1) passive scan
//Passive scan for XSS JS alert(1)
function scan(ps, msg, src) {
var alertRisk = 2
var alertConfidence = 3
var alertTitle = 'Successful XSS attack'
var alertDesc = 'Successful XSS attack'
var alertSolution = 'Investigate Successful XSS attack, remove or mask as required'
var cweId = 79
var wascId = 8
@ChieftainY2k
ChieftainY2k / website_checker.sh
Last active September 18, 2023 09:34
Curl/Wget based website availability checker
#!/usr/bin/bash
#set -e
#set -x
#set -o pipefail
log_message() {
LOGPREFIX="[$(date '+%Y-%m-%d %H:%M:%S')][$(basename ${0%})]"
MESSAGE=$1
echo "$LOGPREFIX $MESSAGE"
@ChieftainY2k
ChieftainY2k / JavaLeaks.js
Created August 18, 2023 11:06
ZED PROXY Java leaks passive scan script
// Java leak finder
function scan(ps, msg, src) {
var alertRisk = 3
var alertConfidence = 3
var alertTitle = 'Java leak - investigation required (script)'
var alertDesc = 'Java leaks were found'
var alertSolution = 'Investigate Java leaks found in the response, remove or mask as required'
var cweId = 200
var wascId = 0
@ChieftainY2k
ChieftainY2k / gist:fd9242372759c16d46fa0b1c8348ace4
Created August 8, 2023 13:26
Youtube to Invidious URL redirector bookmarklet
javascript:location.hostname.includes("youtube.com")?location.assign("https://invidious.protokolla.fi"+location.pathname+location.search+location.hash):location.assign("https://invidious.protokolla.fi");
@ChieftainY2k
ChieftainY2k / unzip
Created May 10, 2023 09:56
Vagrant unzip wrapper
#!/bin/sh
#copy this file to /usr/local/bin/unzip
/usr/bin/unzip "$@"
sleep 0.2
@ChieftainY2k
ChieftainY2k / gist:88bdc9c7c38a8da97acba69e60953624
Last active April 19, 2023 19:24
Filters to filter out shorts in the youtube subscruption feed
[Adblock Plus 2.0]
! Version: 1.0
! Title: Block shorts in youtube subscription feed
! Expires: 30 days
!
! GLOBAL RULES
!
www.youtube.com##ytd-guide-renderer a.yt-simple-endpoint path[d^="M10 14.65v-5.3L15 12l-5 2.65zm7.77-4.33"]:upward(ytd-guide-entry-renderer)
www.youtube.com##ytd-mini-guide-renderer a.yt-simple-endpoint path[d^="M10 14.65v-5.3L15 12l-5 2.65zm7.77-4.33"]:upward(ytd-mini-guide-entry-renderer)
www.youtube.com##ytd-browse #dismissible ytd-rich-grid-slim-media[is-short]:upward(ytd-rich-section-renderer)