Thursday, January 27, 2022

QR Code in 5 Lines

 # pip install pillow

# pip install qrcode
# ref: https://towardsdatascience.com/generate-qrcode-with-python-in-5-lines-42eda283f325



import qrcode
# Link for website
input_data = "https://towardsdatascience.com/face-detection-in-10-lines-for-beginners-1787aa1d9127"
#Creating an instance of qrcode
qr = qrcode.QRCode(
        version=1,
        box_size=10,
        border=5)
qr.add_data(input_data)
qr.make(fit=True)
img = qr.make_image(fill='black', back_color='white')
img.save('qrcode001.png')

Monday, November 15, 2021

Technology Management Role

 

These are most of the tasks that are performed for technology management in a business

  1. Manage system recovery
  2. Reduce technology friction
  3. Provide technology guidance
  4. Measure technology systems performance and processes
  5. Manage technology uptime and availability
  6. Manage technical risk, compliance, controls, and process
  7. Manage data protection and lifecycle
  8. Manage technology costs and budget
  9. Manage technology security 
  10. Manage user and system access
  11. Manage user experience
  12. Manage technology training programs
  13. Manage technical issues and problems
  14. Manage technology adoption
  15. Manage email, websites, and social media systems
  16. Manage technology vendors, suppliers, and partners
  17. Manage cloud resources
  18. Manage software and applications
  19. Manage servers, workstations, laptops, and all technology assets
  20. Manage networking systems LAN, WAN and Wireless
  21. Manage technology hardware lifecycle
  22. Manage business phone and fax systems
  23. Manage mobile phones and devices




Thursday, January 28, 2021

Windows DHCP and Static IP with dhcpstaticipcoexistence

 These Steps will setup a static IP address with DHCP as a default.

You can not do it from GUI

Open command prompt as Administrator

  1. Find out the interface name:

    netsh interface ipv4 show interface
    
  2. Enable dhcpstaticipcoexistence:

    netsh interface ipv4 set interface interface="interface name" dhcpstaticipcoexistence=enabled
    
  3. Add a static ip address to your interface

    netsh interface ipv4 add address "interface name" 192.168.x.xxx 255.255.255.0
    
  4. Use command 'ipconfig /all' to verify the static ip address is added. 



Ref: https://superuser.com/questions/679134/add-a-static-ip-alias-to-a-dhcp-interface-on-windows-8-and-above/1250941#1250941


Friday, January 22, 2021

The Four Types of Work

The Four Types of Work

 

  1. Normal Work or Business Processes
  2. New Work or Business Projects
  3. Planned Changes to Business Processes
  4. Unplanned Work

ref: https://medium.com/trainingpeaks-product-development/the-phoenix-project-and-software-product-development-602a2a7adfd0


Friday, January 15, 2021

