Reminders - mccright/rand-notes GitHub Wiki

Reminders of Important, Yet Infrequent Tasks

Reminders of How to Perform Tasks that are Important When I Need Them, But I Don't Need Them Very Often:

Booting a PC from a USB drive

Many PCs have a configuration screen to select the boot drive/media.
It is often accessed by pressing a key while powering on the PC.
HP == F9
Dell & Lenovo == F12
AmiBIOS == F8 Award BIOS == F11
Macs == Press C while powering on.
On newer PCs, you may often be able to configure the BIOS/UEFI to force a new boot order.
Try the Delete key, and if that does not work, try F1 or F2.
Modern Windows also has an option where you hold the Shift key down while selecting the Restart option.

Searching for user details in Active Directory using PowerShell

  • If you know the login name: All the details that you are permitted to see
    $user="\<userName\>"
    Get-ADUser -Identity $user -Properties *
  • If you only know the email address: All the details that you are permitted to see
    $emailAddr="<Email_Address\>"
    Get-ADUser -Filter {EmailAddress -eq $emailAddr} -Properties *
  • If you want to know information about the manager of a given user
    $user="\<userName\>"
    $mgrcn = Get-ADUser -Identity $user -Properties Manager | Select-Object -Property Manager
    $mgrcnstr = $mgrcn.Manager
    Get-ADUser -Filter {DistinguishedName -eq $mgrcnstr} -Properties DisplayName,UserPrincipalName,whenCreated,CanonicalName,City,LastLogonDate,mobile,MobilePhone,EmailAddress

List all the Windows Domain Controllers and Sites within a given Domain

At a command prompt:
c:\windows\system32\nltest.exe /DCLIST:<domainName>

Simple way to temporarily bypass PowerShell execution policy

  • From the run dialog (or command prompt) just execute “powershell –ExecutionPolicy Bypass” and it will start a PowerShell session that allows for running scripts and keeps the lowered permissions isolated to just the current running process.
    C:\> powershell –ExecutionPolicy Bypass [command] [parameters]

Setting the initial root password for a new Windows xampp install

I know this is not the most safe configuration. I use xampp infrequently to figure out to address some types of niche problems quickly, then blow it away.

(0) Install xammp.

(1) Start up the xampp control panel. Turn on Apache and MySQL.

(2) Open the xampp shell (over on the right column). Use mysqladmin to set the root password [include the quotes around the password]

Setting environment for using XAMPP for Windows.
user@PCNAME d:\xampp
# mysqladmin.exe -u root -h localhost password "TheNewPasswordHere"

user@PCNAME d:\xampp
#

(3) Open the MySQL ini file, uncomment the client password line and put the password in. My ini file is at: D:\xampp\mysql\bin\my.ini

[client]
password = "TheNewPasswordHere"

(4) Go back to the control panel, stop and restart MySQL.

(5) Open the phpMyAdmin configuration file and put the password there as well. My phpMyAdmin config file is at: D:\xampp\phpMyAdmin\config.inc.php.

$cfg['Servers'][$i]['password'] = 'TheNewPasswordHere';

Using tcpdump

My QA or Functional Tester Asked About Adding Some 'Security' Testing

I have no ruby slippers to loan out. I know of no easy way to transform a professional quality assurance tester into a security professional. That said, I believe that there is often real value in having QA testers (especially those with easy to copy-and-morph automation) add some injection tests to their standard test suites. If input strings like those below were successful then a form field or query parameter in an HTTP request is ineffectively validated or not validated at all, and if an XSS injection is successful the HTTP response has not been encoded. Those are valuable vulnerabilities to identify as early as is possible. Adding a few strings to a QA testers inputs is generally an inexpensive request. So the economic and risk equations are attractive. Here are some quick candidates for those inputs:

<video src=_ onloadstart=alert('XSS')>  
<img src=x onerror=alert('XSS');>   
<script>alert('XSS')</script>  
<script>alert("XSS")</script>  
<script>alert("XSS"); </script>  
<button onClick="alert('XSS')">Click 4 Your Prize</button>   
' or 'x'='x  
' or '1'='1  
' or 'x'='x' --  
' or '1'='1' --  
' or select @@innodb_version --   
' or SELECT DISTINCT owner FROM all_tables; --  
' or select versionnumber, version_timestamp from sysibm.sysversions; --  
⚠️ **GitHub.com Fallback** ⚠️