This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ptython | |
import re | |
import requests | |
from bs4 import BeautifulSoup | |
from urllib.parse import urljoin | |
##optional | |
import textwrap | |
from datetime import datetime | |
"""captive_portal_escape.py: Schedulable automatic-ish escape from a wi-fi "captive portal". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pick($hat) { | |
$a = $hat -split "," | |
$a[(get-random -min 0 -max $a.count)] | |
} | |
$altitudeModifier = "chief,head,senior,lead,principal,lord,earl of,vice,total,regional,legendary,imaginary,administrator of,minister of,professor of,master,associate,assistant,supreme,ultimate,proto,star,best,high,uber,arch,bestest,director of,manager of,commissioner of" | |
$subjectModifier = "interpersonal,extrapersonal,blackbelt,intra-,meta-,omni-,hyper-,tele-,eco-,trans-,para-,re-,turbo-,cyber,brand,catalytic,integrated,dynamic,intersectional,initiative,AI,machine learning,agile,communal,pro,team,quantitative,imaginary,holistic,core,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," #this is a trick to reduce frequency of the term appearing at all; lots of blanks will be selected | |
$subject = "data,knowledge,science,administration,infrastructure,sales,impression,ceremony,induction,persuasion,performance,propaganda,collection,cooperation,discovery,distribution,influence,referral,growth,profit,business,solutioning,disaster |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#When modern AD is your LDAP, and Linux (RHEL-ish) is your server, but not joined to domain, per se. | |
#yum install yum install openldap-clients | |
cp -p /etc/openldap/ldap.conf /etc/openldap/ldap.conf.$(date +%Y%m%d) | |
cat <<_EOF_>/etc/openldap/ldap.conf | |
BASE OU=Sites,DC=INT,DC=FOO,DC=COM | |
URI ldaps://int.foo.com:3269 | |
TLS_REQCERT ALLOW | |
_EOF_ | |
read -p "LDAP lookups Simple Bind password:" ; echo -n $REPLY > $HOME/.config/ldap_password |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#We're starting with a Java Keystore (in adkeystore.dat), and we want to end up with a combined PFX | |
#first jks out to PFX, but just the key | |
keytool -importkeystore -srckeystore adkeystore.dat -destkeystore CodeSigning_keyonly.pfx -deststoretype pkcs12 -deststorepass KEEPASS -destkeypass KEEPASS | |
#then "refine it" to a plain PEM (still key only) | |
openssl pkcs12 -in CodeSigning_keyonly.pfx -nocerts -out isolated_key.pem -nodes | |
#then combine isolated key with issued (public) cert | |
openssl pkcs12 -export -out CodeSigning_combined.pfx -inkey isolated_key.pem -in CodeSigning_$(date '+%Y')*.crt | |
#Optional review: | |
openssl pkcs12 -info -in CodeSigning_combined.pfx | egrep 'issuer|subject|--*BEGIN' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getcmd () { echo $1; find `pwd` -name "*$1*" | sed "s/^/scp $USER@$HOSTNAME:/"; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET NOCOUNT ON | |
DECLARE @AllTables table (db_name nvarchar(128),schema_name nvarchar(128),table_name nvarchar(128), table_type_desc nvarchar(60), table_modify_date datetime, column_id int,column_name nvarchar(128),data_type nvarchar(128),max_length smallint,precision tinyint, is_nullable bit) | |
DECLARE @SQL nvarchar(4000) | |
SET @SQL='select ''?'' as db_name, | |
schema_name(tab.schema_id) as schema_name, | |
tab.name as table_name, tab.type_desc as table_type_desc, tab.modify_date as table_modify_date, | |
col.column_id, col.name as column_name, | |
t.name as data_type, col.max_length, col.precision, col.is_nullable | |
from [?].sys.tables as tab | |
inner join [?].sys.columns as col |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## bry PowerShell Corporate Coding Conventions ## | |
"Largely, respecting: https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/strongly-encouraged-development-guidelines?view=powershell-7.2" | |
"Perhaps a few extensions and modifications." | |
"Also try to include this: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help?view=powershell-7.2#comment-based-help-for-a-script" | |
## Major Sections Double-Crunch, Capitalized, and Doublespaced ## | |
"For clarity, uniformity, ease of navigation, and grepability/searchability." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Simple, partial, more-or-less emulation of nslookup when all you have is dig | |
##tested on RHEL 8 and Ubuntu 20. Sometimes local dns cache is reported as SERVER. | |
nslookup () { dig $([[ $1 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] && echo "-x" || echo " ") $1 | egrep 'SERVER|^[^;]' | sed -e 's/\.\s*[0-9]*\s*IN\s*/\t/' -e 's/^;; /\tvia DNS /' -e 's/#[0-9]\+(.*//' | cat -s; } | |
## slightly fancier version, that will definitely be linux only, and one with nmcli on it, but will prevent internal DNS server cache answers. | |
# nslookup () { dig @$(nmcli | grep servers | cut -d' ' -f 2) $([[ $1 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] && echo "-x" || echo " ") $1 | egrep 'SERVER|^[^;]' | sed -e 's/\.\s*[0-9]*\s*IN\s*/\t/' -e 's/^;; /\tvia DNS /' -e 's/#[0-9]\+(.*//' | cat -s; } | |
## and here is a solaris edition which works around various limitations on tab characters | |
# nslookup () { dig $([[ $1 =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] && echo "-x" || echo " ") $1 | egrep 'SERVER| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
DOMAIN="abc.tld" | |
GPG_USER_ID=${1:-$USER} | |
echo "RSA, RSA, 4096-bit $(date +%Y.%m.%d)" | |
echo "Building a keypair for User ID: ${GPG_USER_ID}" | |
echo "Supply Legal incorporated chartered corporation/company name OR personal legal name, " | |
echo "with department name in Comment or blank (for personal legal names)." | |
gpg --gen-key | |
gpg --list-keys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Prefer Oracle APEX user identity, but gracefully "descend" to lower contexts. Also works pretty well over DB links (avoiding static proxy user identity)! | |
-- Note the regex call might have some performance implications for very high transaction rates. | |
create or replace TRIGGER "SCHEMA"."TABLENAME_BIU" | |
BEFORE INSERT or UPDATE on TABLENAME FOR EACH ROW | |
DECLARE | |
BEGIN | |
if :new.ENTITY_UID is null then | |
:new.ENTITY_UID := TABLENAME_ENTITY_UID_SEQ.nextval; | |
end if; | |
:new.AUTH_ID := UPPER(:new.AUTH_ID); |