Skip to content

Instantly share code, notes, and snippets.

View SmugZombie's full-sized avatar

Ron Egli SmugZombie

View GitHub Profile
const crypto = require('crypto');
function stringToMacAddress(input) {
// Create an MD5 hash of the input string
const hash = crypto.createHash('md5').update(input).digest('hex');
// Convert the hash to MAC address format
const macAddress = hash.match(/.{1,2}/g).slice(0, 6).join(':');
return macAddress;
const dns = require('dns');
const tls = require('tls');
const email = process.argv[2];
if (!email) {
console.error('Please provide an email address as an argument');
process.exit(1);
}
@SmugZombie
SmugZombie / validateEmail.js
Created March 23, 2023 16:59
Uses SMTP communication to validate whether the input email address exists or not
const dns = require('dns');
const net = require('net');
const email = process.argv[2];
if (!email) {
console.error('Please provide an email address as an argument');
process.exit(1);
}
// ==UserScript==
// @name Expandrive Sales Killer
// @version 0.1
// @description Auto Closes the new Pop generated by Expandrive
// @author SmugZombie
// @match https://www.expandrive.com/desktop/buy/
// @icon https://www.google.com/s2/favicons?sz=64&domain=expandrive.com
// @grant none
// ==/UserScript==
@SmugZombie
SmugZombie / riskwatch_decoder.js
Last active February 8, 2023 23:43
Riskwatch HAR Decoder
const fs = require('fs');
fs.readFile('path/to/your/har/file.har', 'utf8', (err, data) => {
if (err) throw err;
let har;
try {
har = JSON.parse(data);
} catch (e) {
console.error('Error parsing the input file as JSON:', e.message);
@SmugZombie
SmugZombie / toISO.js
Created December 28, 2022 19:30
Convert Date/TimeStamp to ISO
function toISO(date) {
// If the date is already an ISO string, return it as-is
if (typeof date === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(date)) {
return date;
}
// If the date is a number, assume it's a timestamp and convert it to a Date object
if (typeof date === 'number') {
date = new Date(date);
}
<?php
function defangPayload($payload){
$re = '/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w\-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/im';
preg_match_all($re, $payload, $matches, PREG_SET_ORDER, 0);
foreach ($matches as $key => $value) {
$payload = str_replace($value[0], preg_replace('/\./', "[.]", $value[0]), $payload);
}
return $payload;
}
function defangPayload(payload){
const re = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w\-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/img;
const array = [...str.matchAll(re)];
for (let index = 0; index < array.length; index++) {
payload = payload.replace(array[index][0], array[index][0].replace(/\./g, "[.]"));
}
return payload;
}
@SmugZombie
SmugZombie / docker-monitor.sh
Last active August 12, 2022 19:18
Simple cron script to check to see if a docker container is runnign or not and restarts it if not.
#!/bin/bash
# Docker Monitor v1.3
# Simple cron script to check to see if a docker container is runnign or not and restarts it if not.
# Ron Egli <[email protected]>
# Grab the container name from cli argument
CONTAINER_NAME=$1
if [ -z "$CONTAINER_NAME" ]
then