Windows Key Shortcuts

 

  • Press the Windows key to enter the tiled Start screen.
  • The Windows key + M minimizes everything that's showing on the desktop.
  • The Windows key + E opens Explorer for quick access to folders.
  • On the Start screen, press the Windows key + D to instantly get to the desktop.
  • The Windows key + Tab opens a list of currently running programs.
  • The Windows key + Print Screen takes a screenshot and saves it in a Screenshots folder nested in your Pictures folder. 
  • To take a screenshot on a Windows 8 tablet, simultaneously press the Windows button and the volume-down button on the tablet chassis.
  • The Windows key + Q opens a global search menu. Type what you're looking for and where you would like to look.
  • The Windows key + W opens a search in your system settings to quickly locate and change system properties.
  • The Windows key + F opens a file and folder search.
  • The Windows key + Pause opens the system properties page to show you a quick rundown of your specs.
  • The Windows key + "," (that's the comma sign!) makes all current windows transparent, giving you a peek at the desktop as long as you hold down the Windows key.
  • The Windows key + "." (the period) snaps a window to the right or left side (toggling each time you press ".").
  • The Windows key + R prompts the Run command—useful for quickly launching apps and other routines with a command prompt.
  • The Windows key + X opens the Quick Access Menu, exposing system functionality such as the Command Prompt, Disk Management, File Explorer, Run, and more. Alternatively, you can right-click on the bottom right corner of the screen to spawn the Quick Access Menu.
  • The Windows key + I opens the settings menu, giving you quick access to the Control Panel, Personalization, and your Power button, among other features.
  • The Windows key + O locks orientation on devices with an accelerometer.

ref: 
https://www.pcworld.com/article/2012885/20-must-know-windows-8-tips-and-tricks.html

Thursday, December 31, 2020

Test website SSL with Windows PowerShell

How to test a website SSL certificate with Windows PowerShell





#-----------------------------------------------
#  Test Website SSL Certificate
#  by: Larry Billinghurst
#  date: 31 Dec 2020
#-----------------------------------------------

# Example:   .\test-ssl.ps1 -SiteURL https:\\dmv.utah.gov -ReportFile "C:\support\temp99.txt"


param(
    [parameter()]
    [string]$SiteURL = "https://www.facebook.com",
    [string]$ReportFile = $env:TEMP + "\sslreport.txt"
    )

$TempCerFile = $env:TEMP + "\sslchecktemp.cer"
$tempReportFile = "sslreport.txt"

#------------------------- Functions

function Get-WebsiteCertificate {
  [CmdletBinding()]
  param (
    [Parameter(Mandatory=$true)] [System.Uri]
      $Uri,
    [Parameter()] [System.IO.FileInfo]
      $OutputFile,
    [Parameter()] [Switch]
      $UseSystemProxy,  
    [Parameter()] [Switch]
      $UseDefaultCredentials,
    [Parameter()] [Switch]
      $TrustAllCertificates
  )
  try {
    $request = [System.Net.WebRequest]::Create($Uri)
    if ($UseSystemProxy) {
      $request.Proxy = [System.Net.WebRequest]::DefaultWebProxy
    }

    if ($UseSystemProxy -and $UseDefaultCredentials) {
      $request.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
    }

    if ($TrustAllCertificates) {
      # Create a compilation environment
      $Provider=New-Object Microsoft.CSharp.CSharpCodeProvider
      $Compiler=$Provider.CreateCompiler()
      $Params=New-Object System.CodeDom.Compiler.CompilerParameters
      $Params.GenerateExecutable=$False
      $Params.GenerateInMemory=$True
      $Params.IncludeDebugInformation=$False
      $Params.ReferencedAssemblies.Add("System.DLL") > $null
      $TASource=@'
        namespace Local.ToolkitExtensions.Net.CertificatePolicy {
          public class TrustAll : System.Net.ICertificatePolicy {
            public TrustAll() { 
            }
            public bool CheckValidationResult(System.Net.ServicePoint sp,
              System.Security.Cryptography.X509Certificates.X509Certificate cert, 
              System.Net.WebRequest req, int problem) {
              return true;
            }
          }
        }
'@ 
      $TAResults=$Provider.CompileAssemblyFromSource($Params,$TASource)
      $TAAssembly=$TAResults.CompiledAssembly

      ## We now create an instance of the TrustAll and attach it to the ServicePointManager
      $TrustAll=$TAAssembly.CreateInstance("Local.ToolkitExtensions.Net.CertificatePolicy.TrustAll")
      [System.Net.ServicePointManager]::CertificatePolicy=$TrustAll
    }

    $response = $request.GetResponse()
    $servicePoint = $request.ServicePoint
    $certificate = $servicePoint.Certificate

    if ($OutputFile) {
      $certBytes = $certificate.Export(
          [System.Security.Cryptography.X509Certificates.X509ContentType]::Cert
        )
      [System.IO.File]::WriteAllBytes( $OutputFile$certBytes )
      $OutputFile.Refresh()
      return $OutputFile
    } else {
      return $certificate
    }
  } catch {
    Write-Error "Failed to get website certificate. The error was '$_'."
    return $null
  }

  <#
    .SYNOPSIS
      Retrieves the certificate used by a website.

    .DESCRIPTION
      Retrieves the certificate used by a website. Returns either an object or file.

    .PARAMETER  Uri
      The URL of the website. This should start with https.

    .PARAMETER  OutputFile
      Specifies what file to save the certificate as.

    .PARAMETER  UseSystemProxy
      Whether or not to use the system proxy settings.

    .PARAMETER  UseDefaultCredentials
      Whether or not to use the system logon credentials for the proxy.

    .PARAMETER  TrustAllCertificates
      Ignore certificate errors for certificates that are expired, have a mismatched common name or are self signed.

    .EXAMPLE
      PS C:\> Get-WebsiteCertificate "https://www.gmail.com" -UseSystemProxy -UseDefaultCredentials -TrustAllCertificates -OutputFile C:\gmail.cer

    .INPUTS
      Does not accept pipeline input.

    .OUTPUTS
      System.Security.Cryptography.X509Certificates.X509Certificate, System.IO.FileInfo
  #>
}


#-------------------- Main 


#Get Website SSL certificate and save to temp file
Get-WebsiteCertificate -Uri $SiteURL -OutputFile $TempCerFile
# Check Certifacate 
Write-Host
Write-Host "------------------------- SSL Report -------------------------"
Write-Host
certutil -f -urlfetch -verify $TempCerFile |Tee-Object $ReportFile


# Remove Report file if not requested
if ($tempReportFile -eq ($ReportFile|Split-Path -Leaf)) {Remove-Item $ReportFile}

# Remove Temp Cert File
Remove-Item $TempCerFile




Monday, December 21, 2020

Export SonicWALL config to text

Needed a way to export the SonicWALL config file to plane text.


It did not work correctly with Python3.

PS C:\support\fw> python.exe .\parser2.py .\sonicwall-NSA_2600.exp
  File ".\parser2.py", line 454
    print ""
          ^

I found the 2to3.exe tool in the Python tools directory.
 
C:\Users\"user-name"\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts

Made a copy of the file
.\copy C:\temp\parser2.py C:\temp\parser2-3.py 

Ran the tool
.\2to3.exe C:\temp\parser2-3.py -w


After converting with 2to3.exe tool still received a error

python.exe .\parser2-3.py .\sonicwall-NSA_2600.exp

Traceback (most recent call last):
  File ".\parser2-3.py", line 14, in <module>
    decoded_data =  decoded_data.split("&")
TypeError: a bytes-like object is required, not 'str'


A little research found we needed to convert the byte-like object to string
decoded_data = decoded_data.decode(encoding="utf-8"# Python 3

After the update the parser worked without issue.
python.exe .\parser3.py .\sonicwall-NSA_2600.exp  >test.txt

I posted the updated files on GitHub