Skip to content

Instantly share code, notes, and snippets.

@kimboslice99
kimboslice99 / bulk_dns_query.php
Created February 7, 2024 06:48
Bulk DNS queries at blazing fast speed! (A/AAAA)
<?php
// enter domain names in a file, newline delimited
$filename = 'domain_names.txt';
// read the file
$fp = @fopen($filename, 'r');
!$fp?die('File not found!'):'';
$domains = explode(PHP_EOL, fread($fp, filesize($filename)));
fclose($fp);
@kimboslice99
kimboslice99 / tlsa_checkup.ps1
Last active January 3, 2025 14:55
A powershell script to verify tlsa records and fire off an email with the result - OS agnostic
#A powershell script to verify tlsa records and fire off an email with the result - OS agnostic
# choco install -y bind-toolsonly - why wouldnt they keep building dig tools for windows? boo >:(
# also runs on linux provided you have dig and openssl available
# your root domain, we will look up the mx record within this script
$domainToCheck = "domain.tld"
$portsToCheck = @{
25 = 'tcp'
587 = 'tcp'
}
# notify settings
@kimboslice99
kimboslice99 / dbip-update.ps1
Created February 23, 2024 07:26
Update dbip database
$download_file = "dbip-country-lite-$((Get-Date).ToString('yyyy'))-$((Get-Date).ToString('MM')).mmdb"
$download_url = "https://download.db-ip.com/free/$download_file.gz"
# download latest GeoIP database
Invoke-WebRequest -Uri $download_url -OutFile "$PSScriptRoot\dbip-country-lite.mmdb.gz" -UseBasicParsing
Add-Type -AssemblyName System.IO.Compression.FileSystem
$sourceFileStream = [System.IO.File]::OpenRead("$PSScriptRoot\dbip-country-lite.mmdb.gz")
$destinationFileStream = [System.IO.File]::Create("$PSScriptRoot\dbip-country-lite.mmdb")
$gzipStream = New-Object System.IO.Compression.GzipStream $sourceFileStream, ([System.IO.Compression.CompressionMode]::Decompress)
@kimboslice99
kimboslice99 / Invoke-FileDownload.psm1
Last active April 30, 2024 17:30
A powershell module to keep a remote file up to date with a local copy via etag; e.g. IP lists
function Invoke-FileDownload {
param(
[Parameter(Mandatory=$true)]
[string]$Uri,
[Parameter(Mandatory=$true)]
[string]$OutFile,
[Parameter(Mandatory=$false)]
[hashtable]$Headers
)
@kimboslice99
kimboslice99 / IsValidMailbox.php
Created January 2, 2025 06:34
A php function to check if an email address is truly valid and does exist
<?php
function IsValidMailbox($address){
if(preg_match('/@([^\s]+)/i', $address, $matches)){
if(dns_get_mx($matches[1], $out)){
$timeout = 10; // Timeout for connection
$mailServer = $out[0];
// Open a plaintext connection to the mail server. Assuming port 25 outbound isnt blocked here
$connection = stream_socket_client(
"$mailServer:25",
@kimboslice99
kimboslice99 / IPUtilities.php
Last active February 4, 2025 19:32
Simple class for easy IP operations in php
<?php
class IPUtilities {
static function IsInIPv4Range($ipaddress, $range){
// convert the ip to long respresentation
$long = ip2long($ipaddress);
// split the range/cidr
$parts = explode('/', $range);
// convert the range to long representation
$rangeAddr = ip2long($parts[0]);
// binary mask