Tuesday, July 21, 2015

Symlink ClamAV Binaries On A Linux cPanel Server

ln -s /usr/local/cpanel/3rdparty/bin/freshclam /usr/local/bin/freshclam
ln -s /usr/local/cpanel/3rdparty/bin/clamscan /usr/local/bin/clamscan
ln -s /usr/local/cpanel/3rdparty/bin/clamd /usr/local/bin/clamd
ln -s /usr/local/cpanel/3rdparty/bin/clamav-config /usr/local/bin/clamav-config

Install ClamAV From The Command Line On A cPanel Server

Pretty simple task here and makes installing ClamAV easier shot you not have the root password for the customers installation:
/scripts/update_local_rpm_versions --edit target_settings.clamav installed
/scripts/check_cpanel_rpms --fix --targets=clamav

Wednesday, May 6, 2015

Single Window Mode With Sublime Text On OSX

In OSX, editing files from finder or other applications can cause multiple instances to spawn. If you prefer everything to remain tabbed in a single window, do the following.

Open: Menu -> Preferences -> Settings - User

...and add the following, then restart the app.
{
    "open_files_in_new_window": false
}
If you have existing settings within the brackets, simply add that line (check your end of line commas for proper formatting!)

Monday, April 13, 2015

Recursively Find All Files With Only One Line Of Text On Linux

A nice one-liner for finding files that only contain a single line of text which is often the case with Wordpress exploits.
find . -type f -print0 | xargs -0 wc -l | awk '$1==1{print $2}'
...an alternate version:
find . -type f -exec sh -c '[ 1 -eq $(wc -l {}|cut -d" " -f1) ] && echo {}' \;

Tuesday, December 30, 2014

Maximum Cache TTL Microsoft DNS Server MSDNS

Open up regedit and navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\Parameters
Create a new DWORD "MaxCacheTtl" with a DECIMAL setting of 300 (for 300 seconds)

Then restart the DNS service (not required)

Negative Caching Microsoft DNS Server MSDNS

Open up regedit and navigate to:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNSCache\Parameters
Create a new DWORD "NegativeCacheTime" with a DECIMAL setting of 30 (for 30 seconds)

Then restart the DNS service

Thursday, November 13, 2014

IPv6 Supernetting Subnetting Ruby

#!/usr/local/bin/ruby -w
require 'ipaddr' 

# /32 CIDR -> /40's (LONG)
(0..255).each { |x|  puts IPAddr.new("1234:5678:#{sprintf("%02x",x)}00::0").to_i }

# /32 CIDR -> /48's (LONG)
(0..255).each { |x|  puts IPAddr.new("1234:5678:00#{sprintf("%02x",x)}::0").to_i }

IPv6 To PTR RDNS PHP

<?php
$addr = inet_pton($ip);
$unpack = unpack('H*hex', $addr);
$hex = $unpack['hex'];
$arpa = implode('.', array_reverse(str_split($hex))) . '.ip6.arpa';
?>