=^.^=

Install Windows SysInternals like a Pro and Attract Romantic Propositions

karma

The venerable Windows SysInternals Suite is perennially provided in an equally unflattering and flat zip file indiscriminately littered with executable tools and ersatz Compiled HTML HelpFiles (that's your handy-dandy *.chm for the uninitiated). One is left to install them as one sees fit, with no recommendations. I think there are reasonable guidelines we should expect and today I'll show you how I like to pack the pipe:

  • Most of the SysInternals tools require Administrator rights to start or function properly. We should avoid having to right-click and hit Run As Administrator every time we go to use one.
  • The executables should be stored in a sensible place
  • The tools should be easy to access, by GUI and CLI

My solutions are as follows:

  • Permanently install the SysInternals Suite applications and documentation to C:\Program Files\SysInternals\
  • Mass-enable the Run as administrator Capability setting on those applications
  • Create a SysInternals Start Menu subfolder for easy GUI access
  • Mass-enable the Run (target) as administrator setting on all shortcuts contained therein (just for the sake of being thorough)
  • Update the Windows Path Environment Variable to contain C:\Program Files\SysInternals\ so they may be called from the cmd.exe or PowerShell command line directly
[attachment-meObQY]
Illustrating the steps to update the Windows PATH

To these ends, my installation recipe simmers thus:

  1. Open PowerShell as Administrator (right-click, Run as Administrator). Run the following:
    mkdir "C:\Program Files\SysInternals" mkdir "C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\SysInternals"
  2. Extract the SysInternalsSuite.zip to C:\Program Files\SysInternals
  3. Open C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\SysInternals in File Explorer
  4. In another File Explorer window open C:\Program Files\SysInternals in Details View
  5. Sort the folder's contents by File Type. Select all Application files (all files ending in *.exe)
  6. Using your right mouse button, drag the selected files over to the Start Menu entry's window. Choose Create Shortcuts from the context menu that opens when you release the right button.
  7. Open the System control panel
  8. Click on Advanced system settings (as shown in the illustration above)
  9. Click the Environment Variables... button at the bottom of the System Properties window
  10. Click on the PATH variable, then the Edit... button
  11. Click the New button on the Edit environment variable window
  12. Paste the path C:\Program Files\SysInternals into the new line that was created then click OK on each of the three open settings window to return to the Settings control panel, which you may now close
  13. Visit my article Use Windows PowerShell to Make Multiple Shortcuts Always Run their Target as Administrator and install the shortcutJS.bat shortcut editing script according to my instructions (note that setting the Run as administrator capability directly to multiple executable files is a substantially differentiated matter, covered by its own article - both methods will be employed here)
  14. Return to your existing - or open a new - Administrator session of PowerShell (right-click and select Run as Administrator) and run the following commands and scriptlets to finalize your installation
    PS C:\Windows\system32> cd "C:\Program Files\SysInternals" PS C:\Program Files\SysInternals> $files = Get-ChildItem ./ -Include *.exe; foreach ($f in $files) { $filename = $f.FullName reg.exe ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v $filename /t REG_SZ /d "RUNASADMIN" /f } PS C:\Program Files\SysInternals> cd "C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\SysInternals" PS C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\SysInternals> $files = Get-ChildItem ./ -Include *.lnk; foreach ($f in $files) { $filename = $f.FullName shortcutJS.bat -edit $filename -adminpermissions yes }
[attachment-LhhjUM]
The Windows Registry after looping through the SysInternals application settings

Install Metasploit-Framework on Fedora/RHEL/CentOS/Rocky Linux Quick-and-Dirty

karma

The official Fedora guide (c. 2018) to installing the ever-popular ruby-based Metasploit automated scan-and-exploit framework is slightly outdated and indecisive. Please find below an updated quick installation recipe for your pleasure and leisure:

# RedHat Metasploit-Framework Installer # https://foxpa.ws/install-metasploit-framework-on-redhat # --- # Obtain the latest release from GitHub # You can git clone git://github.com/rapid7/metasploit-framework.git # however I've had problems syncing on Qubes and the master .zip will always work. # Consider using git for future updates. You may wish to add such to your crontab. # Alternatively, use the Metasploit-hosted tarball at # http://downloads.metasploit.com/data/releases/framework-latest.tar.bz2 sudo bash cd /opt wget https://github.com/rapid7/metasploit-framework/archive/refs/heads/master.zip unzip master.zip mv metasploit-framework-master metasploit # Install Ruby dependencies dnf -y install ruby-irb rubygems rubygem-bigdecimal rubygem-rake rubygem-i18n rubygem-bundler dnf builddep -y ruby dnf -y install ruby-devel libpcap-devel gem install rake # Install PostgreSQL (SQLite is no longer supported) dnf -y install postgresql-server postgresql-devel gem install pg # Symlink the Metasploit tools to a PATH'd location: ln -sf /opt/metasploit/msf* /usr/local/bin/ # Enable raw socket modules: gem install pcaprub # Install additional dependent Gems bundle install --gemfile /opt/metasploit/Gemfile

You can download this script from https://foxpa.ws/files/install-metasploit.sh, simply chmod +x it executable and ./ it. In a few minutes you should be returned to a prompt with no user intervention necessary and a working installation of Metasploit.

Now continue to setup the PostgreSQL database for Metasploit by following Fedora Project Wiki > Metasploit Postgres Setup (https://fedoraproject.org/wiki/Metasploit_Postgres_Setup).

SMS Number Vendors for Fun and Privacy

karma

A generous contributor has shared with me a list of online SMS-capable telephone number vendors which can be used to create new accounts with sites and services without having to divulge your actual phone number. They can also be used to evade geofencing by provisioning an international number.

I have cleaned out dead links (as of March 1, 2024) however you may find some working duplicates as providers are bought out or where I have chosen to retain them for redundancy due to it not often being clear which is the primary domain or whether one or the other may be allowed to expire.

This post is one of the many living lists I am maintaining here on foxpa.ws.

If you would like to contribute to this list or report a disabled or downed service please join us in our Telegram group.

Search and Replace a String in Multiple Files

karma

To find and replace a string in multiple files use this PERL regex command line recipe, taking special care to escape (precede with a backslash, '\') special characters and control sequences:
perl -i -p -e 's/old/new/g;' *.php

Redirect All HTTP URLs to HTTPS while Preserving Path on Apache with mod_rewrite

karma

To ensure all requests to a web site or service otherwise provided over unencrypted HTTP end up shoved onto HTTPS (TLS, formerly known as SSL), whether they come from errant resource calls on a webpage or the casual user simply entering the hostname in their browser's address bar without specifying the protocol and lacking an always-use-https browser plugin (you know, normal folk), you can use the following snippet in your httpd.conf, VirtualHost blocks or .htaccess files in DocumentRoots (or anywhere below, for finer-grained specificity) and it will make sure they end up getting to where they originally intended to go - though properly encrypted and protected from MiTM (Man-in-the-Middle) attacks etc. - in a Search Engine Optimised (SEO) and user-friendly fashion.

RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

Now you may wish to head on over to Let's Encrypt to get yourself a nice, free 90 day SSL certificate for your hostname or, if you prefer, a wildcard cert to plaster on everything that ends in your domain. Try to get certbot (the vendor provided software) to renew it automagically so you're not driven mental manually renewing your cert(s) every three months.