Coding

The following port scanner C code checks approximately 65535 ports in about 15 seconds on-network. #include <stdio.h> #include <stdlib.h> #include <netinet/in.h> #include <string.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <netdb.h> #include <sys/types.h> #include <sys/time.h> #include <sys/ioctl.h> #include <sys/wait.h> #define MAX_PORTS 65535 #define MAX_SOCKETS 1023 // gcc -o portscanner portscanner.c int…

Read More A Port Scanner in C

// gcc bofh.c -o bofh #include <stdio.h> #include <stdlib.h> #include <time.h> #define NUM_QUOTES 10 const char* bofh_quotes[NUM_QUOTES] = { “No, my powers can only be used for good.”, “It must be a hardware problem.”, “I’m sorry, we don’t support that feature.”, “That’s a PEBCAK error (Problem Exists Between Chair And Keyboard).”, “Have you tried turning…

Read More A BOFH Generator in C

Looking to capture some performance metrics for website from the Linux command line and eventually get it into Cacti (RRD). Here are my scattered notes on this process. I’m not very familiar with NodeJS stuff, so I’m documenting from installation of NodeJS on Debian 11 to creating the project. Install NodeJS, Puppeteer and Chromium headless…

Read More Website Performance Analysis and Graphing – Debian NodeJS + Puppeteer + Cacti

The PowerShell script is designed to extract information about Remote Desktop Protocol (RDP) local session manager events from the Windows event logs on a RDS host and save it to a CSV file. Script: Get events with EventID 40 from Microsoft-Windows-TerminalServices-LocalSessionManager/Operational Event Log $RDPAuths = Get-WinEvent -LogName ‘Microsoft-Windows-TerminalServices-LocalSessionManager/Operational’-FilterXPath ‘<QueryList><Query Id=”0″><Select>*[System[EventID=40]]</Select></Query></QueryList>’ [xml[]]$xml = $RDPAuths | ForEach-Object…

Read More Analyze RDP Disconnection Logs using PowerShell

Working with some older Cisco ASA devices, I’m trying to access the ASDM interface. The browser isn’t giving me luck, so I turned to PowerShell to help me, but I get the following error when trying an Invoke-WebRequest to grab the asdm.jnlp file I need. The underlying connection was closed: Could not establish trust relationship for the…

Read More Could not establish trust relationship for the SSL/TLS secure channel.

This PowerShell script retrieves information about enabled Active Directory (AD) users, including their SAM account name, last logon time, and organizational unit (OU). The script makes use of several cmdlets and concepts that are common in PowerShell, including filtering, selecting, sorting, and transforming data. Get-ADUser -Filter * -Properties lastLogon | Where-Object { $_.Enabled -eq $True…

Read More Get Enabled AD Users with Last Logon Time and Organizational Unit Information

Handling commandline arguments in VB.NET (or really anything) can be tricky. I came across the following class the other day while looking for a drop-in solution to a RAD I was developing. Here’s what my usage shows for my application, thanks to the .NET class. portscan.exe portscan 0.9.2 by Rich Kreider Usage: portscan -h <host>…

Read More Handling Commandline Arguments in VB.NET

On my server, I have PHP 5.6 to 8.1 installed and use the versions for various testing purposes. To change the memory_limit across all versions as simply as possible instead of editing each file, I use the following command. find /etc/php -iname ‘php.ini’ -exec sed -i ‘s/memory_limit = .*/memory_limit = 512M/g’ {} \;

Read More Bulk change PHP memory_limit across all installed PHP versions