MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
December
Sun Mon Tue Wed Thu Fri Sat
         
           
2017
Months
Dec


Tue, Dec 12, 2017 11:25 pm

NetworkManager and nm-tool

If you wish to check the speed of network interfaces on a CentOS Linux system, if the nm-tool utility, is installed, then you can use it to determine the speed of the network ports.

$ nm-tool

NetworkManager Tool

State: disconnected

- Device: em1 ------------------------------------------------------------------
  Type:              Wired
  Driver:            bnx2
  State:             unmanaged
  Default:           no
  HW Address:        D4:AE:52:CD:0A:D4

  Capabilities:
    Carrier Detect:  yes
    Speed:           1000 Mb/s

  Wired Properties
    Carrier:         on


- Device: em2 ------------------------------------------------------------------
  Type:              Wired
  Driver:            bnx2
  State:             unmanaged
  Default:           no
  HW Address:        D4:AE:52:CD:0A:D5

  Capabilities:
    Carrier Detect:  yes

  Wired Properties
    Carrier:         off


$

If it is installed, the nm-tool program will likely be in /usr/bin . It is part of the NetworkManager package.

[ More Info ]

[/os/unix/linux/centos] permanent link

Sun, Dec 10, 2017 7:39 pm

Determining the version of CentOS on a system

If you are logged into a CentOS Linux system, there are a few ways you can determine the version of CentOS running on the system from a command-line interface (CLI), i.e., a shell prompt.

In the /etc directory, there should be a /etc/centos-release file containing information on the version of CentOS.

$ ls -l /etc/*elease
-rw-r--r--  1 root root  27 Mar 28  2017 /etc/centos-release
-rw-r--r--. 1 root root 152 Nov 25  2013 /etc/lsb-release
lrwxrwxrwx  1 root root  14 Apr 20  2017 /etc/redhat-release -> centos-release
lrwxrwxrwx  1 root root  14 Apr 20  2017 /etc/system-release -> centos-release
$ cat /etc/*elease
CentOS release 6.9 (Final)
LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphi
cs-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
CentOS release 6.9 (Final)
CentOS release 6.9 (Final)
$

To just see the version number, you can use one of the grep commands below.

$ grep -oE '[0-9]+\.[0-9]+' /etc/redhat-release
6.9
$ grep -oE '[0-9]+\.[0-9]+' /etc/centos-release
6.9
$

[ More Info ]

[/os/unix/linux/centos] permanent link

Tue, Dec 05, 2017 10:53 pm

Determining if a site has implemented HTTP Strict Transport Security (HSTS)

HTTP Strict Transport Security (HSTS) is a security mechanism used by some websites to ensure that HTTP Secure (HTTPS) is always used by visitors to the site even should some intermediate system between the visitor's browser and the website attempt a man-in-the-middle (MITM) attack to downgrade the communications protocol to the unencrypted Hypertext Transfer Protocol (HTTP). The HSTS specification was published as Request for Comments (RFC) 6797 on November 19, 2012. You can tell whether a site has implemented HSTS by establishing a telnet connection to port 80, the well-known port for HTTP connections. E.g.:

$ telnet example.com 80
Trying 192.168.141.50...
Connected to example.com
Escape character is '^]'.
HEAD / HTTP/1.1
HOST: example.com

HTTP/1.1 301 Moved Permanently
Date: Wed, 06 Dec 2017 02:56:57 GMT
Server: Apache
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=31536000; includeSubDomains
Location: https://example.com/
Connection: close
Content-Type: text/html; charset=iso-8859-1

Connection closed by foreign host.
$

[ More Info ]

[/network/web] permanent link

Tue, Nov 28, 2017 11:19 pm

Find entries in one table but not a second table in a database

I have an SQLite database stored on my MacBook Pro laptop that I use to track work requests. The database file is named CRQ.db, since it tracks work done under a Change Request (CRQ). Within that database are several tables two of which are "Equipment" and "Device". For every CRQ that I need to deal with, I store records with the CRQ number in a "CRQ" column and an identifier for each piece of equipment affected by work done under that CRQ in a "Device" column. information on equipment that is affected by the CRQ in the Equipment table. I have another table named "Device" that holds details for each device, including the manufacturer and model number as well as the physical location of the device. The information in the "Description" column in the "Device" table matches the "Device" name in the "Equipment" table. The two tables have the following structure:

Equipment
NameType
CRQText
DeviceText
ProjectText
NotesText
Device
NameType
DescriptionText Unique
ManufacturerText
ModelText
SiteText
BuildingText
RoomText
NotesText

Equipment.Device = Device.Description

[ More Info ]

[/software/database/sql] permanent link

Tue, Nov 21, 2017 11:40 pm

Changing a MI424WR-GEN2 Router from WEP to WPA2 for Wi-Fi

Someone reported to me that when she attempted to connect to the WiFi service at her office that she received the message below on her phone:

Weak Security

WEP is not considered secure.

If this is your Wi-Fi network, configure the router to use WPA2 Personal (AES) security type.

When I checked the Verizon-provided router providing the wireless service at her office, I found it was an ActionTec MI424WR-GEN2 router. To change the wireless security on that router from WEP to WPA2 take the following steps.

  1. Log into the router and, from the main menu, click on Wireless Settings.
  2. Click on Advanced Security Settings.
  3. From the Advanced Security Settings menu, select WPA2 (An enhanced version of WPA providing stronger security settings.
  4. At the WPA2 window, type a key, which is akin to a password, in the Pre-Shared Key field and click on the Apply button.
  5. When you click on Wireles Settings again from the top menu bar, you should then see the key you provided in the WPA2 line.

[ More Info ]

[/network/routers/actiontec/MI424WR] permanent link

Mon, Nov 20, 2017 10:22 pm

EMF image embedded in a PowerPoint file on OS X

Someone sent me a Microsoft PowerPoint presentation to review. The file I received was a .pptx file which I opened using the PowerPoint application in Microsoft Office 2016 for Mac on my MacBook Pro laptop running OS X El Capitan (10.11.6). When I viewed the presentation, I noticed one of the slides was blank. I sometimes receive Microsoft Excel workbooks which contain a worksheet that should normally contain network diagrams where the diagrams don't appear when viewed on my Mac laptop, but do appear when I open the file in Microsoft Excel on a system running the Microsoft Windows operating system. In such cases, I've found that since the .xlsx or .xlsm file format is just an XML-based container format akin to a zip file, I rename the files where the problem occurs to have a .zip rather than .xlsx or .xlsm extension, which then allows me to extract the files contained within the file - see Zipping and unzipping Excel xlsx files and Extracting embedded documents from an Excel .xlsm file. Then I use the OS X file command in a Terminal window to examine the .bin files in the xl/embeddings subdirectory that is produced when I extract the files and folders from the zip file. That utility tells me which of the .bin files represent embedded Microsoft Visio or PowerPoint files, so I can then give the Visio ones a .vsd extension rather than a .bin extension. I can then view the diagrams with the free VSD Viewer Pro application I have on the Mac. Since there are usually several .bin files in the directory, I created a Python script to determine the file type for all of the files in a directory at once.

[ More Info ]

[/software/office/powerpoint] permanent link

Fri, Nov 17, 2017 9:25 pm

Removing all lines containing a string in vi

To remove all lines containing a particular string in the vi or Vim text editors, you can use the g command to globally search for the specified string and then, by putting a "d" at the end of the command line, specify that you want all lines containing the specified string deleted. E.g., If I wanted to remove all lines containing the string "dog", I could use the following command.

:g/dog/d

That command would also remove any lines containing "dogs", "dogged", etc. If I just wanted to remove lines containing "dog", I could use :g/dog /d.

You can, of course, specify the pattern on which you wish to search using regular expressions. E.g., if I wanted to remove any lines containing either "dog" or "hog", I could use the command below.

g/[dh]og/d

By putting the leters "d" and "h" within brackets, I indicate to vi that it should remove any line that has either a "d" or an "h" followed by "og".

[ More Info ]

[/software/editors/vi] permanent link

Mon, Nov 13, 2017 11:20 pm

Limit number of records displayed in SQL output

If you have a lot of records in a table in a MySQL, MariaDB, etc. database that are returned when you use the SQL SELECT command to query for matching records, the results may scroll by so that you can't see the initially returned rows. You can limit the number of rows displayed by appending LIMIT n at the end of the command where n is the number of records you want to see at a time. E.g., if I had 100 records in a table named Sales, but wanted to page through them 10 records at a time, I could use SELECT * FROM Sales LIMIT 10; or, if I just wanted to view one field/column in the table, e.g. "Description", I could use SELECT Description FROM Sales LIMIT 10;

[/software/database/sql] permanent link

Sun, Nov 12, 2017 7:46 pm

Manually synchronizing time on a Microsoft Windows system

I noticed the time on a Microsoft Windows 7 Professional system was ahead of the actual time by 22 minutes. The system was part of a Windows domain, but the domain controller (DC) was decommissioned. I checked the Network Time Protocol (NTP) settings from a command-line interface (CLI) by opening a command prompt window with administrator level access and using the Microsoft Windows w32tm command. to check the current configuration for querying time servers.

C:\>w32tm /query /peers
#Peers: 1

Peer:
State: Pending
Time Remaining: 1441.6885058s
Mode: 0 (reserved)
Stratum: 0 (unspecified)
PeerPoll Interval: 0 (unspecified)
HostPoll Interval: 0 (unspecified)

C:\>w32tm /query /status
Leap Indicator: 3(last minute has 61 seconds)
Stratum: 0 (unspecified)
Precision: -6 (15.625ms per tick)
Root Delay: 0.0000000s
Root Dispersion: 0.0000000s
ReferenceId: 0x00000000 (unspecified)
Last Successful Sync Time: unspecified
Source: Free-running System Clock
Poll Interval: 10 (1024s)


C:>

[ More Info ]

[/network/ntp] permanent link

Sat, Nov 11, 2017 10:31 pm

Configuring a VPN connection on Windows 7

To set up a Windows 7 system to use Internet Key Exchange version 2 (IKEv2) for establishing a virtual private network (VPN) connection, take the following steps:
  1. Click on the Windows Start button at the lower, left-hand corner of the screen, or tap the Windows key on the keyboard and select Control Panel.
  2. From the Control Panel, click on Network and Internet
  3. Click on Network and Sharing Center.
  4. Click on Set up a new connection or network.
  5. Click on Connect to a workplace at the "Choose a connection option" window.
  6. At the Connect to a Workplace window, click on Use my Internet connection (VPN).
  7. At the next window you will see "Type the Internet address to connect to". Type the fully qualified domain name (FQDN) or IP address for the VPN provider, e.g., example.com, in the Internet address field. The default destination name is "VPN Connection," but you can change it if you wish to reflect the particular VPN provider, e.g., "Ajax VPN Connection". Check the check box next to "Don't connect now; just set it up so I can connect later" and then click on the Next button. Note: if you don't have a VPN service already, Hide.me offers a free VPN service you can use for testing, though it has more limited features and geographical locations than the Hide.me paid service. 1x1 px
  8. At the next window, you can provide the user name and password for the VPN account. If you don't want to have to provide those each time you establish the VPN connection, check the check box next to "Remember this password" then click on Create.
  9. When you see "The connection is ready to use," click on the Close button rather than Connect now.
  10. Then back at the Network and Sharing Center window, you can click on Connect to a Network and select the VPN connection. Or you can click on Change adapter settings which will show you the available network connections. You will need to be already connected to the Internet via a wired or wireless connection to establish a connection to the VPN. You can then double-click on the VPN connection entry in the list. You should see "WAN Miniport (IKEv2)" on that entry. If you need to make any changes to the settings, you can right-click on the relevant VPN connection and choose Properties.
  11. A window will open with fields for the user name and password for the domain. If you chose to save those values previously, you can simply click on Connect at this point to establish the VPN connection.

[ More Info ]

[/os/windows/win7] permanent link

Fri, Nov 10, 2017 5:19 pm

Removing a site's cookies in Google Chrome 62

To remove cookies for a specific site in Google Chrome version 62, take the following steps:

  1. Put chrome://settings/siteData in the Chrome address bar where you normally place URLs which will show you a list of all the cookies stored on the system.
  2. In the "Search cookies" field, type the relevant domain name, e.g., mattel.com; you will then see only the cookies for that particular domain.
  3. Click on "REMOVE ALL SHOWN" to remove all of the cookies for the domain. You will then be warned "This will delete any data stored on your device for all the sites shown. Do you want to continue?" Click on the "CLEAR ALL" button to delete all of the cookies for the domain.

You can also go directly to the list of all the cookies associated with a particular domain by putting chrome://settings/cookies/detail?site= followed by the domain name in the address bar, e.g., chrome://settings/cookies/detail?site=mattel.com. You can then click on "REMOVE ALL" to delete all of the listed cookies for the domain.

Note: Tested with Google Chrome Version 62.0.3202.89 (Official Build) (32-bit) on a system running Microsoft Windows 7 Professional.

[ More Info ]

[/network/web/browser/chrome] permanent link

Sun, Oct 29, 2017 10:10 pm

Decoding base64-encoded text in a .eml file with Python

I received an email message from someone that contained an attachment that had a .eml filename extension. When I viewed that file, I found the usual email header fields, i.e., "from", "to", "cc", and "subject", but for the body of the message I saw the following:

Content-Type: multipart/alternative;
        boundary="_000_22D42B1E120C59488B6A96BA13E639711E185536NDMSMBX403ndcna_"
MIME-Version: 1.0

--_000_22D42B1E120C59488B6A96BA13E639711E185536NDMSMBX403ndcna_
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64

QXMgZmFyIGFzIG15IGxpbWl0ZWQgdW5kZXJzdGFuZGluZyBvZiB0aGUgbWFpbCBzZXJ2ZXJzIGdv
<text snipped>
YnNwOzwvbzpwPjwvc3Bhbj48L3A+DQo8L2Rpdj4NCjxwIGNsYXNzPSJNc29Ob3JtYWwiPjxvOnA+
Jm5ic3A7PC9vOnA+PC9wPg0KPC9kaXY+DQo8L2JvZHk+DQo8L2h0bWw+DQo=

--_000_22D42B1E120C59488B6A96BA13E639711E185536NDMSMBX403ndcna_--

I needed to decode the base64 encoded text. Fortunately, Python has a base64 module that can be used for that purpose. So I created the following Python script to decode the encoded portion of the .eml file. The script expects the name of the input file to be provided on the command line and will print an error message and terminate if the file name isn't provided. If the filename is provided, the script will read the file line by line looking for the "Content-Transfer-Encoding: base64" which indicates that after one following blank line the encoded text will commence. The output will be displayed on the screen but can be redirected to a file.

#!/usr/bin/python

import base64, sys

try:
   sys.argv[1]
except IndexError:
   print "Error - missing input file name! Usage", sys.argv[0], "infile"
   sys.exit(1)
else:
   fileName = sys.argv[1]

base64_marker = "Content-Transfer-Encoding: base64"
block_of_lines = ""

with open(fileName) as input_data:
    # Skips text before the beginning of the base64 encoded block:
    for line in input_data:
        if line.strip() == 'Content-Transfer-Encoding: base64':
            break
    for line in input_data:  # Skip blank line
            break
    # Reads text until the end of the block:
    for line in input_data:  # Append lines to block_of_lines
        block_of_lines = block_of_lines + line
    print base64.b64decode(block_of_lines)

[/languages/python] permanent link

Sat, Oct 28, 2017 10:45 pm

Checking operating system information with WMIC

You can use wmic os get commands on a Microsoft Windows system to view information related to the operating system via a command-line interface (CLI). E.g., to determine the version of the operating system you can issue the command Windows Management Instrumentation Command-line (WMIC) command wmic os get version.

C:\Users\Public>wmic os get version
Version
10.0.15063


C:\Users\Public>

Or if you know the system is running a particular version of the Windows operating system, e.g., Windows 10, but want to see just the build number for that version of Windows, you could issue the command wmic os get BuildNumber.

C:\Users\Public>wmic os get BuildNumber
BuildNumber
15063


C:\Users\Public>

[ More Info ]

[/os/windows/commands/wmic] permanent link

Wed, Oct 25, 2017 10:36 pm

Viewing the fonts used in a PDF document on a Mac OS X system

To view the list of documents contained in a PDF document with Adobe Acrobat Reader DC on a Mac OS X system, with the file open in Acrobat Reader DC, click on File then select Properties and then click on the Fonts tab.

Adobe Acrobat Reader DC fonts list

[ More Info ]

[/os/os-x] permanent link

Sun, Oct 22, 2017 11:09 pm

Text not printing, PowerShell cmdlets not working, etc.

A user reported that when she printed Microsoft Excel spreadsheets or QuickBooks invoices, no text would appear on the printouts. She had reported the same problem about a month ago. When I rebooted the system then, the problem went away, but this time rebooting didn't help. After I requested that she reboot the system, I was told the problem remained, so when I was able to get to the system to troubleshoot, I first checked to make sure the system had been rebooted rather than QuickBooks simply being restarted. It was then that I noticed a lot of other functionality was no longer available. E.g., when I tried to use the systeminfo command to find the last reboot time, I saw an error message instead of the time the system was last rebooted.

Microsoft Windows [Version 10.0.15063]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\Pam>systeminfo | find /i "Boot"
Loading Operating System Information ...ERROR: Invalid class

C:\Users\Pam>systeminfo
Loading Operating System Information ...ERROR: Invalid class

C:\Users\Pam>wmic os get lastbootuptime
os - Alias not found.

C:\Users\Pam>

[ More Info ]

[/os/windows/win10] permanent link

Sat, Oct 21, 2017 10:13 pm

Using PowerShell to determine the installed version of Windows

You can determine the version of Microsoft Windows installed on a system from a PowerShell prompt using [System.Environment]::OSVersion.Version or (Get-WmiObject -class Win32_OperatingSystem).Caption.

PS C:\Users\Public> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      15063  0


PS C:\Users\Public> (Get-WmiObject -class Win32_OperatingSystem).Caption
Microsoft Windows 10 Pro
PS C:\Users\Public> (Get-WmiObject -class Win32_OperatingSystem)


SystemDirectory : C:\WINDOWS\system32
Organization    : Microsoft
BuildNumber     : 15063
RegisteredUser  : Jeanne
SerialNumber    : 00330-80000-00000-AA775
Version         : 10.0.15063



PS C:\Users\Public>

[ More Info ]

[/os/windows/PowerShell] permanent link

Fri, Oct 20, 2017 10:57 pm

Querying disks with the PowerShell Get-Disk cmdlet

You can use the PowerShell Get-Disk cmdlet to query disk drives within or attached to a PC running the Microsoft Windows operating system. E.g.:

PS C:\Users\Public> Get-Disk

Number Friendly Name Serial Number                    HealthStatus         OperationalStatus      Total Size Partition
                                                                                                             Style
------ ------------- -------------                    ------------         -----------------      ---------- ----------
0      ST3320418AS               9VMNNJDN             Healthy              Online                  298.09 GB MBR
4      Generic- C... 058F63626421                     Healthy              No Media                      0 B RAW
6      Generic- M... 058F63626423                     Healthy              No Media                      0 B RAW
3      Generic- S... 058F63626420                     Healthy              No Media                      0 B RAW
5      Generic- S... 058F63626422                     Healthy              No Media                      0 B RAW
1      Lexar USB ... AA58ZF9FJCCALAOA                 Healthy              Online                   14.92 GB MBR
2      WD My Pass... WXP1A27034VH                     Healthy              Online                  931.48 GB GPT


PS C:\Users\Public>

[ More Info ]

[/os/windows/PowerShell] permanent link

Sat, Oct 14, 2017 8:59 pm

Text_factory that can support 8-bit bytestrings

I wrote a Python script that will download a webpage, extract a portion of the text displayed on the page and write the extracted portion to an SQLite database. When I ran the script, I saw the message below displayed:

You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings.

I had created the following function to establish the connection to the SQLITE 3 database:

def create_connection (db_file):
   """ Create a database connection to an SQL database
       Return connection object or none """
   try:
      conn = sqlite3.connect(db_file)
      return conn
   except Exception as e:
      print(e)
   return None

[ More Info ]

[/languages/python] permanent link

Fri, Oct 13, 2017 10:59 pm

Checking the uptime for a Windows system using PowerShell

If you want to determine how long a Microsoft system has been running since it was last rebooted from a command-line interface (CLI), you can do so using PowerShell. You can do so by subtracting the last boot time from the current date and time. The Get-Date cmdlet shows the current date and time and (Get-CimInstance Win32_OperatingSystem).LastBootUpTime shows the last time the system was booted.

PS C:\Users\public\documents> (Get-CimInstance Win32_OperatingSystem).LastBootUpTime

Tuesday, October 10, 2017 9:12:14 PM


PS C:\Users\public\documents> (Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime


Days              : 3
Hours             : 1
Minutes           : 29
Seconds           : 26
Milliseconds      : 717
Ticks             : 2645667172021
TotalDays         : 3.06211478243171
TotalHours        : 73.4907547783611
TotalMinutes      : 4409.44528670167
TotalSeconds      : 264566.7172021
TotalMilliseconds : 264566717.2021



PS C:\Users\public\documents>

You can use the alias GCIM for Get-CimInstance to save some typing, if you wish.

PS C:\Users\public\documents> (GCIM Win32_OperatingSystem).LastBootUpTime

Tuesday, October 10, 2017 9:12:14 PM


PS C:\Users\public\documents>

[/os/windows/PowerShell] permanent link

Wed, Oct 11, 2017 10:20 pm

Error stating Outlook OST file is in use and cannot be accessed

After I rebooted a Windows 10 PC subsequent to a software update on the system, when I attempted to reopen Microsoft Outlook 2016, I saw the message below:

Outlook Data File


Black exclamation
mark in yellow triangle The file C:\Users\jasmith1\AppData\Local\Microsoft\Outlook\john.a.smith@exmple.com.ost is in use and cannot be accessed. Close any application that is using this file, and then try again. You might need to restart your computer.

[ More Info ]

[/network/email/clients/outlook/2016] permanent link

Tue, Oct 10, 2017 11:31 pm

Wget and curl functionality via PowerShell on a Windows system

If you are accustomed to using the wget or cURL utilities on Linux or Mac OS X to download webpages from a command-line interface (CLI), there is a Gnu utility, Wget for Windows , that you can download and use on systems running Microsoft Windows. Alternatively, you can use the Invoke-WebRequest cmdlet from a PowerShell prompt, if you have version 3.0 or greater of PowerShell on the system. You can determine the version of PowerShell on a system by opening a PowerShell window and typing $psversiontable. E.g., in the example below from a Windows 10 system, the version of PowerShell is 5.1.15063.674.

PS C:\Users\public\documents> $psversiontable

Name                           Value
----                           -----
PSVersion                      5.1.15063.674
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15063.674
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\Users\public\documents>

If you have version 3.0 or later, you can use wget or curl as an alias for the Invoke-WebRequest cmdlet, at least up through version 5.x. E.g., if I want to download the home page for the website example.com to a file named index.html, I could use the command wget -OutFile index.html http://example.com at a PowerShell prompt. Or I could use either of the following commands, instead:

curl -OutFile index.html http://example.com
Invoke-WebRequest -OutFile index.html http://example.com

[ More Info ]

[/os/windows/PowerShell] permanent link

Mon, Oct 09, 2017 11:13 pm

Checking the version of a Dynamic Link Library (DLL) file

You can check version information for a Dynamic-link Library (DLL) file, i.e., a file with a .dll filename extension, or a executable file, i.e., a .exe file, from a command-line interface (CLI) on a Microsoft Windows system by using the Get-Item cmdlet. E.g.:

PS C:\> (Get-Item C:\Windows\explorer.exe).VersionInfo

ProductVersion   FileVersion      FileName
--------------   -----------      --------
10.0.15063.0     10.0.15063.0 ... C:\Windows\explorer.exe


PS C:\>

If you can't see all of the information, i.e., if you see three dots indicating that not all of the information is displayed, you can append | format-list to the command to have the output displayed in list format.

PS C:\> (Get-Item C:\Windows\explorer.exe).VersionInfo | format-list


OriginalFilename  : EXPLORER.EXE.MUI
FileDescription   : Windows Explorer
ProductName       : Microsoft® Windows® Operating System
Comments          :
CompanyName       : Microsoft Corporation
FileName          : C:\Windows\explorer.exe
FileVersion       : 10.0.15063.0 (WinBuild.160101.0800)
ProductVersion    : 10.0.15063.0
IsDebug           : False
IsPatched         : False
IsPreRelease      : False
IsPrivateBuild    : False
IsSpecialBuild    : False
Language          : English (United States)
LegalCopyright    : © Microsoft Corporation. All rights reserved.
LegalTrademarks   :
PrivateBuild      :
SpecialBuild      :
FileVersionRaw    : 10.0.15063.608
ProductVersionRaw : 10.0.15063.608



PS C:\>

[ More Info ]

[/os/windows/PowerShell] permanent link

Sun, Oct 08, 2017 10:57 pm

Calculating file checksums on an OS X system

If you need to calculate a checksum, aka cryptographic hash value or digital fingerprint, on a Mac OS X system, you can use the md5 command to calculate a MD5 checksum, which is equivalent to the md5sum utility on Linux systems, and the shasum command to calculate Secure Hash Algorithms (SHA). The default value for shasum, if no algorithm is specified, is Secure Hash Algorithm 1 (SHA-1), but you can specify other algorithms, such as Secure Hash Algorithm 2 (SHA-2), e.g. SHA-256, using the -a option. E.g. -a 256 for SHA-256.

[ More Info ]

[/os/os-x] permanent link

Sat, Oct 07, 2017 10:59 pm

Determining the day of year value using Python

I sometimes need to determine the day of the year corresponding to today's date. The day of year starts with January 1 as day 1 and for 2017, December 31 is day 365. You can find sites online that will provide those values, e.g. Day Numbers for 2017 or NOAA's DOY Calendar. Or, on a system with Python installed, e.g., Linux or OS X, you can use the datetime module to obtain the day of the year corresponding to the current date as shown below:

$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> datetime.datetime.today().timetuple().tm_yday
280
>>> exit()
$

Since today is October 7 of the year 2017, the day of the year is 280.

If you want to obtain the day of year (DOY) for another date, you can use datetime.date(year, month, day).timetuple().tm_yday where year is the relevant year, month is the month, and day is the day of interest. E.g., March 1, 2017 is DOY 60:

>>> import datetime
>>> datetime.date(2017, 3, 1).timetuple().tm_yday
60
>>>

[/languages/python] permanent link

Fri, Oct 06, 2017 11:15 pm

Viewing DHCP information on an OS X system

If you want to determine the IP address of the DHCP server from which a Mac OS X system received its IP address, subnet mask, etc., you can obtain that information from a command-line interface (CLI), i.e., a Terminal window by using the command ipconfig getpacket interface where interface is the relevant network interface, which will usually be en0 or en1. You can issue the command ifconfig -a in a Terminal window to see the network interfaces on the system and which have IP addresses assigned to them.

getpacket interface-name
Prints to standard output the DHCP/BOOTP packet that the client accepted from the DHCP/BOOTP server. This command is useful to check what the server provided, and whether the values are sensible. This command outputs nothing if DHCP/BOOTP is not active on the interface, or the attempt to acquire an IP address was unsuccessful.

[ More Info ]

[/os/os-x] permanent link

Sun, Oct 01, 2017 10:53 pm

Finding Gmail SMTP entries in Sendmail log files

I wanted to determine how many connections I was receiving per day from Gmail Simple Mail Transfer Protocol (SMTP) servers to my email server running Sendmail on a CentOS Linux system and the IP addresses of the Gmail servers that were sending email to users on my server. So I created a simple Python script to search for lines in the maillog file, /var/log/maillog for any lines containing "relay" and "google.com" on the same line, since the Gmail servers are in Google's domain.

[ More Info ]

[/languages/python] permanent link

Fri, Sep 29, 2017 11:04 pm

Extracting data from a corrupted zip file with jar or repairing it

I received a zip file containing data captured with tcpdump on a Linux system. When I tried to open the zip file on my MacBook Pro laptop running OS X El Capitan by double-clicking on the file within the Finder, I saw an "unable to expand" error message stating "Error 2 - No such file or directory." A Microsoft Windows user who downloaded the same zip file reported that he was unable to open it, either. When I tried to unzip the file from a Terminal window using the unzip utility, I saw an "End-of-central directory signature not found" error message.

$ file AS2_Captures.zip
AS2_Captures.zip: Zip archive data, at least v2.0 to extract
$ unzip AS2_Captures.zip 
Archive:  AS2_Captures.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of AS2_Captures.zip or
        AS2_Captures.zip.zip, and cannot find AS2_Captures.zip.ZIP, period.
$

[ More Info ]

[/software/utilities/file] permanent link

Tue, Sep 26, 2017 11:01 pm

Running the Chromium browser on a Linux system

Chromium is a free and open-source (FOSS) web browser that is very similar to the Google Chrome browser, though with some differences. Google started the Chromium project as a means to provide the source code for the proprietary Google Chrome browser. The Chromium Project is headed by Google developers with input from community developers.

If you wish to use the Chromium browser on a CentOS Linux system, you can install it by running the command yum install chromium from the root account. You can check if it is already installed on a CentOS system with rpm -qi chromium.

$ rpm -qi chromium
Name        : chromium
Version     : 60.0.3112.113
Release     : 2.el7
Architecture: x86_64
Install Date: Tue 26 Sep 2017 10:35:46 AM EDT
Group       : Unspecified
Size        : 106438445
License     : BSD and LGPLv2+ and ASL 2.0 and IJG and MIT and GPLv2+ and ISC and OpenSSL and (MPLv1.1 or GPLv2 or LGPLv2)
Signature   : RSA/SHA256, Tue 29 Aug 2017 08:00:23 AM EDT, Key ID 6a2faea2352c64e5
Source RPM  : chromium-60.0.3112.113-2.el7.src.rpm
Build Date  : Mon 28 Aug 2017 08:21:06 PM EDT
Build Host  : buildvm-22.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://www.chromium.org/Home
Summary     : A WebKit (Blink) powered web browser
Description :
Chromium is an open-source web browser, powered by WebKit (Blink).
$

[ More Info ]

[/network/web/browser/chromium] permanent link

Fri, Sep 22, 2017 11:18 pm

Failed POP3 login attempts from 94.136.51.56

While checking the mail log file, /var/log/maillog, on an email server today, I noticed an attempted login from an IP address in an address range I didn't recognize. The entry in the log file contained the following text:

dovecot: pop3-login: Disconnected (tried to use disallowed plaintext auth): user=<>, rip=94.136.51.56

I checked the country associated with the 94.136.51.56 IP address (ds7247.dedicated.turbodns.co.uk) with geoiplookup (you can install the GeoIP package on a CentOS Linux system with yum install GeoIP) and found it was an address assigned to an entity in Great Britain.

$ geoiplookup 94.136.51.56
GeoIP Country Edition: GB, United Kingdom
$

[ More Info ]

[/security/attacks/pop3] permanent link

Mon, Sep 18, 2017 11:16 pm

Excel - This file is locked for editing

If you see an error message like the one below, which was produced by Microsoft Excel for Mac 2016 on a Mac OS X system, even though you don't have the file open currently, then you will need to delete the lock file, which should be in the same directory as the spreadsheet.

This file is locked for editing.

Locked by: John Doe
Filename: SGRS_2017.xlsm

You can open the file as read-only.

  

The lock file will have the same name as the workbook you were trying to open, but the file name will have ~$ prepended to it. To delete the file you will need to "escape" the meaning of the dollar sign by putting an escape character, i.e., a backslash character, immediately before the dollar sign. I.e., use ~\$ as shown below:

$ ls -alg **SGRS_2017.xlsm
-rw-rw-r--@ 1 ABC\Domain Users  761327 Sep 13 15:57 SGRS_2017.xlsm
-rw-rw-r--@ 1 ABC\Domain Users     171 Sep 18 22:46 ~$SGRS_2017.xlsm
$ rm ~$SGRS_2017.xlsm
rm: ~.xlsm: No such file or directory
$ rm ~\$SGRS_2017.xlsm
$

Once the lock file has been deleted, you should be able to open the file without the warning message that it is locked for editing.

[/software/office/excel] permanent link

Sun, Sep 17, 2017 11:09 pm

Determining the version of Microsoft Edge on a Windows system

You can obtain the version of the Microsoft Edge browser on a Windows system using the Get-AppXPackage cmdlet with Get-AppXPackage -Name Microsoft.MicrosoftEdge.

PS C:\> Get-AppXPackage -Name Microsoft.MicrosoftEdge


Name              : Microsoft.MicrosoftEdge
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : Neutral
ResourceId        :
Version           : 40.15063.0.0
PackageFullName   : Microsoft.MicrosoftEdge_40.15063.0.0_neutral__8wekyb3d8bbwe
InstallLocation   : C:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.MicrosoftEdge_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
IsPartiallyStaged : False



PS C:\>

If you just want to see the version number and not the additional information, you can add "| select Version" at the end of the command.

PS C:\> Get-AppXPackage -Name Microsoft.MicrosoftEdge | select Version

Version
-------
40.15063.0.0


PS C:\>

[/network/web/browser/edge] permanent link

Sat, Sep 16, 2017 11:05 pm

Determining the antivirus software on a Windows system from the command line

You can determine the antivirus software present on a system, if the antivirus software is registered with the Windows Security Center, using Windows Management Instrumentation Command-line (WMIC). E.g., for a Windows 10 system using Microsoft Windows Defender:

C:\>WMIC /Node:localhost /Namespace:\\root\SecurityCenter2 Path AntiVirusProduct Get displayName
displayName
Windows Defender


C:\>

[ More Info ]

[/os/windows/commands/wmic] permanent link

Fri, Sep 15, 2017 11:04 pm

AskPartnerNetwork Directory on a Windows 10 system

A user reported her Windows 10 Professional system was running slowly. On September 14, 2017, I checked the system with SUPERAntispyware, which reported that it found the Ask Toolbar. It reported the following items associated with the toolbar:

C:\ProgramData\ASKPARTNERNETWORK\TOOLBAR
HKCU\Software\AskPartnerNetwork\Toolbar
C:\ProgramData\AskPartnerNetwork

[ More Info ]

[/security/scans] permanent link

Tue, Sep 12, 2017 10:58 pm

Adding an item to a list in Python without duplicates

If you have a list in a Python script and wish to add new items to the list, you can use listname.append(newitem) where listname is the name of the list and newitem is the item you wish to add to the list. If you wish to add new items to the list only if they don't already exist in the list, you can avoid adding an existing entry to the list by checking if the entry is already in the list as shown below:

filenameList = []
if filename not in filenameList:
     filenameList.append(filename)

If you wish to know the length of a list, i.e., how many items are on the list, you can use print len(listname) where listname is the name of your list.

[/languages/python] permanent link

Sat, Sep 09, 2017 11:53 pm

Backing up a MySQL or MariaDB table or database

You can backup a table in a MySQL or MariaDB database by using the mysqldump backup tool included with both database management systems. To backup a specific table you can use the command mysqldump database_name table_name where database_name is the name of the database that contains the table and table_name is the name of the particular table you wish to backup. E.g.:

mysqldump -u ptolemy -p Planets Mars > Mars.sql

In the above case, if I have a database named Planets with a table within it named Mars, I could backup just that one table from the database with the command above. The -u option to the command allows you to specify a MySQL/MariaDB username that has access to the database and the -p option will prompt you for the password associated with that username. The Mars.sql file will then contain all of the Structured Query Language (SQL) commands needed to recreate the table structure and the data in the table. E.g., it will contain insert SQL commands that will insert entries in the table.

[ More Info ]

[/software/database/mysql] permanent link

Fri, Sep 08, 2017 10:21 pm

Display a webpage from a Python script

If you just want to display text on a webpage from a Python script, a simple way to print to a web page is shown in the script below:

#!/usr/bin/python

print "Content-type: text/plain\n"
print "Hello world"

If you want to display HTML code, you can use Python code like the following:

#!/usr/bin/python

print "Content-type: text/html"
print
print """<!DOCTYPE HTML>
<html lang="en">
<body>
<h1>Hello World!</h1>
</body>
</html>
"""

[ More Info ]

[/languages/python] permanent link

Thu, Sep 07, 2017 10:38 pm

Looping over a set of files in the Bash shell on Linux or OS X

I have a Python script, filetype.py, that takes a file name as a parameter. I use the script to identify if a file with a .bin extension is actually a Microsoft Visio or PowerPoint file. I run the script on an OS X system from a Terminal window where I have a Bash shell prompt. E.g.:

$ ~/Documents/bin/filetype.py oleObject1.bin
Microsoft Office PowerPoint
$

But I often want to have it check all of the .bin files in a directory. You can loop through all files in a directory or a set of files using a Bash for loop. E.g., to check all of the .bin files in a directory I could use the for-loop below:

$ ls *
oleObject1.bin	oleObject3.bin	oleObject5.bin
oleObject2.bin	oleObject4.bin	oleObject6.bin
$ for f in *.bin; do ~/Documents/bin/filetype.py $f; done
Microsoft Office PowerPoint
Microsoft Office PowerPoint
Microsoft Office PowerPoint
Microsoft Visio
Microsoft Visio
oleObject6.bin: CDF V2 Document, No summary info

$

[ More Info ]

[/os/unix/bash] permanent link

Wed, Sep 06, 2017 11:57 pm

GoDaddy continues to show "Loading..." when composing email

Someone who uses GoDaddy for her email reported to me today that she couldn't send email. I logged into her account from another system and was able to send email to myself. When I notified her that I had been able to send email from her acount to myself, she sent an email to me, but reported it was still stating "loading" when she hit the send button. So tonight I logged into her system and opened the Firefox browser, since she uses that browser to send and receive email. When I clicked on Compose, I saw a "Loading..." message in the body of the email that wouldn't go away unless I clicked on the Plain Text tab to switch from "Rich Text", which allows one to format text in the message with bolding, font colors, etc., to "Plain Text". But when I switched back to "Rich Text", I had problems typing my email address in the "To" field with only one letter appearing in the "To" field no matter how many letters I typed.

[ More Info ]

[/network/email/godaddy] permanent link

Tue, Sep 05, 2017 10:55 pm

Using the PowerShell Get-WmiObject cmdlet to get BIOS information

You can get BIOS information on a system running the Microsoft Windows operating system using the PowerShell cmdlet Get-WmiObject cmdlet. E.g.

PS C:\> Get-WmiObject win32_bios


SMBIOSBIOSVersion : FB
Manufacturer      : Award Software International, Inc.
Name              : Award Modular BIOS v6.00PG
SerialNumber      :
Version           : GBT    - 42302e31



PS C:\>

[ More Info ]

[/os/windows/PowerShell] permanent link

Mon, Sep 04, 2017 10:42 pm

Obtaining monitor information from a PowerShell Prompt

If you need to know information about the manufacturer and model number of a monitor on a Microsoft Windows system, you may be able to obtain it from a PowerShell prompt using the Get-WmiObject cmdlet as shown below:

PS C:\> Get-WmiObject win32_desktopmonitor


DeviceID            : DesktopMonitor1
DisplayType         :
MonitorManufacturer : HP
Name                : HP S2031 Series Wide LCD Monitor
ScreenHeight        :
ScreenWidth         :



PS C:\>

[ More Info ]

[/os/windows/PowerShell] permanent link

Sun, Sep 03, 2017 10:36 pm

SORBS blocking email from AOL

I manage a Linux server that functions as an email server using the free and open source software (FOSS) package sendmail. I provide a mechanism through the server for someone who has Verizon as his Internet Service Provider (ISP) to send monthly newsletters by email to an organization that has about thirteen hundred members on its email distribution list, since he can't send to that number of people through his ISP-provided email service. I do so by providing an email alias on my server, e.g., thelist@example.com that he puts in the BCC line of his email. The alias is stored in /etc/aliases and points to a text file containing the list of all members' email addresses. So his ISP-provided SMTP server sees only the one address, thelist@example.com, which results in an email message to the server I manage that then translates that address into the approximately 1,300 email addresses of members and sends the newsletter to all members.

But this month the user reported he had sent the message, but it had not been delivered to recipients. I first checked the server's mail log, /var/log/maillog, for any occurrences of his email address for the day he reported the problem. I use several free DNS-based Blackhole List (DNSBL) services to reduce the amount of spam that reaches user's inboxes, so I suspected that one of those services had blocked email from the SMTP server through which he was sending his message, even though I had whitelisted his email address quite some time ago by adding a line like the following one to /etc/mail/access and then running the command makemap hash /etc/mail/access </etc/mail/access.

slartibartfast123987@verizon.net	OK

I didn't find any references to his email address in the /var/log/mail file, so I asked him to resend the message. I still didn't see any references to his email address in the /var/log/maillog file, but I did see that SORBS had blocked email from an America Online (AOL) server at the time he sent the message.

[ More Info ]

[/network/email/spam/sorbs] permanent link

Sat, Sep 02, 2017 10:14 pm

Task management with Taskwarrior

I wanted a simple easy to use application for managing my todo list that was free and open source software (FOSS) which I could install on Linux systems, but which might also be available for other operating systems as well. There are online, commercial alternatives, but I wanted something I could put on my own systems with no fear that my data might disappear should a commercial entity not remain commercially viable. I found Taskwarrior, an open-source, cross platform time and task management tool with a command-line interface (CLI). The command line interface is helpful to me since I'm often working on systems via a Secure Shell (SSH) connection and would like to be able to add to my task list on those systems without using a graphical user interface (GUI).

I wanted to first install it on a CentOS Linux system. It isn't in the default software repositories for CentOS, but if you configure a CentOS system to use the EPEL repository, you can easily install the Taskwarrior package using yum with yum install task.

[ More Info ]

[/software/projmgmt] permanent link

Fri, Sep 01, 2017 11:06 pm

PowerShell Get-Printer Cmdlet

If you want to know what options you have for printing files on a Microsoft Windows system, e.g., perhaps you want a list of currently avaialble printers or even want to know the IP addresses by which some printers are accessible, the PowerShell Get-Printer cmdlet may provide the information you are seeking. E.g.:

PS C:\Users\Pam> Get-Printer

Name                           ComputerName    Type         DriverName                PortName        Shared   Published
----                           ------------    ----         ----------                --------        ------   ---------
Microsoft XPS Document Writ...                 Local        Remote Desktop Easy Print TS002           False    False
Send To OneNote 2013 (redir...                 Local        Remote Desktop Easy Print TS003           False    False
Quicken PDF Printer (redire...                 Local        Remote Desktop Easy Print TS001           False    False
Send To OneNote 2010                           Local        Send To Microsoft OneN... nul:            False    False
Ricoh Aficio MP C2500 PCL5c                    Local        Ricoh Aficio MP C2500 ... 192.168.0.90    True     False
Microsoft XPS Document Writer                  Local        Microsoft XPS Document... PORTPROMPT:     False    False
Microsoft Print to PDF                         Local        Microsoft Print To PDF    PORTPROMPT:     False    False
HP Deskjet 6940 series                         Local        HP Deskjet 6940 series    192.168.0.9     True     False
Fax                                            Local        Microsoft Shared Fax D... SHRFAX:         False    False
Adobe PDF                                      Local        Adobe PDF Converter       Documents\*.pdf False    False
ABS PDF Driver v400                            Local        Amyuni Document Conver... LPT1:           False    False


PS C:\Users\Pam>

[ More Info ]

[/os/windows/PowerShell] permanent link

Sun, Aug 27, 2017 11:14 pm

Displaying date and time information on a Microsoft Windows system

You can use the date and time commands on a Microsoft Windows system to display current date and time information:

C:\Users\Lila>date /t
Sat 08/26/2017

C:\Users\Lila>time /t
02:07 PM

C:\Users\Lila>

Placing /t after the commands results in the current date and time information being displayed without an accompanying prompt to change the current settings.

You can display the information in a different format using the Windows Management Instrumentation Command-line (WMIC) command shown below:

C:\Users\Lila>wmic path win32_utctime get * /format:list


Day=26
DayOfWeek=6
Hour=18
Milliseconds=
Minute=16
Month=8
Quarter=3
Second=19
WeekInMonth=4
Year=2017




C:\Users\Lila>

[ More Info ]

[/os/windows/commands] permanent link

Sat, Aug 26, 2017 9:29 pm

Querying a MariaDB or MySQL database using Python

On a CentOS Linux system, I have a MariaDB (MariaDB is a fork of MySQL) database named "Books" that contains a table named "Amazon" where I've stored information on books that includes their Amazon Standard Identification Number (ASIN). I want to be able to run a Python script to which I provide a word as a command line argument and have the script find all books in that database table that have a title containing that word and to print the title, which is stored in a column named "Description" along with the ASIN, which is stored in a column named "ASIN". To do so, I use a script with the following code:

#!/usr/bin/python

import mysql.connector, sys

def executeSQL(conn, queryTerm):
    cursor = conn.cursor()
    query = "select ASIN, Description from Amazon where Description like " + queryTerm
    cursor.execute(query)
    result = cursor.fetchall()    
    for row in result:
       print row[0], row[1]

hostname = 'localhost'
username = 'myAcctName'
password = 'ThePassword'
database = 'Books'

try:
   sys.argv[1]
except IndexError:
   print "Error - missing query word! Usage ./findBook queryWord"
   sys.exit(1)
else:
   queryWord = "'%" + sys.argv[1] + "%'" 

connection = mysql.connector.connect( host=hostname, user=username, passwd=password, db=database )
executeSQL(connection,queryWord)
connection.close()

[ More Info ]

[/languages/python] permanent link

Fri, Aug 25, 2017 11:11 pm

Wireshark - bandwidth usage and bytes by protocol

The free and open source packet analysis tool Wireshark provides many capabilities for analyzing network traffic. Among its capabilities is the capability to provide statistical information regarding captured network traffic. Looking at a pcap file with Wireshark for traffic captured during a data flow test, I saw what seemed to be a fair amount of Simple Network Management Protocol (SNMP) and Secure Shell (SSH) traffic with systems on an external network. I wanted to determine the actual percentage that traffic represented within the overall traffic during the test period. Fortunately, that is easy to do within Wireshark. One way to view statistics on bandwidth utilization by protocol while viewing captured data is by clicking on Statistics then selecting Protocol Hierarchy. Note: you may need to wait a little while for the statistics to be displayed if the amount of data to be processed is large.

[ More Info ]

[/network/tools/sniffing/wireshark] permanent link

Thu, Aug 24, 2017 11:01 pm

Firefox - Detect Captive Portal

When you start the Firefox web browser, it will attempt to determine if the network connection available to it when it starts is via a captive portal. If you use a hotel's Wi-Fi service, a free WiFi service provided by a restaurant or other business, or some other public WiFi service, when you first open your browser you may see a web page asking you to accede to terms of service, an acceptable use policy, or to provide some authentication information, e.g., perhaps your name and room number for a hotel, or to provide payment information if you are accessing a wireless service that is not free. You won't be able to go elsewhere on the web, at least not easily, until you deal with the demands/conditions specified on the captive portal page.

Firefox makes a determination on whether there is a captive portal constraint by attempting to download the file success.txt from http://detectportal.firefox.com/success.txt (there is only one word in that file, the word "success". If it can successfully retrieve that file, it can assume that it is not constrained by a captive portal. You can see such attempts using the free and open-source (FOSS) Wireshark packet analyzer utility by specifying a filter of "http.request.method == "GET".

[ More Info ]

[/network/web/browser/firefox] permanent link

Wed, Aug 23, 2017 11:36 pm

Determining a file's type from within a Python script

I needed a way to determine a file's type within a Python script when I can't rely on the file's extension to determine the file format. I'll be running the script on a MacBook Pro laptop running the OS X El Capitan operating system. OS X/macOS, like Linux, comes with the file command, so I could run that command at a shell prompt to have the utility check the magic number in the files I'm interested in, but I want to do some additional processing of the files within the Python script, so I want to perform the format check within Python. Python provides the subprocess module that provides the capability to "spawn new processes, connect to their input/output/error pipes, and obtain their return codes." So I can call the file utility from within Python using that module. To get the results from running a shell command, you use suprocess.Popen(). You can then set a variable to hold the results of .communicate() and print the contents of that variable as shown below. The script expects the name of the file to be checked to be provided as an argument on the command line.

#!/usr/bin/python

import subprocess as sub, sys

try:
   sys.argv[1]
except IndexError:
   print "Error - missing input file name! Usage ./filetype.py infile"
   sys.exit(1)
else:
   fileName = sys.argv[1]

p = sub.Popen(['file',fileName],stdout=sub.PIPE,stderr=sub.PIPE)
output, errors = p.communicate()
print output

[ More Info ]

[/languages/python] permanent link

Tue, Aug 22, 2017 11:18 pm

Signing out of Amazon on a system with a low resolution display

Sometimes I encounter difficulties signing out of an account on Amazon's website when I need to sign into another account, if the resolution of the display isn't great enough to allow me to see the bottom of Amazon's list of choices where the sign out option appears. If I need to logon on such a system, there's no problem. If I visit Amazon's home page, I can click on "Hello. Sign in Accounts & Lists" where I see a "Sign in" button.

Amazon account and lists

[ More Info ]

[/network/web/shopping] permanent link

Mon, Aug 21, 2017 11:15 pm

Find all occurrences of a string in a file using Python

I need to download and view Excel workbooks, Portable Document Format (PDF), and sometimes other types of documents related to work requests from a website. When I view a webpage for a particular work request, some of the documents may have been posted weeks or months ago while some are more recent, but when I download them they all get the timestamp of the time I downloaded them, but I would like to change the timestamps to match the timestamps on the website. On the webpage for a particular work request, I see the following information for files:

Type Name Site Modified Modified By
xlsm icon CRQ000000884164_PDSO -None- 3/6/2017 4:53 PM Smith, Gary
pdf icon CRQ000000884164_PDSO -None- 3/6/2017 4:52 PM Smith, Gary
pdf icon CRQ000000884164_DCS -None- 6/12/2017 9:29 AM Doe, Mike
xlsm icon CRQ 884164_SDP -None- 6/12/2017 9:30 AM Doe, Mike

[ More Info ]

[/languages/python] permanent link

Sun, Aug 20, 2017 10:05 pm

Remotely Restarting Windows Services or Systems

After a power outage, I found I was unable to connect to a Microsoft Windows 10 system from a Windows Server 2012 system on the local area network (LAN) using the Remote Desktop Protocol (RDP). When I tried to connect, I saw the message "Remote Desktop can't connect to the remote computer for one of these reasons..."

Remote Desktop Connection - can't connect

I knew the system had rebooted after the power outage, because I could ping it and see its shared folders using the command net view systemName where systemName is the system's name.

[ More Info ]

[/os/windows] permanent link

Fri, Aug 18, 2017 10:41 pm

Importing data from a text file into an SQLite database with Python

I need to track work requests that are associated with particular projects. The work requests are submitted through a website, but I want to be able to run queries on the data that aren't available to me from the website. So I decided to add a projects table to an existing SQLite database I have on my MacBook Pro laptop. I didn't want to manually enter a list of about 200 projects into the table, however, so I copied the projects list from the website into a text file. The webpage that lists all of the projects includes projects that are no longer valid and I want to include those in my database table, but note that they are longer valid. When I copy the data from the web page, I have lines like the following ones:

450 SN/GN Tech  Edit Delete
ACE     Edit Delete
ADO     Edit Undelete
AGO     Edit Delete
AGS     Edit Delete
AIM     Edit Delete
Artemis         Edit Undelete
ASF     Edit Delete
ATSC    Edit Undelete
AXAF    Edit Undelete
BATSE/Gro       Edit Undelete
CANDOS  Edit Undelete
CARA    Edit Delete
CD Manager      Edit Delete
CMF     Edit Undelete
CMOC    Edit Delete
CMS     Edit Undelete

The entries that are no longer valid have "Undelete" at the end of the line indicating the projects were deleted, but they can be undeleted.

I created a table in the database with the following columns all of which contain text data:

NameDescription AddedRemoved DeletedNotes

[ More Info ]

[/languages/python] permanent link

Thu, Aug 17, 2017 11:09 pm

Obtaining information on a system's motherboard with PowerShell

You can obtain information on the motherboard in a computer running Microsoft Windows using PowerShell by means of the Get-Ciminstance cmdlet with the command Get-Ciminstance Win32_Baseboard. E.g., the following example is from a Microsoft Windows 10 system.

PS C:\> get-ciminstance win32_baseboard


Manufacturer : Gigabyte Technology Co., Ltd.
Model        :
Name         : Base Board
SerialNumber :
SKU          :
Product      : GA-78LMT-S2P



PS C:\>

The manufacturer, model number, serial number, SKU, and product number will be displayed if that information can be queried from the motherboard. Note: not all parameters will be available for every motherboard as shown above. For another system, the serial number is available.

PS C:\> get-ciminstance win32_baseboard


Manufacturer : Dell Inc.
Model        :
Name         : Base Board
SerialNumber : .7XCTZ12.CN7016346F0331.
SKU          :
Product      : 088DT1



PS C:\>

You can restrict the displayed information to particular parameters by piping the output to select-object. E.g.:

PS C:\> get-ciminstance win32_baseboard | select-object manufacturer

manufacturer
------------
Gigabyte Technology Co., Ltd.


PS C:\> get-ciminstance win32_baseboard | select-ojbect manufacturer, product

manufacturer                  product
------------                  -------
Gigabyte Technology Co., Ltd. GA-78LMT-S2P


PS C:\>

Another command line alternative to using PowerShell is to use WMIC to determine motherboard information.

[/os/windows/PowerShell] permanent link

Wed, Aug 16, 2017 10:59 pm

Recovering a Comic Life file

My wife uses Comic Life 3 from Plasq. On a couple of occasions recently, when she was using the program on one Microsoft Windows 10 system while editing a Comic Life file stored on another Windows 10 system, when she tried to save the file over the local area network (LAN) to the other system, she saw "Finalizing Save. Please Wait." but the save operation didn't complete.

Comic Life 3 finalizing save

After a long period of time had gone by, I finally rebooted the system on which Comic Life was running, since I couldn't kill it with the Windows Task Manager. Fortunately, all of her work was not lost, however. When I checked the system on which the Comic Life file was stored, I saw a file with a comiclife.latest extension in addition to the one with the .comiclife extension Comic Life uses for files.

C:\> dir "C:\Users\Public\2017\08\2017-08-18\*comiclife*"
 Volume in drive C has no label.
 Volume Serial Number is 5C60-1B61

 Directory of C:\Users\Public\2017\08\2017-08-18

08/15/2017  12:34 PM        40,099,848 Week33.comiclife
08/15/2017  12:51 PM        48,691,208 Week33.comiclife.latest
               2 File(s)     88,791,056 bytes
               0 Dir(s)  2,766,325,518,336 bytes free

C:\>

I moved the file with the .comiclife extension to another directory and renamed the Week33.comiclife.latest file to Week33.comiclife - I received the normal warning Windows displays when changing a filename extension, but proceeded.

Warning for changing file extension

I was then able to open the renamed file in Comic Life and recover the latest changes she had made to the file. This is the second time I've had to go through this process to recover her work in Comic Life due to Comic Life not completing the "finalizing save" step, but the incidences may have been due to a network issue.

[/software/comics/comiclife] permanent link

Tue, Aug 15, 2017 10:07 pm

Saving an email message to a file in mutt

Mutt is a text-based email client for Linux and Unix-like systems. If you want to save a particular message to a file in mutt, you can select the message then hit the v (the lowercase letter) key. In mutt, the letter is used for "view-attachments", but you can also use it to save the body of an email message to a file. If you hit the s key with the message selected or while viewing the message, you will see "<no description>" next to the number 1. If the email has any attachments they will be numbered from 2 upwards. With the first entry, i.e. the one labeled "<no description>" selected, if you hit the letter s (lowercase letter), you will see "Save to file:"

Mutt - save to file

Type the file name you wish the message to be saved under after "Save to file:" After saving the file, you can hit q several times to get back to the shell prompt. The message will be in the current directory. The file will only contain the contents of the message, not the message header, i.e., you won't see from, to, and subject lines.

[/network/email/clients/mutt] permanent link

Sun, Aug 13, 2017 10:24 pm

Symantec OCSP - gn.symcd.com

I opened HTTPNetworkSniffer, a packet capture tool developed by Nir Sofer and available from his NorSoft site, today on a Microsoft Windows system. While it was open I visited this website using the Firefox browser on the system and happened to switch back to the HTTPNetworkSniffer window where I noticed an unexpected connection to gn.symcd.com.

HTTPNetwork Sniffer - gn.symcd.com

[More Info ]

[/network/ocsp] permanent link

Sat, Aug 12, 2017 11:03 pm

Using SFC to troubleshoot missing or corrupted system files on Windows Vista

The System File Checker (SFC) tool (sfc.exe) will check the operating system for missing or corrupted files. To use the tool on a Windows Vista system, take the following steps:
  1. Obtain a command prompt by clicking on the Windows logo button normally at the lower left-hand corner of the screen, then select Programs, Accessories, right-click on Command Prompt and choose "Run as administrator". When prompted for permission to continue, click on the Continue button.
  2. At the command prompt, type the command sfc /scannow and hit Enter.

At the conclusion of the scanning process, you will be informed whether any problems were detected.

C:\Windows\system32>sfc/scannow

Beginning system scan.  This process will take some time.

Beginning verification phase of system scan.
Verification 100% complete.

Windows Resource Protection did not find any integrity violations.

C:\Windows\system32>

If there were problems that could not be repaired, you can find information on them by checking the log file produced by the System File Checker tool. The log file is %windir%\Logs\CBS\CBS.log. On most systems, %windir% will be C:\Windows. Typing echo %windir% at a command prompt will show you the directory for the variable. You can open the file in Notepad by typing the command notepad %windir%\Logs\CBS\CBS.log at the command prompt you got by following the steps above.

Or you can use the following steps To determine which files could not be repaired by the System File Checker tool:

  1. Obtain a command prompt with administrator privileges as above by right-clicking on Command Prompt, which is found under Programs then Accessories, and choosing "Run as administrator."
  2. Then type the command findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >%userprofile%\Desktop\sfcdetails.txt and hit Enter. That will extract relevant entries from the CBS.log file and place them in the file sfcdetails.txt on the Desktop of the user account you are using when you run the command.

    Microsoft Windows [Version 6.0.6002]
    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
    
    C:\Windows\system32>
    
    Microsoft Windows [Version 6.0.6002]
    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
    
    C:\Windows\system32>findstr /c:"[SR]" %windir%\Logs\CBS\CBS.log >%userprofile%\D
    esktop\sfcdetails.txt

Note The Sfcdetails.txt file contains details from every time that the System File Checker tool has been run on the computer. The file includes information about files that were not repaired by the System File Checker tool. Verify the date and time entries to determine the problem files that were found the last time that you ran the System File Checker tool. You can find the file on the Windows desktop or click on the Windows Start button, select Search, then For Files or Folders, then type sfcdetails.txt in the search field to search for the file.

References:

  1. How to use the System File Checker tool to troubleshoot missing or corrupted system files on Windows Vista or on Windows 7
    Microsoft Support

[/os/windows/vista] permanent link

Fri, Aug 11, 2017 8:42 pm

Using SQL Inner Join

I have an SQLite database stored on my MacBook Pro laptop that I use to track work requests. The database file is named CRQ.db, since it tracks work done under a Change Request (CRQ). Within that database are several tables two of which are "Equipment" and "Device". For every CRQ that I need to deal with, I store information on equipment that is affected by the CRQ. The equipment table has the following structure:

NameType
CRQText
DeviceText
ProjectText
NotesText

The device field holds a unique name assigned to the particular device. A device may be affected by more than one CRQ, so it can, potentially, occur multiple times in the table. A CRQ can affect multiple pieces of equipment.

The device table has the following structure:

NameType
DescriptionText Unique
ManufacturerText
ModelText
SiteText
BuildingText
RoomText
NotesText

[ More Info ]

[/software/database/sql] permanent link

Thu, Aug 10, 2017 9:26 pm

Using PowerShell to obtain process information

You can use the Get-CimInstance cmdlet at a PowerShell prompt to obtain information on processes running on a Microsoft Windows system. E.g., to see a list of all the processes currently running on a system, the command gcim win32_process can be used; gcim is an alias for Get-CimInstance, so you can use the shorter alias or Get-CimInstance. The name of the process, its process identifier (PID), handle count, working set size, and virtual memory size are displayed.

[ More Info ]

[/os/windows/PowerShell] permanent link

Wed, Aug 09, 2017 10:26 pm

Installing the Evernote extension for Microsoft Edge

If you wish to be able to save webpages with the Evernote web clipper inside the Microsoft Edge browser, you can install the Evernote extension using the following steps:
  1. Inside the Edge browser, click on the row of 3 dots that appears at the upper, right-hand corner of the browser window.
  2. Select Extensions.
  3. Then click on Get extensions from the Store.
  4. Look for Evernote in the list of extensions and click on it to install the Evernote extension for Edge.
  5. You will then see details on the extension, which is free. Click on Get.
  6. Once it is installed, you can click on the Launch button.

[ More Info ]

[/network/web/browser/edge] permanent link

Tue, Aug 08, 2017 8:39 pm

Windows 10 stuck on scanning and repairing drive

To check on a potential file system corruption issue on a Microsoft Windows 10 system, I opened a command prompt window with administrator privileges and used the chkdsk command to check and repair the file system on drive C with chkdsk /r c:. The chkdsk operation got to "Scanning and repairing drive (C:): 10% complete", but then stayed there for hours. I finally powered the system off and on again which prompted it to restart the drive scan again. It quickly got to the 10% point again and then, again, stayed there, so I powered the system off and on again. When I powered the system off and on again, I saw "Preparing automatic repair" and then "Diagnosing your PC." I then saw the following:

Automatic Repair

Your PC did not start correctly

Press "Restart" to restart your PC, which can sometimes fix the problem. You can also press "Advanced options" to try other options to repair your PC.

 

I clicked on Advanced options which led to a "Choose an option" display where I could choose from the following options:

Choose an option

I clicked on Continue. I then saw a message advising I could skip the disk check by pressing the space key within a number of seconds that counted downwards; I hit the space bar before it got to zero and the system rebooted normally.

[/os/windows/win10] permanent link

Sun, Aug 06, 2017 5:05 pm

COUNTIF incompatibility between OpenOffice Calc and Microsoft Excel

I have an Apache OpenOffice Calc spreadsheet that I use to track deposits to bank accounts. I loaned a friend money some time ago for a used car; when I get a check from him, I note it in a worksheet in the Calc workbook. I also get checks from him sometimes unrelated to the auto loan repayment and have received some checks that include the auto loan payment plus reimbursement for other expenses. I have a "note" column in the worksheet where I'll always have "75", if the check applies to the auto loan repayment, though there may be other text before and after the "75" in the cell. So I thought it would be easy to count the number of checks I've received from him that apply to the auto loan repayment by using the formula below, since the note column is column F and the deposits start in row 2 (the first row is a heading line) and go through row 32:

=COUNTIF(F2:F32,"*75*")

That works in Microsoft Excel, but it doesn't work in OpenOffice Calc (I'm using version 4.1.1). The count is always zero, if I use the formula above. I found I have to use the formula below, instead, which correctly reports 21 occurrences of 75 in column F at the moment:

=COUNTIF(F2:F32;".*75.*")

Excel will treat the first asterisk as representing a character or any number of characters before the "75" and the asterisk after "75" as representingany number of characters appearing in the cell after "75". However, Calc doesn't view the asterisks that way. Instead, I need to use a regular expression. In a regular expression (regexp), a period represents any character and an asterisk represents zero or more occurrences of the preceding element. For example, ab*c matches "ac", "abc", "abbc", "abbbc", and so on. So the ".*" represents any character appearing zero or more times in the cell. If I try using the formula I use in Calc in Excel, it will report zero occurrences just as Calc reports zero occurrences when I use the formula that works in Excel in Calc.

Since I want to obtain the total amount he has repaid so far, which is the count of the number of occurrences of 75 in column F by $75, I use the forumula below in Calc to obtain that amount, which returns 1575 as of today:

=COUNTIF(F2:F32;".*75.*") * 75

[/software/openoffice] permanent link

Sat, Aug 05, 2017 10:47 pm

List Installed Security Patches with PowerShell

If you want to know which security patches were installed on a Microsoft Windows system within a specific time period, e.g., the last month or the last 3 months, you can use a Get-CimInstance command in a PowerShell window. E.g.:

PS C:\Users\Lila> Get-CimInstance -Class win32_quickfixengineering | Where-Object { $_.InstalledOn -gt (Get-Date).AddMonths(-1) }

Source        Description      HotFixID      InstalledBy          InstalledOn
------        -----------      --------      -----------          -----------
              Security Update  KB4025376     NT AUTHORITY\SYSTEM  7/12/2017 12:00:00 AM
              Security Update  KB4025342     NT AUTHORITY\SYSTEM  7/12/2017 12:00:00 AM


PS C:\Users\Lila> Get-CimInstance -Class win32_quickfixengineering | Where-Object { $_.InstalledOn -gt (Get-Date).AddMonths(-3) }

Source        Description      HotFixID      InstalledBy          InstalledOn
------        -----------      --------      -----------          -----------
              Security Update  KB4020821     NT AUTHORITY\SYSTEM  6/17/2017 12:00:00 AM
              Update           KB4021572     NT AUTHORITY\SYSTEM  6/17/2017 12:00:00 AM
              Update           KB4022405     NT AUTHORITY\SYSTEM  6/17/2017 12:00:00 AM
              Security Update  KB4025376     NT AUTHORITY\SYSTEM  7/12/2017 12:00:00 AM
              Security Update  KB4025342     NT AUTHORITY\SYSTEM  7/12/2017 12:00:00 AM


PS C:\Users\Lila>

[ More Info ]

[/os/windows/PowerShell] permanent link

Fri, Aug 04, 2017 10:51 pm

Calculating working days in PHP

I have an SQLite database that I use to track work requests. Some requests are time sensitive, i.e. they need to be completed within a certain number of days from the time they are approved. So I have an "Approved" and an "Implemented" column in the database to record the date I approved a request and the date it was implemented. All requests should be completed within 5 business days, so when I display the data on a webpage with PHP, I want to see the number of elapsed working days between the time I approved a request and the time it was implemented. To do so, I use some code provided by George John at Calculate business days with a slight modification. The code I use appears below:

function getWorkingDays($startDate, $endDate)
{
    $begin = strtotime($startDate);
    $end   = strtotime($endDate);
    if ($begin > $end) {

        return 0;
    } else {
        $no_days  = 0;
        while ($begin <= $end) {
            $what_day = date("N", $begin);
            if (!in_array($what_day, [6,7]) ) // 6 and 7 are weekend
                $no_days++;
            $begin += 86400; // +1 day
        };

        return $no_days - 1;
    }
}

[ More Info ]

[/languages/php] permanent link

Sun, Jul 30, 2017 10:48 pm

Determining Motherboard Manufacturer and Model on a Windows System

I wanted to determine the manufacturer and model number of a motherboard in a Windows server at a remote location. I didn't want to drive a half hour there, open up the system's case to make that determination, and drive a half hour back home. Since I have Remote Desktop Protocol (RDP) access to the system, I connected by RDP and ran the WMIC command wmic baseboard get product,manufacturer,model,serialnumber,version from a command prompt. I saw the following output:

C:\>wmic baseboard get product,manufacturer,model,serialnumber,version
Manufacturer                      Model  Product     SerialNumber   Version

00000000000000000000000000000000         S03 Server  QCHCNB3440135  Revision A



C:\>

Since the manufacturer was listed as a string of all zeros, I decided to install the free Speccy program from Piriform. When I installed and ran the software, it also showed all zeros for the manufacturer.

[ More Info ]

[/os/windows] permanent link

Sat, Jul 29, 2017 10:05 pm

Chopping off the leftmost or rightmost character of a string in Excel

You can use the LEFT and RIGHT functions in the Microsoft Excel spreadsheet program along with the LEN (length) function to remove the leftmost or rightmost character from a text string. These functions also work in Google Sheets, LibreOffice Calc, which is the spreadsheet component of the LibreOffice software package, and Apache OpenOffice Calc, which is the spreadsheet program included in Apache OpenOffice, though in the Apache OpenOffice Calc program you need to substitute semicolons (;) for commas (,) in the formulas. E.g., in Apache OpenOffice Calc you would need to use =RIGHT(A5;LEN(A5) -1) , instead of =RIGHT(A5,LEN(A5) -1) as you would in the other programs.

Removing the leftmost character

The syntax for the RIGHT function is RIGHT(text,[numchars]). If you don't include numchars, i.e., you use RIGHT(text) then the value returned is the rightmost character in the string. E.g., if cell A1 has 1ABC in it, then =RIGHT(A1) returns C. But suppose, instead, you want to remove the leftmost charaacter from a string. You can use the RIGHT function to do so. E.g., suppose I have a column of values, e.g.:

  AB
1 1ABC 
2 2DEF 
3 3GHI 
4 4JKL 
5 5MNO 

If I want to remove the number at the beginning of each text string and put the shortened strings in column B, I could, since the strings are all 4 characters long, use =RIGHT(A1,3) in column B1 and then copy the formula down through the other cells in column B by clicking in cell B1 and holding down the leftmost mouse button and dragging downwards through the other cells in column B and then hitting Ctrl-D.

But suppose the strings vary in length. I.e., suppose I have a worksheet containing the following strings in column A:

  AB
1 1ABC 
2 2DEFG 
3 3HI 
4 4JKL 
5 5MNOP 

[ More Info ]

[/software/office/excel] permanent link

Fri, Jul 28, 2017 5:39 pm

Dovecot not allowing logins to check email

A user reported that she was unable to get her email today and was receiving an error in Outlook when she attempted to download her email. I logged into the email server, which runs Dovecot. I tried establishing a telnet connection to the POP3 port on the server. I was able to successfully connect to the well-known port, TCP port 110, used for POP3 connections. I could then enter the user's username with the user command, but I never received a reponse from the server, i.e. from Dovecot. I eventually had to hit ctrl-], i.e., the Ctrl and "]" keys to return to the shell prompt.

$ telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
user nell
^]

telnet> quit
Connection closed.
$

[ More Info ]

[/network/email] permanent link

Thu, Jul 27, 2017 10:33 pm

Viewing monitor information on a Windows system with DumpEDID

If you want information, e.g., the manufacturer, model, serial number, maximum resolution, display modes, etc. on a monitor connected to a Microsoft Windows system, you can use the free DumpEDID utility created by Nir Sofer of NirSoft. It's a command-line interface (CLI) utility, so you will need to run it from a command prompt. There's no installation process needed; you can extract the program from the downloaded zip file and then run it. Below is output from the program showing information for an HP S2031 monitor (the manufacturer and model number apear in the Monitor Name line) attached to a system running Windows 10.

C:\Program Files\NirSoft\dumpedid>dumpEDID
DumpEDID v1.06
Copyright (c) 2006 - 2017 Nir Sofer
Web site: http://www.nirsoft.net

*****************************************************************
Active                   : No
Registry Key             : DISPLAY\HWP2904\1&8713bca&0&UID0
Monitor Name             : HP S2031
Serial Number            : 3CQ0311PV2
Manufacture Week         : 31 / 2010
ManufacturerID           : 61474 (0xF022)
ProductID                : 10500 (0x2904)
Serial Number (Numeric)  : 16843009 (0x01010101)
EDID Version             : 1.3
Display Gamma            : 2.20
Vertical Frequency       : 50 - 76 Hz
Horizontal Frequency     : 24 - 83 KHz
Maximum Image Size       : 44 X 25 cm (19.9 Inch)
Maximum Resolution       : 1600 X 900
Support Standby Mode     : No
Support Suspend Mode     : No
Support Low-Power Mode   : Yes
Support Default GTF      : No
Digital                  : No

Supported Display Modes  :
     720 X  400  70 Hz
     640 X  480  60 Hz
     800 X  600  60 Hz
    1024 X  768  60 Hz
    1280 X  720  60 Hz
    1440 X  900  60 Hz
    1280 X 1024  60 Hz
    1600 X  900  60 Hz

*****************************************************************

*****************************************************************
Active                   : No
Registry Key             : DISPLAY\HWP2904\4&2199b20&0&UID16843008
Monitor Name             : HP S2031
Serial Number            : 3CQ0311PV2
Manufacture Week         : 31 / 2010
ManufacturerID           : 61474 (0xF022)
ProductID                : 10500 (0x2904)
Serial Number (Numeric)  : 16843009 (0x01010101)
EDID Version             : 1.3
Display Gamma            : 2.20
Vertical Frequency       : 50 - 76 Hz
Horizontal Frequency     : 24 - 83 KHz
Maximum Image Size       : 44 X 25 cm (19.9 Inch)
Maximum Resolution       : 1600 X 900
Support Standby Mode     : No
Support Suspend Mode     : No
Support Low-Power Mode   : Yes
Support Default GTF      : No
Digital                  : No

Supported Display Modes  :
     720 X  400  70 Hz
     640 X  480  60 Hz
     800 X  600  60 Hz
    1024 X  768  60 Hz
    1280 X  720  60 Hz
    1440 X  900  60 Hz
    1280 X 1024  60 Hz
    1600 X  900  60 Hz

*****************************************************************

C:\Program Files\NirSoft\dumpedid>

[/os/windows/software/utilities/nirsoft] permanent link

Sun, Jul 23, 2017 4:43 pm

Setting the default application for a file extension in Windows 10

When you click on a file in Microsoft Windows, the operating system opens the file with whatever application, if any, that has been set as the default application to open files with the filename extension on the file. The file extension is a dot at the end of the file name followed by a sequence of other characters, often 3 characters, e.g. for myfile.doc, the extension is .doc. If some program has changed the default setting on a file type so that it now opens files with the relevant extension, but you want to revert to the application that previously opened those types of files, you can do so on a Microsoft Windows 10 system by taking the following steps:

  1. Right-click on the Windows Start button, usually in the lower, left-h and corner of the screen, then click on Settings.
  2. From the Settings window, click on Apps.
  3. Click on Default apps.
  4. In the Default apps window, scroll down until you see Choose default apps by file type and click on that text.
  5. Scroll down the list of file types until you see the one for which you wish to change the default application, e.g., .doc.
  6. Click on the the icon for the current default application shown to the right of the file type. You will then be able to choose another application to become the default application for opening files of that type, e.g., Microsoft Word for .doc files.
  7. You can then close the Settings window by clicking on the "X" at the upper, right-hand corner of the window.

[ More Info ]

[/os/windows/win10] permanent link

Sat, Jul 22, 2017 5:53 pm

Counting entries in an Excel spreadsheet by AM or PM

Microsoft Excel supports formatting timestamps in a workbook as a date followed by a time with an AM or PM value, i.e., the times are in 12-hour clock format where noon is 12:00 PM and midnight is 12:00 AM. You can select that format for a cell or column in a worksheet by highlighting the cell(s) or column (a column can be selected by clicking on the letter at the top of the column) and then clicking on Format then Cells and then clicking on Date and selecting a type of "3/14/15 1:30 PM."

If you wanted to extract just the hour from the timestamp, you can use the HOUR function, e.g. =HOUR(A1) to extract the hour value from cell A1. The hour will be displayed in 24-hour clock format, aka military time, i.e., 7:00 AM is 7 while 7:00 PM is 12 plus 7, i.e., 19; 12:00 AM (midnight) is 0 and 12:00 PM (noon) is 12.

[ More Info ]

[/software/office/excel] permanent link

Thu, Jul 20, 2017 10:49 pm

Passing a parameter to a Python script from a web page

I have a Python script that I use to process a copy of a webpage downloaded from a website and stored on my MacBook Pro laptop's hard drive to produce a CSV file from the data within that file. I was running the script from a command-line interface (CLI), i.e., a Terminal window, on the system by issuing a command like ./myscript.py inputfile outputfile where inputfile and outputfile were the file names and locations of the file holding the data and the output CSV file, respectively. I wanted to execute that script from a link on a web page, instead, so I needed a way to pass the arguments I had been passing on the command line to the Python script in the URL that I'd specify as the link on the web page. One way that you can do that for Python is explained at [Tutor] Passing Arguments to a Remote CGI Script where the following sample Python script is shown:

###
"""test.cgi  --- a small CGI program to show how one can pass parameters.
"""

import cgi
fs = cgi.FieldStorage()

print "Content-type: text/plain\n"
for key in fs.keys():
    print "%s = %s" % (key, fs[key].value)
###

[ More Info ]

[/languages/python] permanent link

Wed, Jul 19, 2017 9:55 pm

OS X - Get File Info

On an OS X/macOS system, you may be able to determine a file's origin, i.e., where it was downloaded from, by right-clicking on the file, or clicking on it to highlight it and then hitting command-I (the command and "I" keys), in the Finder and choosing Get Info. If a "where from" field is displayed, you can see the URL from which the file was obtained if it was downloaded from a website. You can also view that information from a command-line interface (CLI), e.g., a Terminal window, using the mdls command.

[ More Info ]

[/os/os-x] permanent link

Tue, Jul 18, 2017 10:53 pm

DB Browser for SQLite upgrade to version 3.9.1 on Mac OS X

I upgraded the version of DB Browser for SQLite on my MacBook Pro today to the latest version, 3.9.1v2. Before upgrading, I had version 3.8.0 on the system. When I checked the version from a command line interface, i.e., a Terminal window, using the system_profiler command, I didn't find any references to the program when I searched for "SQLite:", but I saw the version number listed for "sqlitebrowser."

$ system_profiler SPApplicationsDataType | grep -i "SQLite:" -A 2
$ system_profiler SPApplicationsDataType | grep -i "Browser:" -A 2
    sqlitebrowser:

      Version: 3.8.0
$ system_profiler SPApplicationsDataType | grep -i "sqlitebrowser" -A 2
    sqlitebrowser:

      Version: 3.8.0
--
      Location: /Applications/sqlitebrowser.app
      Get Info String: DB Browser for SQLite

$

[ More Info ]

[/software/database/sqlite/db_browser] permanent link

Sun, Jul 16, 2017 6:54 pm

ELOG cannot open /etc/elogd.cfg error

When I attempted to add a new entry with a new category to an ELOG logbook on a Linux system, I saw the error message below:

Cannot open file /etc/elogd.cfg: Permission denied
Please use your browser's back button to go back

I checked the file permissions on the elogd.cfg configuration file and saw the following:

# ls -l /etc/elogd.cfg
-rw-r--r--. 1 root root 785 Jul 16 14:47 /etc/elogd.cfg
#

So only the root account had write access to the file. I then checked to see which account elogd was running under. The program lisens on port 8080 on that system. If you don't know the port that is being used for ELOG, you can find it in the /etc/elogd.cfg file. E.g.:

[global]
port = 8080

[ More Info ]

[/network/web/blogging/elog] permanent link

Sat, Jul 15, 2017 10:51 pm

Burning a CD/DVD on a Linux system with the cdrecord command

If you need to burn a CD or DVD from an ISO file from the command line on a Linux system, you can use the cdrecord command. If you include the -v argument to the program, you will see verbose information on the actions performed by the utility and the progress as it writes to the optical disc. When the program is finished you can use the eject command to eject the disc.

[ More Info ]

[/os/unix/linux/utilities/cd-dvd] permanent link

Fri, Jul 14, 2017 9:49 pm

Checking on whether email has gone to the spam folder and whitelisting in Gmail

If you suspect email that you wished to receive in the Inbox for your Gmail account has, instead, gone to the Spam folder, there are several ways to check the Spam folder in Gmail. If email you do want to read has gone into that folder, you can whitelist email from a particular sender or domain to ensure that future email from the sender(s) won't be routed to the Spam folder instead of the Inbox.

[/network/email/gmail] permanent link

Thu, Jul 13, 2017 11:00 pm

Unbanning an IP address banned with fail2ban

I needed to remove an IP address from the "jail" it was placed in by fail2ban, which is intrusion prevention sotware, due to an incorrect password being entered too many times by a legitimate user of the system during attempts to log into a CentOS Linux system that runs fail2ban. The attempted logins were made via Secure Shell (SSH). After the number of attempts with an incorrect password reached the cutoff for fail2ban to automatically ban the IP address from which the login attempts were originating, the user then got the following error message on subsequent login attempts:

$ ssh jdoe@example.com
ssh: connect to host example.com port 22: Connection refused
$

The fail2ban log on the system is at /var/log/fail2ban.log. You can check that log to see which IP addresses were banned and the time any bans went into effect. So I first verified the IP address from which the login attempts were made.

# tail -n 3 /var/log/fail2ban.log
2017-07-13 21:59:06,304 fail2ban.filter         [1664]: INFO    [sshd] Found 192.168.1.21
2017-07-13 21:59:06,818 fail2ban.actions        [1664]: NOTICE  [sshd] Ban 192.168.1.21
2017-07-13 21:59:11,538 fail2ban.filter         [1664]: INFO    [sshd] Found 192.168.1.21
#

You can determine the name for the jail and IP address is in by issuing the command fail2ban-client status.

[ More Info ]

[/os/unix/linux] permanent link

Mon, Jul 10, 2017 10:47 pm

Viewing Partition Information on a Windows System

One way to see how disks are partitioned on a Microsoft Windws system is to view the information using Disk Management. You can start the utility from a command prompt with administrator privileges by typing diskmgmt.msc. That will provide a graphical display of the partitions on the drives in the system and externally attached to the system.

Another method is to use the diskpart command, which can be run from a command prompt - obtain a command prompt with administrator privileges. You can obtain help on using the utility by typing help at the DISKPART prompt.

[ More Info ]

[/os/windows/commands] permanent link

Sun, Jul 09, 2017 10:36 pm

exiv2

If you want to determine the size of an image file on a Linux system, for some types of image files, e.g., PNG or GIF files, you can just use the file command. E.g.:

$ file ~/Documents/System_Memory.png
/home/jdoe/Documents/System_Memory.png: PNG image data, 800 x 600, 8-bit/color RGBA, non-interlaced
$ file ~/Documents/recipes/asparagus-strawberry-salad.gif
/home/jdoe/Documents/recipes/asparagus-strawberry-salad.gif: GIF image data, version 89a, 250 x 153
$

But if you obtain information on a JPG/JPEG file with that command, it doesn't provide any information on the dimensions of the image.

$ file ~/Documents/Winter.jpg
/home/jdoe/Documents/Winter.jpg: JPEG image data, JFIF standard 1.02
$

If you install the exiv2 package, you can also display the dimensions of JPEG images as well as PNG, GIF, and other image formats.

$ exiv2 /home/jdoe/Documents/Winter.jpg
File name       : /home/jdoe/Documents/Winter.jpg
File size       : 105542 Bytes
MIME type       : image/jpeg
Image size      : 800 x 600
/home/jdoe/Documents/Winter.jpg: No Exif data found in the file
$ exiv2 /home/jdoe/Documents/System_Memory.png
File name       : /home/jdoe/Documents/System_Memory.png
File size       : 135335 Bytes
MIME type       : image/png
Image size      : 800 x 600
/home/jdoe/Documents/System_Memory.png: No Exif data found in the file
$ exiv2 /home/jdoe/Documents/recipes/asparagus-strawberry-salad.gif
File name       : /home/jdoe/Documents/recipes/asparagus-strawberry-salad.gif
File size       : 31346 Bytes
MIME type       : image/gif
Image size      : 250 x 153
/home/jdoe/Documents/recipes/asparagus-strawberry-salad.gif: No Exif data found in the file
$

[ More Info ]

[/os/unix/programs/graphics] permanent link

Sat, Jul 08, 2017 10:57 pm

Finding files modified today

On Unix-like operating systems, such as Linux or OS X/macOS system, you can use the find command to locate files based on specified criteria. If you want to see just those files modified within the last day, you can use a command such as the one below:
$ find /home/jdoe/Documents -mtime -1 -type f -print

The command above would list those files created within the /home/jdoe/Documents directory and its subdirectories that were created in the last day, which is specified with -mtime -1. The mtime references a file's modification time and the minus one indicates you only want to see those files created today; -type f indicates you are only interested in files, not directories or other objects while -print indicates you want find to display the names of the files it finds that match the specified criteria. Note: this method will show files created within the last 24 hours, not just those created since the start of the current day at midnight the previous night. An alternative method, to see just those files created or modified since the beginning of the current day, is to specify today's date with -newermt. E.g., if today is July 8, 2017, I could use the command below to find files with a modification time newer than the specified date:

$ find /home/jdoe/Documents -newermt 2017-07-08 -type f

That command will also show me the files in the specified directory that were created or modified today.

References:

  1. Find man page for Linux (Centos 7)
  2. Find man page for OS X (Yosemite)

Related posts:

  1. Finding files modified on or after a date on a Linux system
    Date: January 11, 2015

[/os/unix/commands] permanent link

Fri, Jul 07, 2017 10:46 pm

Printing the error encountered with Python

In a Python script I was calling from a webpage residing on an Apache webserver, I was unable to copy a file whose location and file name were stored in the variable countfile to another file whose name and location were stored in the variable backupfile with any of the following lines of code:

shutil.copy(countfile, backupfile)
shutil.copy2(countfile, backupfile)
shutil.copyfile(countfile, backupfile)

The backup file should be stored in the same directory as countfile using the same name, but with ".bak" appended to the file name. I wasn't able to identify the cause of the problem when I just used except to print my own error message with the code below, since all I would see in the output was "Error! Unable to make a backup copy of the input file."

import shutil

backupfile = countfile + ".bak"

try:
   # Make a backup copy of the prior file
   shutil.copy(countfile, backupfile)
except e:
   print "Error! Unable to make a backup copy of the input file."
   sys.exit(1)

But the explicit Python error message can be obtained by using except Exception, e as shown below:

try:
   shutil.copy(countfile, backupfile)
except Exception,e:
   print str(e)
   print "Error! Unable to make a backup copy of the input file."
   sys.exit(1)

When I used that code, instead, I saw the following output for the error, which showed that the problem was with the creation of the backup file:

[Errno 13] Permission denied: '/Users/jasmith1/Documents/www/SGRS/data/SGRS_Count.csv.bak'
Error! Unable to make a backup copy of the input file.

[ More Info ]

[/languages/python] permanent link

Tue, Jul 04, 2017 10:47 pm

Determining the model and serial number of a HDD in a Linux system

If you need to know the model number and/or serial number of a hard disk drive (HDD) in a Linux system, one tool that you can use to obtain that information as well as other information on the drive is the lsblk utility, which is included in the util-linux package. E.g.:

# lsblk -o MODEL,SERIAL,SIZE,STATE --nodeps
MODEL            SERIAL            SIZE STATE
WDC WD10EZEX-00W WD-WCC6Y4ZYE4Y3 931.5G running
DVD A  DH16ACSHR 238229911623     1024M running
vmDisk-CD        13043003455      1024M running

You can see the list of arguments you can provide to the program with lsblk -h.

[ More Info ]

[/os/unix/linux/utilities/sysmgmt] permanent link

Mon, Jul 03, 2017 10:03 pm

is_null versus empty in PHP

I have a PHP script that queries an SQLite database displaying the results on a web page. There are two fields, "EC Link" and "Configs Link" in the database that can contain URLs pointing to documentation on another server, but sometimes there is no URL in the database for those fields. If there is a URL, I want to display a clickable "EC" and "Configs" links. If there is no URL in either field, I want to simply display the text, but without it being clickable to indicate that there is no URL in the database table. I was using "is_null" for that purpose as shown below:

   if (is_null($row['EC Link'])) {
       echo "EC | ";
    }
    else {
       echo "<a href=\"" . $row['EC Link'] . "\">EC</a> | ";
    }
    if (is_null($row['Configs Link'])) {
       echo "Configs | ";
    }
    else {
       echo "<a href=\"" . $row['Configs Link'] . "\">Configs</a> | ";
    }

But I found that sometimes I was seeing clickable links even though there was no URL for the EC and/or Configs documentation for a particular record in the database. When I checked the records in the relevant table in the database, I found that the fields were blank, i.e., there was no data in them, but they weren't marked as null. So, to allow for the values being either null or blank, I used an empty, instead of is_null, test.

[ More Info ]

[/languages/php] permanent link

Sun, Jul 02, 2017 11:07 pm

SUPERAntispyware Found Ask Toolbar on 2017-07-02

I scanned a Windows 10 system used by a family member on July 2, 2017 with SUPERAntispyware Free Edtion, since the system was responding more slowly than I expected even for simple actions, though the system has other antivirus software on it. The first thing that SUPERAntispyware identified was the Ask Toolbar browser extension. It showed the following information for Ask Toolbar:

Ask Toolbar

C:\ProgramData\ASKPARTNERNETWORK\TOOLBAR
HKLM\SYSTEM\CurrentControlSet\services\APNMCP
HKCU\Software\AskPartnerNetwork\Toolbar
C:\ProgramData\ASKPARTNERNETWORK

[ More Info ]

[/security/scans] permanent link

Sat, Jul 01, 2017 9:38 pm

Check the scheduled backup for the Windows 10 backup program

You can check the schedule for backups with the backup program that is included with Windows 10 by taking the following steps:
  1. Right-click on the Windows Start button.
  2. Select Control Panel.
  3. Select System and Security.
  4. Double-click on Backup and Restore (Windows 7). You will see the scheduled backup dates in the "Schedule" line, e.g., "Every Sunday at 2:00 AM."

[ More Info ]

[/os/windows/win10] permanent link

Thu, Jun 29, 2017 10:48 pm

Selecting unique column entries with SQL

If you have a MariaDB, MySQL, SQLite, etc. database that may have more than one occurrence of a value for a particular column in a table, but want to display only unique values, you can fillter out the repeated values using SELECT DISTINCT. E.g., I have a table in a database where each record, aka row, in the table holds two fields: one holds an account id (Acct) and the other a project name. An account can be associated with more than one project and any project may have many account IDs associated with it.

To produce a list of the projects in the table without listing any project more than once and to list the projects in alphabetical order, I can use the SQL statement below:

SELECT DISTINCT Project FROM Acct_Projects ORDER BY Project;

Each record, aka row, in the table holds two fields: one holds an account id (Acct) and the other a project name. For the PHP code I use to query the SQLite database that holds the data to display a list of all the projects in the table, I use the following code:

<?php

$filename   = "/Users/jasmith1/Documents/www/SGRS/SGRS.db";

$query_string = "SELECT DISTINCT Project FROM Acct_Projects ORDER BY Project";

$db_handle  = new SQLite3($filename);

$results     = $db_handle->query($query_string);

echo "<table>\n";
echo "<tr><td><b>Project</b></td></tr>\n";
while ($row = $results->fetchArray()) {
    echo "<tr><td><a href=\"project_acctids.php?project=" . 
          $row['Project']  . "\">" .  $row['Project'] . "</a></td></tr>\n";
}
echo "</table>\n";

?>

I make the project displayed on each row of the HTML table a clickable link that will open another page, project_acctids.php that will, for the project that is clicked on, display all of the account ids associated with that project.

[/software/database/sql] permanent link

Sun, Jun 25, 2017 9:27 pm

icacls

On Microsoft Windows Vista and Windows Server 2003 and later systems, you can use the Integrity Control Access Control List (icacls) program to display, modify, backup and restore Access Control Lists (ACLs) for files and folders. E.g.:

C:\>icacls C:\WINDOWS\system32\mmc.exe
C:\WINDOWS\system32\mmc.exe NT SERVICE\TrustedInstaller:(F)
                            BUILTIN\Administrators:(RX)
                            NT AUTHORITY\SYSTEM:(RX)
                            BUILTIN\Users:(RX)
                            APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(RX)
                            APPLICATION PACKAGE AUTHORITY\ALL RESTRICTED APPLICATION PACKAGES:(RX)

Successfully processed 1 files; Failed processing 0 files

C:\>

In the above example, the "RX" indicates read and execute access for the file for the specified accounts.

[ More Info ]

[/os/windows/commands] permanent link

Sat, Jun 24, 2017 2:36 pm

Modifying search domain settins under OS X

If you would like to be put a system's name in your web browser, e.g., ajax, into your browser's address bar and have the system automatically append a domain name, e.g. example.com, so that the browser attempts to access ajax.example.com, even though you just typed ajax, you can modify the Domain Name System (DNS) search domain settings. To do so on an Apple OS X/macOS system, take the following steps:

  1. Click on the Apple icon at the top, left-hand side of your screen.
  2. Choose System Preferences then Network.
  3. Select the relevant network service, such as Wi-Fi or Ethernet, then click on the Advanced button.
  4. Click on DNS.
  5. Click in the Search Domains box and then click on the "+" at the bottom of that box to add a new search domain.
  6. Type the name of the search domain, e.g. example.com.
  7. Click on OK

You can add multiple domains; domains will be searched in the order you list them with the search starting at the topmost entry and continuing down through the list of domains with the search stopping when a valid name is found.

[ More Info ]

[/os/os-x] permanent link

Fri, Jun 23, 2017 10:22 pm

lscpu

On a Linux system, you can use the lscpu command to obtain information on the system's Central Processing Unit (CPU). On a CentOS Linux system, the utility is included in the util-linux package. On a CentOS system, you can install that package using the yum package management utility, if it isn't already installed, using yum install util-linux. You can check on whether the lscpu program is already present using which lscpu and, on a CentOS system or another system that uses RPM, you can use rpm -qi util-linux to determine if the util-linux package is already installed.

[ More Info ]

[/os/unix/linux/utilities/sysmgmt] permanent link

Wed, Jun 21, 2017 10:09 pm

Adding an email address to Outlook Mail's Safe Sender list

If you use an outlook.com or hotmail.com email address and are not receiving email from someone whose email you wish to see, you may need to add the address to your safe sender's list. Otherwise, email from the sender may not even be placed in your junk email folder, but may, instead, just be discarded by Outlook Mail.

To add an email address to Outlook Mail's safe sender list, click on the gear icon at the top of the Outlook Mail window you will see after logging into your account then take the following steps:

  1. Select Options from the drop down list.
  2. Select Safe Senders.
  3. Type the email address that you wish to add as a new safe sender in the field below the pencil and trash can icons, hit Enter then click on Save.

[ More Info ]

[/network/email/hotmail] permanent link

Tue, Jun 20, 2017 10:22 pm

NetHogs

If you wish to monitor the top bandwidth consuming processes on a Linux system, you can use the nethogs program, which displays bandwidth usage by process. It will display the process id (PID) of the processes consuming the most bandwidth. E.g.:

NetHogs version 0.8.5

    PID USER     PROGRAM                    DEV        SENT      RECEIVED       
  19355 jim      sshd: jim@pts/0            enp1s4      0.188       0.082 KB/sec
  15022 apache   /usr/sbin/httpd            enp1s4      0.000       0.000 KB/sec
      ? root     unknown TCP                            0.000       0.000 KB/sec

  TOTAL                                                 0.188       0.082 KB/sec

The above output shows me that the two processes consuming the most bandwidth at the time the program was run had PIDs of 19355 and 15022. I can get additional information on those processes using the ps command.

$ ps 19355
  PID TTY      STAT   TIME COMMAND
19355 ?        S      0:19 sshd: jim@pts/0
$ ps 15022
  PID TTY      STAT   TIME COMMAND
15022 ?        S      0:00 /usr/sbin/httpd -DFOREGROUND
$

[ More Info ]

[/os/unix/linux/network] permanent link

Mon, Jun 19, 2017 9:39 pm

Wrapping text on a webpage

I query an SQLite database using PHP code on a webpage. One of the fields in the database is a "Note" field, where notes have been entered without any HTML code to format the text. When I display the notes on a webpage, I want to preserve the line breaks and paragraphs as they were typed. Since there are no <br> line break nor <p> paragraph tags on the page, I could display the text as typed using the pre tag, but the problem with just using that tag is that in cases where the a line is very long, someone would have to scroll far to the right to see the entire line on the webpage, if I just used the pre tag. However, I can specify a style for the pre tag that will result in the text wrapping at the right-edge of the browser window. E.g. <pre style="white-space: pre-wrap"> . Or, if I don't want the text displayed in the monospaced default font for the pre tag, I can apply the style to the <div> tag, instead. E.g.: <div style="white-space: pre-wrap">.

[ More Info ]

[/network/web/html] permanent link

Sat, Jun 17, 2017 8:02 pm

Clearing the counters for a port on a Cisco switch

You can view the counters for a port on a Cisco switch using the show interfaces command. E.g., if I want to check on whether cyclic redundancy check (CRC) errors have been occurring on port fa0/16, I can issue the command shown below:

Huron>show interfaces fa0/16
FastEthernet0/16 is up, line protocol is up (connected)
  Hardware is Fast Ethernet, address is 0009.e897.d290 (bia 0009.e897.d290)
  MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
     reliability 255/255, txload 19/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive set (10 sec)
  Full-duplex, 10Mb/s, media type is 100BaseTX
  input flow-control is unsupported output flow-control is unsupported
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input never, output 00:00:00, output hang never
  Last clearing of "show interface" counters 2d17h
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 24000 bits/sec, 40 packets/sec
  5 minute output rate 756000 bits/sec, 64 packets/sec
     46168 packets input, 4608074 bytes, 0 no buffer
     Received 1250 broadcasts (1161 multicast)
     0 runts, 0 giants, 0 throttles
     121 input errors, 16 CRC, 105 frame, 0 overrun, 0 ignored
     0 watchdog, 1161 multicast, 0 pause input
     0 input packets with dribble condition detected
     255151 packets output, 119141892 bytes, 0 underruns
     0 output errors, 0 collisions, 0 interface resets
     0 babbles, 0 late collision, 0 deferred
     0 lost carrier, 0 no carrier, 0 PAUSE output
     0 output buffer failures, 0 output buffers swapped out
Huron>

[ More Info ]

[/hardware/network/switch/cisco] permanent link

Thu, Jun 15, 2017 11:26 pm

Changing the duplex setting for a port on a Cisco switch

You can determine the speed and duplex settings for a port on a Cisco switch with the show interfces port_designation status. E.g.:

Huron>show interfaces fa0/1 status

Port      Name               Status       Vlan       Duplex  Speed Type
Fa0/1                        connected    1            full     10 10/100BaseTX
Huron>

Often ports will be set to autonegotiate the speed and duplex settings with the equipment connected to the port. But sometimes that autonegotiation process may not work as expected requiring you to manually set the parameters. E.g, if the piece of equipment being connected to the port on the Cisco switch is configured for a fixed mode of operation while the port on the switch is configured for autonegotiate, the speeds may be configured for matching values on both sides but there may be a duplex mismatch. As a result of that mismatch cyclic redundancy check (CRC) errors may be reported for the port on the switch. You can manually set the duplex setting by entering the enable command and then the enable password when prompted. Then enter the configure command and then enter duplex followed by full or half, e.g., duplex full.

[/hardware/network/switch/cisco] permanent link

Wed, Jun 14, 2017 11:02 pm

Installing Lynx with Homebrew

If you need a text-based web browser that doesn't require a graphical user interface (GUI), one alternative is the Lynx browser that is available for a variety of operating systems, including Linux, OS X/macOS, DOS, and Microsoft Windows. If you have the Homebrew package management software installed on a OS X/macOS system, you can use it to easily install the Lynx browser using the command brew install lynx.

Advantages to using a text-based browser such as Lynx, in addition to it not requiring a GUI, making it suitable to be run in a Terminal window, is that it doesn't support Adobe Flash, which makes it invulnerable to malware distributed through vulnerabilities in Flash. Also, because it doesn't support JavaScript nor graphics, it prevents tracking software that uses JavaScript or web bugs, aka web beacons, which can track your web browsing activities via small graphics files that will be invisible to you on a webpage, from being used to track your browsing activities. It does support HTTP cookies, though, which are also used by sites to track visitors, but Lynx will prompt you if you want to allow cookies for a site when you visit the site and has whitelisting and blacklisting capabilities. E.g., when a site tries to place a cookie on your system, Lynx will prompt you as to whether it should be allowed. You can choose from "Y/N/Always/neVer."

[ More Info ]

[/os/os-x/homebrew] permanent link

Tue, Jun 13, 2017 10:04 pm

Determining the version of Firefox on OS X

If you wish to determine the version of Firefox installed on an OS X from a command line interface (CLI), you can open a Terminal window and use the command shown below:

$ /Applications/Firefox.app/Contents/MacOS/firefox -v
Mozilla Firefox 45.8.0
$

You can also find the information in the Info.plist file found at /Applications/Firefox.app/Contents/Info.plist. The version number will be on the line following the "key" line for CFBundleGetInfoString and also after the "key" line for CFBundleShortVersionString .

        <key>CFBundleGetInfoString</key>
        <string>Firefox 45.8.0</string>

        <key>CFBundleShortVersionString</key>
        <string>45.8.0</string>

[ More Info ]

[/os/os-x] permanent link

Mon, Jun 12, 2017 7:22 am

Can't Force Quit Firefox

Firefox (version 45.8.0) became unresponsive on my MacBook Pro running OS X El Capitan (10.11.6). I killed Firefox by clicking on the Apple icon at the top, left-hand corner of the page and selecting Force Quit and then selecting Firefox in the list of running applications and then clicking on the Force Quit button.

Force Quit Applications - Firefox

I then restarted Firefox by clicking on its icon in the Dock. The icon bounced a few times and then stopped, so I assumed Firefox was now running. But when I tried accessing it by holding down the command while repeatedely tapping the tab key to cycle through the open applications, it didn't appear. Nor did it show up in the list of running processes shown by the Activity Monitor.

[ More Info ]

[/os/os-x] permanent link

Sun, Jun 11, 2017 2:39 pm

CPU Information for a MacBook Pro (Retina, 15-inch, Mid 2015)

The sysctl command can be used on a Mac OS X/macOS system to determine some machine dependent (machdep) features, such as Central Processor Unit (CPU) features. E.g., the output of sysctl machdep.cpu run on a MacBook Pro (Retina, 15-inch, Mid 2015) system with an Intel Core i7 processor is shown below:

$ sysctl machdep.cpu
machdep.cpu.max_basic: 13
machdep.cpu.max_ext: 2147483656
machdep.cpu.vendor: GenuineIntel
machdep.cpu.brand_string: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
machdep.cpu.family: 6
machdep.cpu.model: 70
machdep.cpu.extmodel: 4
machdep.cpu.extfamily: 0
machdep.cpu.stepping: 1
machdep.cpu.feature_bits: 9221960262849657855
machdep.cpu.leaf7_feature_bits: 10155
machdep.cpu.extfeature_bits: 142473169152
machdep.cpu.signature: 263777
machdep.cpu.brand: 0
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA C
MOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES6
4 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE P
OPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C
machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 AVX2 BMI2 
INVPCID FPU_CSDS
machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT RDTSCP TSCI
machdep.cpu.logical_per_package: 16
machdep.cpu.cores_per_package: 8
machdep.cpu.microcode_version: 19
machdep.cpu.processor_flag: 5
machdep.cpu.mwait.linesize_min: 64
machdep.cpu.mwait.linesize_max: 64
machdep.cpu.mwait.extensions: 3
machdep.cpu.mwait.sub_Cstates: 270624
machdep.cpu.thermal.sensor: 1
machdep.cpu.thermal.dynamic_acceleration: 1
machdep.cpu.thermal.invariant_APIC_timer: 1
machdep.cpu.thermal.thresholds: 2
machdep.cpu.thermal.ACNT_MCNT: 1
machdep.cpu.thermal.core_power_limits: 1
machdep.cpu.thermal.fine_grain_clock_mod: 1
machdep.cpu.thermal.package_thermal_intr: 1
machdep.cpu.thermal.hardware_feedback: 0
machdep.cpu.thermal.energy_policy: 1
machdep.cpu.xsave.extended_state: 7 832 832 0
machdep.cpu.xsave.extended_state1: 1 0 0 0
machdep.cpu.arch_perf.version: 3
machdep.cpu.arch_perf.number: 4
machdep.cpu.arch_perf.width: 48
machdep.cpu.arch_perf.events_number: 7
machdep.cpu.arch_perf.events: 0
machdep.cpu.arch_perf.fixed_number: 3
machdep.cpu.arch_perf.fixed_width: 48
machdep.cpu.cache.linesize: 64
machdep.cpu.cache.L2_associativity: 8
machdep.cpu.cache.size: 256
machdep.cpu.tlb.inst.large: 8
machdep.cpu.tlb.data.small: 64
machdep.cpu.tlb.data.small_level1: 64
machdep.cpu.tlb.shared: 1024
machdep.cpu.address_bits.physical: 39
machdep.cpu.address_bits.virtual: 48
machdep.cpu.core_count: 4
machdep.cpu.thread_count: 8
machdep.cpu.tsc_ccc.numerator: 0
machdep.cpu.tsc_ccc.denominator: 0
$

[ More Info ]

[/os/os-x] permanent link

Sat, Jun 10, 2017 8:18 pm

Automated email for Let's Encrypt certificate expiration

The Let's Encrypt certificate I use for an email server again wasn't automatically renewed - see Let's Encrypt certificate expired. The Let's Encrypt certificates exipre every 90 days, so I wanted the system to automatically email me a message at least a week before the certificate expires. I manually renewed the certificate today by running the command letsencrypt renew from the root account and checked the new expiration date with the command openssl x509 -enddate -noout -i cert_pem_file_location where cert_pem_file_location is the location of the relevant cert.pem file.

# openssl x509 -enddate -noout -in /etc/letsencrypt/live/moonpoint.com/cert.pem
notAfter=Sep  8 19:14:00 2017 GMT
#

Since the new certificate expiration date is September 8, 2017, I wanted an email notice sent to me on September 1. I can then manually renew the certificate, if needed. I would then want to be notified every 3 months again indefinitely. Since the mailx utility is a standard email program found on Linux and OS X/macOS systems, I use it for sending scheduled email messages.

[ More Info ]

[/network/email] permanent link

Fri, Jun 09, 2017 11:01 pm

Obtaining public IP address from a command line interface

One way to determine the public IP address for a system, i.e., the IP address that systems on the Internet will see for the system when you connect to those external systems, from a command-line interface (CLI) on a Linux or Mac OS X/macOS system is to use the dig command dig +short myip.opendns.com @resolver1.opendns.com. E.g.:

$ dig +short myip.opendns.com @resolver1.opendns.com
137.103.94.167
$

Alternatively, you can use an nslookup command as shown below:

$ nslookup myip.opendns.com resolver1.opendns.com
Server:		resolver1.opendns.com
Address:	208.67.222.222#53

Non-authoritative answer:
Name:	myip.opendns.com
Address: 137.103.94.167

$

The nslookup method will work on Microsoft Windows systems as well as OS X/macOS and Linux sysems.

c:\Users\Public\>nslookup myip.opendns.com resolver1.opendns.com
Server:  resolver1.opendns.com
Address:  208.67.222.222

Non-authoritative answer:
Name:    myip.opendns.com
Address:  137.103.94.167


c:\Users\Public\>

Both commands submit a Domain Name System (DNS) query to the DNS server resolver1.opendns.com, a name server maintained by OpenDNS. When you look up the fully qualified domain name (FQDN) myip.opendns.com, the OpenDNS server will return the IP address of the system from which the DNS query originated, i.e., the system on which you ran the dig or nslookup command.

[/network/dns] permanent link

Tue, Jun 06, 2017 9:22 pm

Removing whitespace from lines in Vi

To remove whitespace characters, such as spaces and/or tabs from a line while editing a file in the vi and Vim text editor you can use a regular expression (regexp) that incorporates \s (lowercase letter "s"), which respresents a white space character. E.g., supposing the lines below appear in a file:

450 SN/GN Tech  Edit Delete
ACE     Edit Delete
ADO             Edit Delete
AGO     Edit Delete
AGS     Edit Delete
AIM     Edit Delete
ASF         Edit Delete

I could hit the colon key and type s/\s*Edit Delete// to delete the white space after the project name that appears at the beginning of the line and the "Edit Delete" at the end of the line, so that only the project name remains. To perform the substitution for all lines, I could use 1,$ s/\s*Edit Delete//.

The 1,$ represents every line from the 1st to the last and 1,$ s/old_pattern/new_pattern/ would indicate that a substitution is to be performed on every line with new_pattern replacing old_pattern on each line. The \s represents any whitespace character and the asterisk after it indicates to look for zero or more occurrences of any whitespace character. So s/\s*Edit Delete// indicates to delete white space characters followed by the words Edit Delete.

I could also use \W, instead; \W represents any non-alphanumeric character.

Related articles:

  1. gVim Portable for Windows

Reference:

  1. Lesson 9: All this whitespace
    RegexOne - Learn Regular Expressions with simple, interactive exercises.

[/software/editors/vi] permanent link

Sun, Jun 04, 2017 11:21 pm

ISURL

If you wish to know whether a cell holds a Uniform Resource Locator (URL), such as http://example.com, in Google Sheets you can use the ISURL function. E.g., if I wanted to know whether cell A5 contains a URL, elsewhere in the spreadsheet I could use the formula =ISURL(A5). The value returned will be either TRUE or FALSE. Note: this will return the Boolean value TRUE or FALSE only if the text in the cell is a URL. If, instead, I have =hyperlink("http://superuser.com","Super User"), i.e., I have text in the cell that is hyperlinked, the value will be FALSE, because, in the example, the text that appears in the cell will be Super User.

This function is not available in Microsoft Excel, at least as of Excel 2013 for Windows and Microsoft Excel for Mac 2016 (version 15.29), which is part of Microsoft Office 2016 for OS X and macOS systems. Nor is it available for Apache OpenOffice Calc, at least as of version 4.1.1. If you try using ISURL as a formula in those applications, you will see #NAME? appear in the cell where you place the formula, since its usage is an incompatibility between those versions and Google Sheets.

The ISURL formula will return TRUE for other URLs besides HTTP or HTTPS ones. E.g., FTP and mailto URLs will also result in a value of TRUE. E.g., if a cell contains any of the following URLs, an ISURL formula that checks the content of the cell will return TRUE.

http://example.com
https://www.example.com
ftp://ftp.microsoft.com
mailto:someone@example.com

[/software/office/excel] permanent link

Fri, Jun 02, 2017 10:44 pm

Using nslookup to check an email blocklist

I was notified by someone today that yesterday he had sent an email to a mailing list on an email server I maintain, but the email had not been delivered to recipients. When I checked yesterday's email log, I didn't see any email from his email address, so I asked him to resend the message. He did so, but that email message was also not delivered and I didn't see any log entry for his email address in today's email log, /var/log/maillog. He has a verzion.net email address and Verizon recently transitioned its email service to AOL. I remembered helping him make that transition last month, so I looked for any aol.com entries in the log file and found the entry below for an attempt by an AOL email server to deliver a message that was rejected at the time he told me he had sent the email today.

# grep aol /var/log/maillog
Jun  2 10:50:16 moonpoint sendmail[23955]: ruleset=check_relay, arg1=omr-a006e.m
x.aol.com, arg2=127.0.0.6, relay=omr-a006e.mx.aol.com [204.29.186.55], reject=55
0 5.7.1 Spam Block:mail from 204.29.186.55 refused - see http://dnsbl.sorbs.net/

[ More Info ]

[/network/email/spam/sorbs] permanent link

Sun, May 28, 2017 10:10 pm

Querying an SQLite Database With PHP

If you wish to query an SQLite database using PHP, you can do so by placing commands similar to those shown below within the code for a webpage:

<?php

$filename = "/Users/jasmith1/Documents/www/test/presidents.db";

$db = new SQLite3($filename);

$results = $db->query('SELECT * FROM Terms');
while ($row = $results->fetchArray()) {
    var_dump($row);
    echo "<br>\n";
}
?>

In the example above, the database location and file name is stored in the variable $filename. The file must be in a location accessible by the webserver and the file permissions must allow access to the file.

[ More Info ]

[/software/database/sqlite] permanent link

Fri, May 26, 2017 8:38 pm

Burning an ISO file to a disc under Windows 10

To burn an ISO image file to a disc under Windows 10 using capabilities built into the operating system, click on the .iso file in Windows File Explorer to highlight it. You will then see Disc Image Tools appear at the top of the window with Manage below it.

Click on Manage. You will then see options to Mount or Burn.

Click on Burn. A Windows Disc Image Burner window will appear where you can select the disc burner device, if there is more than one in the system. Click on the Burn button to burn the iso file to a CD or DVD.

When the .iso file has been burned to a disc, you should see a "The disc image has been successfully burned to disc" message and the disc should be ejected from the drive.

[ More Info ]

[/os/windows/win10] permanent link

Tue, May 23, 2017 10:36 pm

Checking speed and duplex settings on a Linux system

Sometimes network performance problems on a system can be due to a mismatch in the speed and/or duplex settings on a system and the switch or router to which it connects. Autonegotiation normally works to ensure that two connected devices have compatible settings, but occasionally it may not work as intended. On a Linux system, one way to check the spped and duplex values is by using the ethtool command. If the utility, which provides capabilities for querying and changing settings such as speed, port, auto-negotiation, PCI locations and checksum offload on many network devices, especially of Ethernet devices, isn't installed already you can install it on a Ubuntu Linux system with the command sudo apt-get install ethtool. On a CentOS Linux system, you can use yum install ethtool. You can run the software to show the settings for a network interface controller (NIC) by issuing the command ethtool devname where devname is the name associated with the network interface, e.g., you might issue the command ethtool eth0 on a Ubuntu system. You can see the available network interfaces using the command ifconfig -a. Below is the output of the command run on a CentOS system:

$ ethtool enp1s4
Settings for enp1s4:
	Supported ports: [ TP ]
	Supported link modes:   10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Supported pause frame use: No
	Supports auto-negotiation: Yes
	Advertised link modes:  10baseT/Half 10baseT/Full 
	                        100baseT/Half 100baseT/Full 
	                        1000baseT/Half 1000baseT/Full 
	Advertised pause frame use: No
	Advertised auto-negotiation: Yes
	Speed: 100Mb/s
	Duplex: Full
	Port: Twisted Pair
	PHYAD: 0
	Transceiver: internal
	Auto-negotiation: on
	MDI-X: Unknown
Cannot get wake-on-lan settings: Operation not permitted
	Current message level: 0x00000037 (55)
			       drv probe link ifdown ifup
	Link detected: yes
$

[/os/unix/linux/utilities/network] permanent link

Sun, May 21, 2017 10:29 pm

Book Collector database disappeared

I use the Collectorz.com book database software to manage my book collection. I hadn't updated the database for several months, but I had purchased some books recently and wanted to add those books to the database. When I opened the Book Collector program (version 16.4.3), it automatically opened the last book database I had open, which was one that I use to track books my wife and I have purchased as gifts for a friend who also enjoys reading, so I don't buy the same ones again in the future. But when I tried to find the database in which I store information for my own books, I couldn't find it. When I clicked on File and selected Open Database in the program and navigated to a folder where I thought that database was stored, the program didn't show the database at that location. When I navigated to that directory with the Windows File Explorer, I didn't see any files with a .bkc extension, which is the filename extension used by the Book Collector database program. Collectorz.com also provides comic, game, movie, and music database programs.

[ More Info ]

[/software/database/collectorz] permanent link

Sat, May 20, 2017 8:24 pm

Finding open files on a Windows SBS server

If you need to find files open on a Small Business Server (SBS) system, e.g., perhaps files have been opened on the server from other computers in the windows domain, you can do so by taking the following steps:
  1. Click on Start
  2. Select Administrative Tools then select Computer Management and then, under Sytem Tools, click on Shared Folders
  3. Double-click on Open Files. You will then see the files open on the server from other systems. You will see the files being accessed, who is accessing them, the locks, if any, and the mode in which it files have been accessed, e.g., whether they are open only for reading or whether they are open in read and write mode. Right-clicking on a file will give you the ability to close the open file.

[ More Info ]

[/os/windows/commands] permanent link

Thu, May 18, 2017 10:08 pm

Batch file to ping several hosts and log results

Since a connectivity issue between a Windows XP system in another country and systems in the United States seemed to correlate with the time of day that connectivity attempts were taking place, I wanted to have a batch file that would periodically ping from the source to the destination hosts and record the results, so that I could determine if packet loss was occurring at particular times every day because of contention with other traffic. So I created the following batch file (pinghosts.bat):

@echo off

set pingCount=5
set timeOut=500
set dirPath=%HOMEPATH%\Documents

REM ping google.com, apple.com, and cisco.com
for %%i in ("216.58.217.142" "17.142.160.59" "72.163.4.161") do (
   if not exist %dirPath%\%%i.txt (
      systeminfo | find "Time Zone:" > %dirPath%\%%i.txt
   )
   echo. >> %dirPath%\%%i.txt
   echo %date% %time% >> %dirPath%\%%i.txt
   ping -n %pingCount% -w %timeOut% %%i >> %dirPath%\%%i.txt
)

[ More Info ]

[/os/windows/commands/batch] permanent link

Mon, May 15, 2017 11:30 pm

Zooming in and out in an email message in Outlook 20016

If the text is too small for you to read or you want to see more text in a given area while editing an email message in the Outlook email client in Microsoft Office 2016 on an Apple laptop, such as a MacBook Pro runing the OS X/macOS operating system, you can do so without changing the font size for text in the message by holding down the control key on the keyboard while scrolling up or down with two fingers on the touchpad. If you run two fingers downwards on the touchpad while holding down the control key, you will zoom in, enlarging the text, while if you run two fingers upwards on the touchpad, you will zoom out, making the text smaller.

[/network/email/clients/outlook/2016] permanent link

Sun, May 14, 2017 10:55 pm

Running chkdsk from Windows File Explorer

You can run the Microsoft Windows chkdsk program from within the Windows File Explorer by right-clicking on the drive you wish to check and selecting Properties or with the drive selected, click on Properties from the tool bar at the top of the File Explorer window. Then click on Tools tab and then the Check button.

[ More Info ]

[/os/windows/filesystem] permanent link

Thu, May 11, 2017 10:38 pm

Firefox in Force Quit Applications, but not in Activity Monitor

Firefox stopped responding whenever I attempted to access a site. I could verify network connectivity to various sites with ping, but if I attempted to access a URL in the Firefox browser on my MacBook Pro running OS X El Capitan, Firefox (version 45.7.0) would not display any webpage. I've had this problem in the past; when it occurred, I would quit Firefox, sometimes using Force Quit Applications, which is available by clicking on the Apple icon at the top, left-hand corner of the screen and then selecting Force Quit and then selecting Firefox from the Force Quit Applications list of running applications and then clicking on the Force Quit button. When I did that today, I saw the message below as usual:

Do you want to force "Firefox" to quit?

You will lose any unsaved changes.

 

I clicked on Force Quit, but that seemed to have no effect. I closed and reopened Force Quit Applications and went through the same process numerous times, but no matter how many times I repeated the process, Firefox remained in the list of running applications that it showed.

[ More Info ]

[/os/os-x] permanent link

Sun, May 07, 2017 6:09 pm

Centering an image on a webpage horizontally

To center an image horizontally on a webpage, you can add style="display: block; margin: auto;" to the img tag. E.g.

<p> <img src="320px-Fisher_500_radio.jpg" alt="Fisher AM/FM radio from 1959" width="320" height="208" style="display: block; margin: auto;"> </p>

Fisher AM/FM radio from 1959

Related articles:

  1. Centering a div and an image within it using CSS

[/network/web/html/css] permanent link

Sat, May 06, 2017 10:55 pm

Installing Homebrew on Mac OS X

Homebrew is a free and open-source (FOSS) package management system that is available for OS X/macOS systems. Homebrew makes extensive use of GitHub to expand the support of several packages through user contributions. The software was written by Max Howell in 2009; as of July 2016 there was a team of twelve developers maintaining the software. You can install it by opening a Terminal window and issuing the command /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)". I recommend putting the sudo command at the beginning of the command, so you won't be prompted so many times to provide the password for your account during the installation, i.e., sudo /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)".

[ More Info ]

[/os/os-x] permanent link

Fri, May 05, 2017 10:46 pm

Using MTR for network diagnostics

Traceroute and ping are commonly provided with operating systems as tools to diagnose problems in network connectivity between systems. Another very useful took, which combines the functionality of both those other tools is My traceroute, which was originally know as Matt's traceroute, aka MTR. The software is available for Linux systems and also for Microsoft Windows sytems as WinMTR.

The software can be installed via the package management system for some Linux distributions. E.g., it can be installed on a CentOS Linux system with yum using the command yum install mtr. You can check on whether it is installed on a CentOS system with the command rpm -qi mtr or you can just issue the command which mtr on a Linux system.

[ More Info ]

[/network/tools] permanent link

Tue, May 02, 2017 11:18 pm

Safari.app wants to use confidential information in your keychain

When I sat down at my MacBook Pro laptop running OS X El Capitan today, I saw the message below (image):

Safari wants to use your confidential
information stored in "A49A5BE4-6FB4-4399-9EB3-3DBA06717BEF"
in your keychain.

Do you want to allow access to this item?

       

The "A49A5BE4-6FB4-4399-9EB3-3DBA06717BEF" wasn't an identifier I recognized. If you see such a message, you can search for the identifier in the message using the Keychain Access application, which is located in the Applications/Utilities folder. After opening the program, click on Edit and then select Find. In the upper, right-hand corner of the window, you will see a field to the right of a magnifying glass icon where you can type the text for which you wish to search. I could type just part of the string, e.g. "A49A5" to locate the relevant entry.

[ More Info ]

[/network/web/browser/safari] permanent link

Mon, May 01, 2017 11:16 pm

Installing Wireshark on Mac OS X El Capitan

Wireshark is free and open-source software that provides packet capture and analysis capabilities. The software is available for Mac OS X/MacOS systems. An Apple Disk Image .dmg file can be downloaded from Download Wireshark. After downloading the .dmg file, double-click on it to open it. Inside the .dmg file you will see a .pkg file and a Read me first.rtf file.

Wireshark DMG file

Double-click on the .pkg file to start the installation.

[ More Info ]

[/os/os-x] permanent link

Sun, Apr 30, 2017 8:33 pm

SORBS Blocking Email from Gmail

A family member reported that she hadn't received an email message sent to her today by a Gmail user who had sent her message in reply to the family member's email to her. Since I administer the Sendmail email server she uses, I checked the Sendmail log file at /var/log/maillog. I saw the outgoing email sent to the Gmail address, but no incoming email from that address. So I sent email messages from a Gmail account I have as well as email messages from other external addresses to the root account on the server. The other email messages arrived, but none I sent from the Gmail account arrived. So I ran tcpdump on the server to capture data to/from port 25 on the system, which is the well-known port for Simple Mail Transfer Protocol (SMTP) traffic. I then sent another email message to the root account on the Sendmail server from my Gmail account. After allowing several minutes for an attempted delivery from the Gmail server to occur, I stopped the packet capture with Ctrl-C.

# tcpdump -i enp1s4 port 25 -w smtp_2017-04-30.pcap
tcpdump: listening on enp1s4, link-type EN10MB (Ethernet), capture size 65535 bytes
^C225 packets captured
225 packets received by filter
0 packets dropped by kernel
# ls -lh smtp_2017-04-30.pcap 
-rw-r--r--. 1 tcpdump tcpdump 33K Apr 30 12:33 smtp_2017-04-30.pcap
#

[ More Info ]

[/network/email/spam/sorbs] permanent link

Sun, Apr 23, 2017 11:31 pm

Phishing email leading to ridersrepublic.in

Someone notified me that she had received an email from a business contact a couple of days ago informing her that he had shared a document using Dropbox. But when she later contacted his company, she was informed that someone else was sending out email using his email address. She forwarded the message to me, which is shown below with the actual sender's address changed, though:

Subject: Blaine Watkins has shared a file with you using Dropbox
From: Blaine Watkins <blainewatkins@example.com>
Date: Tue, April 18, 2017 6:09 pm
To:

Hi, I just uploaded a Document for you to see using Dropbox. View|Download files and let me know what you think.

Thanks

Blaine

She was concerned that her system might have been infected by malware when she viewed the message. I scanned her system with SUPERAntiSpyware Free Edition, but SUPERAntiSpyware didn't find any malware recently placed on her system. McAfee Total Protection is the real-time antivirus software on her system, but I've found that using additional tools, such as SUPERAntiSpyware, can sometimes detect malware missed by a user's antivirus software. I performed a full scan of the system using McAfee Total Protection after running the SUPERAntiSpyware scan, but it didn't find anything, either. I also checkd the system with Malwarebytes Anti-Malware Home (Free), but it didn't find any malware, either, except for a zip file I created containing files associated with malware I found on the system quite some time ago.

[ More Info ]

[/security/phishing] permanent link

Sat, Apr 22, 2017 11:20 pm

Vertically aligning an image with text using CSS

If you wish to vertically align an image with text in Hypertext Markup Language (HTML) code that is compliant with Cascading Style Sheets (CSS) you can do so using <style="vertical-align: position;"> where position is bottom, middle, or top. E.g., if I want to align an image of the direct current symbol, which is a horizontal line over top of three shorter horizontal lines, so that the image is vertically in the middle of the text, I could use the code below:

24V <img src="direct-current.gif" width="49" height="49" style="border: none; vertical-align: middle;" alt="Direct current symbol">1500mA

I would then see the following:

24V Direct current 
symbol1500mA

If I used vertical-align: top, instead, the image would appear as shown below where the text is aligned with the top of the image:

24V Direct current 
symbol1500mA

If I used vertical-align: bottom, instead, the image would appear as shown below:

24V Direct current 
symbol1500mA

If I did not specify a vertical alignment, the image would appear as it did when I specified "bottom" for the vertical alignment as shown below:

24V Direct current symbol1500mA

Though, in this case I could also have used the HTML code &#9107;, instead, for the direct current symbol and avoided the use of an image and the need to align the image with the text, though I didn't realize that when I started using the image on a page for power adapter for various devices.

E.g.: 24V ⎓ 1500mA

[/network/web/html/css] permanent link

Wed, Apr 19, 2017 10:11 pm

Excel 2016 - Workbook Protected

I wanted to add another sheet to an Excel workbook, but when I clicked on the "+" to add the additional worksheet, I saw the message "Workbook is protected and cannot be changed."

Excel 2016 - workbook protected

I didn't know what the password might be because I had never set a password for the workbook, which I had created in a prior version of Excel; I'm using Microsoft Office 2016 on a MacBook Pro running OS X El Capitan (10.11.6) at the moment.

[ More Info ]

[/software/office/excel] permanent link

Tue, Apr 18, 2017 11:23 pm

Vinagre RDP client for CentOS 7

I needed to connect to a Microsoft Windows 10 system using the Remote Desktop Protocol (RDP) from a CentOS 7 system. I've used rdesktop software to control a Windows system from a Linux system in the past and I thought there might be an rdesktop package available for CentOS, but when I tried to install one with yum, I found that none was available.

# yum install rdesktop
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.sonn.com
 * epel: archive.linux.duke.edu
 * extras: centos.vwtonline.net
 * updates: centos.firehosted.com
No package rdesktop available.
Error: Nothing to do
#

But I found that Vinagre, was already available on the system. Vinagre is a Virtual Network Computing (VNC), Secure Shell (SSH), Remote Desktop Protocol (RDP) and Simple Protocol for Independent Computing Environments (SPICE) client for the GNOME desktop environment.

[ More Info ]

[/network/rdp] permanent link

Thu, Apr 13, 2017 10:37 pm

Counting the number of instances of a process on Microsoft Windows

If you need to know the number of instances of a particular process running on a Microsoft Windows system, you can see all of the instances by using the tasklist /fi option to filter the output from the tasklist command by imagename. E.g., I could view information on the PuTTY processes currently running on a Windows system with the command below:

C:\>tasklist /fi "IMAGENAME eq putty.exe"

Image Name                     PID Session Name        Session#    Mem Usage
========================= ======== ================ =========== ============
putty.exe                    57380 Console                    1      4,404 K
putty.exe                    49012 Console                    1      3,584 K
putty.exe                    72424 Console                    1      3,060 K
putty.exe                     8028 Console                    1      3,992 K
putty.exe                    96136 Console                    1      4,632 K
putty.exe                   102860 Console                    1      2,936 K
putty.exe                    87200 Console                    1      4,572 K
putty.exe                   121020 Console                    1      2,908 K
putty.exe                   100348 Console                    1      4,228 K
putty.exe                    81692 Console                    1      3,068 K
putty.exe                   118448 Console                    1      2,020 K
putty.exe                   102856 Console                    1      2,544 K
putty.exe                   126692 Console                    1      4,332 K
putty.exe                   133004 Console                    1      3,664 K
putty.exe                   136344 Console                    1      5,204 K
putty.exe                   126408 Console                    1      3,620 K
putty.exe                   114896 Console                    1      2,880 K
putty.exe                   132868 Console                    1      2,972 K
putty.exe                   133048 Console                    1      3,860 K
putty.exe                   139232 Console                    1      3,732 K
putty.exe                   132756 Console                    1      2,928 K
putty.exe                   136484 Console                    1      3,576 K
putty.exe                   147964 Console                    1      2,960 K
putty.exe                   142800 Console                    1      6,136 K
putty.exe                   139192 Console                    1      2,952 K
putty.exe                    32748 Console                    1      2,896 K
putty.exe                    78048 Console                    1      3,596 K
putty.exe                   113756 Console                    1      3,304 K
putty.exe                    62572 Console                    1      4,120 K
putty.exe                    17620 Console                    1      3,376 K
putty.exe                    36156 Console                    1      1,756 K
putty.exe                    86144 Console                    1      3,528 K
putty.exe                     4600 Console                    1      4,440 K
putty.exe                    46532 Console                    1      6,048 K
putty.exe                    49572 Console                    1      2,884 K
putty.exe                    69560 Console                    1      3,268 K
putty.exe                    67948 Console                    1      4,120 K
putty.exe                   139328 Console                    1      2,948 K
putty.exe                    25888 Console                    1      6,552 K
putty.exe                   119096 Console                    1      3,676 K
putty.exe                    48572 Console                    1      3,084 K
putty.exe                   132724 Console                    1      6,720 K
putty.exe                   123480 Console                    1      2,944 K
putty.exe                   148548 Console                    1      3,704 K
putty.exe                    46280 Console                    1      7,860 K
putty.exe                   146844 Console                    1      4,648 K
putty.exe                    47612 Console                    1      6,548 K
putty.exe                    84404 Console                    1      3,060 K
putty.exe                    35920 Console                    1     15,780 K
putty.exe                    91288 Console                    1     14,832 K
putty.exe                   115612 Console                    1      5,216 K
putty.exe                    85164 Console                    1      6,972 K
putty.exe                    22796 Console                    1      9,640 K
putty.exe                    87868 Console                    1     15,596 K

C:\>

If I don't want to manually count the instances, I can use the find command as shown below:

C:\>tasklist /fi "IMAGENAME eq putty.exe" | find /i /c "putty.exe"

54

C:\>

The /i option to the find command tells find that the case of letters is unimportant, i.e., it should match either lowercase or uppercase letters. The /c option instructs it to display a count for the number of matching lines it found.

If I want to put the count in a variable in a batch file, I can use the the command noted in Setting a Variable to be the Output of a Command.

Alternatively, you can use a Windows Management Instrumentation Command-line (WMIC) command. E.g.:

C:\>wmic process where name="putty.exe" get name | find /c "putty.exe"
54

C:\>

Related articles:

  1. Obtaining a list of running processes and their associated PIDs Date: April 8, 2017
    MoonPoint Support

[/os/windows/commands] permanent link

Wed, Apr 12, 2017 10:02 pm

Firefox - the page isn't redirecting properly

If you are seeing a "Firefox has detected that the server is redirecting the request for this address in a way that will never complete" message, the problem may be resolved by removing cookies or history associated with the site, but you might also need to check the cookies exceptions list in Firefox; that's how I was finally able to resolve a problem accessing a particular site that I could access in another browser on a system, but not with Firefox.

When trying to log into the Rakuten Marketing website using Firefox 52.0.1 on a Windows 10 system, I saw the message below after being redirected to http://cli.linksynergy.com/cli/common/login.php:

The page isn't redirecting properly


Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

• This problem can sometimes be caused by disabling or refusing to accept cookies.

[ More Info ]

[/network/web/browser/firefox] permanent link

Tue, Apr 11, 2017 8:37 pm

Writing to a CSV file with Python

I need to track the status of firewall rule requests and provide a status report every Monday. The requests are managed through a website where I can see the list of uncompleted requests and their status, but the site doesn't give me a count of the number of requests in each of the states that a request can be in, which can be "Pending Approval", "Modified", "Pending Removal" "On Hold", "Clarification Required", "Waiting Implementation", or "Waiting Removal". To obtain the count of the number of requests in each state, I download the webpage showing the requests and their status to my laptop and then run a Python script to count the queued items. But I also want to see how the numbers are changing over time, so I modified the script to write the counts to a comma-separated values (CSV) file that I can open in a spreadsheet program, such as Microsoft Excel.

To work with comma-separated value (CSV) files in a Python script, include the command import csv in the script. I also include the os.path module to use for testing whether a file already exists that will hold the data, the re module to perform regular expression parsing of lines in the downloaded webpage, the sys module for checking the command line arguments to the script, and the datetime module for determining the current date and formatting it in YYY-MM-DD format, where "YYYY" is the year, "MM" the month, and "DD" the day of the month, as explained in Python - Checking times and dates, for writing the date to the output file.

[ More Info ]

[/languages/python] permanent link

Mon, Apr 10, 2017 8:37 pm

Somone else is still using this PC

I connected remotely to a Microsoft Windows 10 system using the Remote Desktop Protocol (RDP). I updated some software on the system which required a reboot, so I clicked on the Windows Start button and chose to restart the system, however I saw the message "Someone else is still using this PC. If you restart now, they could lose unsaved work." There was a "Restart anyway" button, but, since it was late on a Sunday night, I didn't think anyone else should be accessing the system.

Someone else is still using this PC

[ More Info ]

[/os/windows/win10] permanent link

Sun, Apr 09, 2017 4:51 pm

Adding a checkbox in Microsoft Excel

To add a checkbox (check box, tickbox, tick box) column in Microsoft Excel, you will need to first enable the developer ribbon in Excel, if it is not already enabled. To do so, take the following steps in Excel (the steps were written for Excel 2010 and 2013, but may be similar for other versions):

Click on File and select Options.

Excel - File - 
Options

[ More Info ]

[/software/office/excel] permanent link

Sat, Apr 08, 2017 11:26 pm

Obtaining a list of running processes and their associated PIDs

If you need to get a list of the processes running on a Microsoft Windows system and the process identifier (PID) for each of those processes, you can get the information from a command line interface (CLI), e.g., a command prompt, using the tasklist command or the Windows Management Instrumentation Command-line (WMIC) command wmic process get name, processid. If you wish to filter the output so that you only see information for a specific process, you can use the /fi option for the tasklist command. E.g., if I only wanted to determine the PID for the QuickBooks QBW32.exe process, I could use the command tasklist /fi "imagename eq QBW32.exe". With WMIC, you can include a "where" option, e.g., wmic process where name='QBW32.exe' get name, processid.

[ More Info ]

[/os/windows/commands] permanent link

Fri, Apr 07, 2017 3:14 pm

Counting SQLite records based on a specified date

I track work requests in an SQlite database. For each request in a table named "Tasks" in the database, there is a column holding the date the request was approved. Every week I need to include the number of requests approved that week in a weekly report. I can do that with the Structured Query Language (SQL) command SELECT COUNT(*) FROM Tasks WHERE Approved >= date(CURRENT_DATE,"-7 day"). I have a Python script that queries the SQL database to count the requests approved within the last week, but sometimes I want to determine the number of requests approved since a particular date. So I modified the script to accept a date provided as an argument on the command line and, if a date is specified, to determine the number of entries where the approval date matches the specified date or is later than the specified date.

[ More Info ]

[/languages/python] permanent link

Wed, Apr 05, 2017 10:47 pm

Counting queued items with a Python script

I need to review and approve firewall rule requests. I can get a list of those pending approval, ones requesting a modification to existing rules, those pending removal because they've expired (all rules must be reviewed on at least a yearly basis), ones on hold, ones that are in a "clarification required" state due to a question about the rules being requested, those approved for implementation, but not yet implemented, and those awaiting removal. But the page that displays the requests in each category doesn't give me a count of the number in each category, so I wrote a Python script that will read the webpage containing that information that I've downloaded, parse the HTML code for the page and give me a count of the number of requests in each category.

The script is named count_queued.py . The name of the HTML file that was downloaded should be provided on the command line. E.g.:

$ ./count_queued.py ~/Documents/Work/queued/Request.html
Request Status

Pending Approval:       69
Modified:               36
Pending Removal         43
On Hold:                0
Clarification Required: 28
Waiting Implementation: 26
Waiting Removal:        12

Total requiring review: 176
$

[ More Info ]

[/languages/python] permanent link

Sun, Apr 02, 2017 8:49 pm

Color & BgColor Clickable BBCode Bar Mod installation

When I attempted to install the Color & BgColor Clickable BBCode Bar mod on a Simple Machines Forum (SMF) 2.0.13 forum I saw an "Error in Packages" message:

Error in Package Installation
At least one error was encountered during a test installation of this package. It is strongly recommended that you do not continue with installation unless you know what you are doing, and have made a backup very recently. This error may be caused by a conflict between the package you're trying to install and another package you have already installed, an error in the package, a package which requires another package that you don't have installed yet, or a package designed for another version of SMF.

[ More Info ]

[/network/web/forums/smf] permanent link

Sat, Apr 01, 2017 6:14 pm

Can't log into phpMyAdmin

I was unable to log into phpMyAdmin from Firefox. Every time I entered the user name and password, I would be presented with the login screen again. I was able to resolve the problem by removing the coookies for the site on which phpMyAdmin was running from within Firefox 52.0 by the following process:
  1. Click on the menu button at the top, right-hand corner of the Firefox window - the one that has 3 horizontal bars - and select Options.
  2. Select Privacy.
  3. Click on the link under History for "remove individual cookies".
  4. Click on the site on which phpMyAdmin is running to select that site, then click on Remove Selected. Don't click on Remove All or you will remove cookies for all sites.

    Firefox - Removed Selected Cookies

  5. Click on Close to close the cookies list window.

[/network/web/tools/phpmyadmin] permanent link

Tue, Mar 28, 2017 9:39 pm

Determining which packages were recently installed on a CentOS Linux system

I needed to determine which packages were recently installed on a CentOS 7 system where yum is used to install packages. The command rpm -qa --last will list all packages that have been installed in chronological order with the most recently installed packages listed first, since the --last option orders the package listing by install time such that the latest packages are at the top. E.g.:

# rpm -qa --last
amarok-utils-2.8.0-19.el7.x86_64              Fri 12 Aug 2016 09:02:34 PM EDT
amarok-libs-2.8.0-19.el7.x86_64               Fri 12 Aug 2016 09:02:34 PM EDT
amarok-2.8.0-19.el7.x86_64                    Fri 12 Aug 2016 09:02:31 PM EDT
taglib-extras-1.0.1-8.el7.x86_64              Fri 12 Aug 2016 09:02:17 PM EDT
mariadb-embedded-5.5.50-1.el7_2.x86_64        Fri 12 Aug 2016 09:02:17 PM EDT
qjson-0.8.1-4.el7.x86_64                      Fri 12 Aug 2016 09:02:15 PM EDT
kdelibs-webkit-4.14.8-1.el7.x86_64            Fri 12 Aug 2016 09:02:14 PM EDT
qtscriptbindings-0.2.0-5.el7.x86_64           Fri 12 Aug 2016 09:02:13 PM EDT
qtwebkit-2.3.4-6.el7.x86_64                   Fri 12 Aug 2016 09:01:57 PM EDT
alpine-2.20-2.el7.x86_64                      Mon 08 Aug 2016 10:13:54 PM EDT
fuse-sshfs-2.5-1.el7.x86_64                   Mon 08 Aug 2016 09:28:26 PM EDT
gpg-pubkey-352c64e5-52ae6884                  Mon 08 Aug 2016 09:27:13 PM EDT
epel-release-7-6.noarch                       Mon 08 Aug 2016 09:12:51 PM EDT
lynx-2.8.8-0.3.dev15.el7.x86_64               Fri 05 Aug 2016 10:28:17 PM EDT
telnet-0.17-59.el7.x86_64                     Sat 30 Jul 2016 04:34:17 PM EDT
thunderbird-45.2-1.el7.centos.x86_64          Sat 30 Jul 2016 04:10:55 PM EDT
mutt-1.5.21-26.el7.x86_64                     Sat 30 Jul 2016 03:50:58 PM EDT
<text snipped>
gnu-free-fonts-common-20120503-8.el7.noarch   Fri 15 Jul 2016 03:10:39 PM EDT
dejavu-fonts-common-2.33-6.el7.noarch         Fri 15 Jul 2016 03:10:39 PM EDT
libgcc-4.8.5-4.el7.x86_64                     Fri 15 Jul 2016 03:10:38 PM EDT
fontpackages-filesystem-1.44-8.el7.noarch     Fri 15 Jul 2016 03:10:38 PM EDT
control-center-filesystem-3.14.5-8.el7.x86_64 Fri 15 Jul 2016 03:10:38 PM EDT
#

[ More Info ]

[/os/unix/linux/centos] permanent link

Sun, Mar 26, 2017 5:10 pm

Unrar for Centos 7

I needed to convert a rar file to a zip file on a CentOS 7 Linux system. But when I tried installing an unrar package with yum, the package manager on the system, I found none was available from any of the software repositories the system was configured to check for packages.

# yum install unrar
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.firehosted.com
 * epel: mirror.us.leaseweb.net
 * extras: centos.aol.com
 * updates: mirror.umd.edu
No package unrar available.
Error: Nothing to do
# yum install rar
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.firehosted.com
 * epel: mirror.us.leaseweb.net
 * extras: centos.aol.com
 * updates: mirror.umd.edu
No package rar available.
Error: Nothing to do
#

I had previously installed support for the Extra Packages for Enterprise Linux (EPEL) repository, but though I thought the unrar package might be found there, it wasn't found. I did find an RPM file for the software, howerver, at RPM CentOS 7 unrar 5.0.12 x86_64 rpm. I downloaded that file with wget and, since yum can be used to install RPM files, installed it with yum.

[ More Info ]

[/os/unix/linux/centos/7] permanent link

Sat, Mar 25, 2017 10:56 pm

Using the more command to discard lines at the beginning of a file

If you wish to ignore lines at the start of output or in the beginning of a file, you can use the more command to do so. E.g., suppose I have a text file named fruit.txt that contains the following lines:

apple
banana
clementine
date
eggplant
fig
grape

On a Linux, Unix, or OS X/macOS system, if I want to see all lines of the file but the first one, I can use the +n, where n is a number, argument to the more command. In this case, I can use more +2 fruit.txt to start the output at the second line in the file.

$ more +2 fruit.txt
banana
clementine
date
eggplant
fig
grape
$

If I wanted to ignore the first four lines and start output at the fifth line, I could use more +5.

$ more +5 fruit.txt
eggplant
fig
grape
$

[ More Info ]

[/os/unix/commands] permanent link

Fri, Mar 24, 2017 10:31 pm

Redirecting SQLite output to a file

If you need to redirect the output of SQL commands to a file while using SQLite, you can do so using the .output command. E.g., I have an SQLite database on my MacBook Pro laptop running OS X that contains a table named Equipment. Within that table is a column named Device that is a description for the particular piece of equipment in the table entry. I can view just that field for all records with the SQLite command SELECT Device FROM Equipment. To direct the output of the command to a text file named device.txt, I can use the command .output device.txt. After executing the command to select the Device field from all records, I can then issue the .output command without any arguments to it to return to having the output of commands displayed on the console rather than going to the file.

$ sqlite3 ~/Documents/Work/CRQ/CRQ.db
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.
sqlite> .output device.txt
sqlite> SELECT Device FROM Equipment;
sqlite> .output
sqlite>

[/software/database/sqlite] permanent link

Fri, Mar 17, 2017 6:19 pm

OS X "arrange by" in column view

I usually have the OS X Finder set to display folders and files in alphabetical order by setting the view mode to arrange the display of files and folder by name. But sometimes I switch to view by size, etc. However, when I then switch back to view the files and folders in column mode arranged by name, Finder doesn't actually display them in alphabetical order, which is annoying.

I finally got to the point where the issue was so annoying that I felt I had to find a solution. I found Brett Taylor's HOWTO: Fix file sorting in Finder‘s column view on Mac OS X Lion article which provided a means to address the issue. Though the title for his article, which acknowledges Barney-15E's post at In OS X Lion, Finder will not "Arrange By > Name" in "Column view", references OS X Lion, I found the solution worked for OS X El Capitan (10.11.6) on my MacBook Pro.

[ More Info ]

[/os/os-x] permanent link

Thu, Mar 16, 2017 10:30 pm

Outlook 2016 unspecified encryption certificate message

After resolving a problem with my laptop not reading certificates stored on my Personal Identity (PIV) card. I've been able to decrypt email messages from others with Outlook 2016 on my MacBook Pro laptop running OS X El Capitan (10.11.6) by using my PIV card in the SCR331 card reader, but when I attempt to send an encrypted email, I see a message stating (image):

You have not specified an encryption certificate for this account. Once you send this encrypted message, you will not be able to read it. Do you still want to send this encrypted message?

If I click on Continue the email will be sent encrypted so that it is readable by the recipients when their email clients decrypt it using their private keys, but I am unable to read the message I sent when it is placed in my Sent folder. To resolve the problem, I clicked on Tools on the Outlook menu bar, then selected Accounts, then clicked on the Advanced button. I then clicked on the Security tab and selected a certificate in the Encryption section. It had been set to "None Selected".

[ More Info ]

[/security/encryption] permanent link

Tue, Mar 14, 2017 8:51 pm

Adding the SNMP service to a Windows 10 system

You can check on whether the Simple Network Management Protocol (SNMP) service has already been added to a Microsoft Windows 10 system by opening a Services window and scrolling through the list of services to see if SNMP is present. You can open a Services window to check the list of installed services by typing services in the Cortana "Ask me anything" field and hitting Enter. The best match shown should be "Services Desktop app". You can click on it to see the list of Windows services.

SNMP service not present

If you see SNMP Trap, but not SNMP Service, you will need to add the service. The process for adding it is similar to the process of adding support for SNMP under Windows 7.

[ More Info ]

[/os/windows/win10] permanent link

Sun, Mar 12, 2017 10:57 pm

Let's Encrypt certificate expired

A couple of days ago, a user showed me a message she saw on her system about a security certificate issue. When I looked at the message, I realized it was due to the expiration of the Let's Encrypt certificate on the email server used by her system. I logged into that system and queried the server with the openssl command to check the expiration date. I saw it had expired that day, March 10.

# echo "quit" | openssl s_client -connect pop3.moonpoint.com:995 -quiet
depth=2 O = Digital Signature Trust Co., CN = DST Root CA X3
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = Let's Encrypt Authority X3
verify return:1
depth=0 CN = imap.moonpoint.com
verify error:num=10:certificate has expired
notAfter=Mar 10 19:53:00 2017 GMT
verify return:1
depth=0 CN = imap.moonpoint.com
notAfter=Mar 10 19:53:00 2017 GMT
verify return:1
+OK Dovecot ready.
#

From the root account, I renewed the certificate using the command letsencrypt renew.

[ More Info ]

[/security/encryption/openssl] permanent link

Sat, Mar 11, 2017 4:53 pm

Losing Internet connectivity via Wi-Fi on an OS X system

On my MacBook Pro laptop running OS X El Capitan (10.11.6), I've been losing Internet connectivity periodically. Though it appears I still have Wi-Fi connectivity, when I attempt to access websites through a browser I find that I can't access sites at times, though a moment before I had no issues browsing the Web. Firefox will display a "Server not found" message. If I go to a Terminal window and try to ping any IP address, I see "request timeout" messages.

$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 0 packets received, 100.0% packet loss
$

If I check the status of the WiFi connection using the airport command, I see that it is very noisy, though the signal stength is good, which I would expect, since the laptop is only a few feet from the wireless router.

$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I
     agrCtlRSSI: -39
     agrExtRSSI: 0
    agrCtlNoise: -93
    agrExtNoise: 0
          state: running
        op mode: station 
     lastTxRate: 73
        maxRate: 72
lastAssocStatus: 0
    802.11 auth: open
      link auth: wpa2-psk
          BSSID: 94:44:52:4a:43:40
           SSID: Rain
            MCS: 7
        channel: 11
$

[ More Info ]

[/os/os-x/wireless] permanent link

Wed, Mar 08, 2017 10:54 pm

Unable to read certificates from PIV card

I'd been having problems using a Personal Identity Verification (PIV) card with my MacBook Pro laptop running OS X El Capitan (10.10.5). I need the system to be able to access certificates on the PIV card in order to be able to decrypt email from some individuals. I have an SCR331 card reader, which attaches to the system via a Universal Serial Bus (USB) port.

SCR331 PIV card reader

If I attached the PIV card reader and clicked on the Apple icon at the top, left-hand corner of the screen and selected About This Mac then clicked on System Report, if I clicked on USB under Hardware, I would see the system recognized the card reader was attached. E.g., I saw "SCRx31 USB Smart Card Reader" for an SCR331 (that is a number on the underside of the device which appears to be its model number with a part number of 904875 listed there, also) PIV card reader I attached to the system via a USB port.

[ More Info ]

[/security/encryption] permanent link

Mon, Mar 06, 2017 11:28 pm

Finding files modified before or after a certain date with PowerShell

On a Microsoft Windows system, you can find files created before or after a specified date using the Get-ChildItem cmdlet. To use the cmdlet, open a PowerShell window - you can do so on a Windows 10 system by typing powershell in the Cortana "Ask me anything" window, hitting Enter, and then clicking on Windows PowerShell, which should be returned as the best match. If you wish to find files and directories before a certain date, you can use a command in the form Get-ChildItem | Where-Object {$_.LastWriteTime -lt date where date is the relevant date. E.g., on a system that uses the date format of mm/dd/yyyy where mm represents the month, dd the day and yyyy the year, a command like the one shown below, which returns a list of the files with a modification time prior to January 1, 2013, can be used:

PS C:\Users\Lila\documents> Get-ChildItem | Where-Object {$_.LastWriteTime -lt '1/1/2013'}


    Directory: C:\Users\Lila\documents


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----         9/9/2012  10:36 PM                Book Collector
d-----        11/8/2012   8:25 AM                Corel PaintShop Pro
d-----         4/6/2012   2:37 PM                recovered
-a----        4/14/2012   4:16 PM      761476464 Disc1.bin
-a----        4/14/2012   4:16 PM            941 Disc1.cue


PS C:\Users\Lila\documents>

[ More Info ]

[/os/windows/PowerShell] permanent link

Sat, Mar 04, 2017 10:00 pm

CSS max-width and min-width for @media

The third specification of the Cascading Style Sheets (CSS) style sheet language, CSS 3 provides support for media queries, which can adjust the display of information in a browser based on screen resolution, e.g. smartphone screen vs. computer screen, the width of the browser viewport, etc. This is done through the use of "@media, which can be used in a style sheet or a style element included in the <head> section of the HTML code.

Two parameters that can be used with @media are shown below:

max-widthThe maximum width of the display area, such as a browser window
min-widthThe minimum width of the display area, such as a browser window

[ More Info ]

[/network/web/html/css] permanent link

Fri, Mar 03, 2017 10:50 pm

Data loss provided by Microsoft's security "feature"

I was reminded tonight why one should avoid using Microsoft's latest desktop operating system, Windows 10, for any critical system. I had postponed some work on a Microsoft Windows 10 system that I was connected to by a Remote Desktop Protocol (RDP) connection. I had been working on the system a few days ago and returned to using the connection this evening only to see the system was going to reboot in a few minutes for an automatic update. I often have many applications and windows open at once and I knew there wasn't enough time for me to save all of my work, but I thought, even though I only had a few minutes remaining until the forced reboot, that I could at least postpone the reboot until tomorrow evening using the steps at Changing the time for a Windows 10 automatic restart that I've used before to postpone the forced reboot due to a software update. However, tonight when I got to the Windows Update settings window where a "Restart now" button appears, I was not able to click on "Change active hours" because that option did not appear under the "Restart now" button. I frantically tried to find another alternative. I thought, perhaps, I could hibernate the system to save the work in progress, but it was too late; the system rebooted and I lost all of the work in progress, much of which I'll be unable to recreate, since it had been several days since I had been working on the system and I now can't rememeber what I had put in some open Notepad windows, etc.

I understand the need to update systems to install security patches to prevent malware attacks, etc., but I've never lost data on this system over the course of several years due to such issues. I've only lost data due to Microsoft's automatic reboot "security feature".

I've read Microsoft is deigning to give their users a little more control over reboots due to automatic updates with the release of the Windows 10 "Creator's Edition" in April of 2017, e.g., see Windows 10 now prevents random reboots during updates, but Microsoft's decision that rebooting a system while a user is working on it even when there are open unsaved files, because Microsoft has decided that "this is for your own protection and too bad if you lose data" gives me a much more negative view of the company and its products. And I know there are many others similarly angered at the company after losing work to these forced reboots in Windows 10.

[/os/windows/win10] permanent link

Thu, Mar 02, 2017 9:52 pm

Extracting embedded documents from an Excel .xlsm file

I often receive Microsoft Excel files that have documents created by other Microsoft applications embedded within them. E.g., at the top of a worksheet I may see something like =EMBED("Visio.Drawing.11","").

EMBED Visio.Drawing

Sometimes I want to extract the embedded file. With a Microsoft Excel .xlsm file that is easy to do, because XLSM is a zipped, XML-based file format. To extract embedded documents, such as Visio drawings or PowerPoint presentations, I make a copy of the .xlsm file then rename the copy's extension from .xlsm to .zip. I can then extract the contents of the zip file. Within the directory that holds the extracted files, there will be a xl directory. Within that directory there is a media directory and within the media directory there is an embeddings directory that holds the embedded files, such as the Visio drawings in the example below.

$ ls ~/Documents/Work/CRQ/843940/unzipped
[Content_Types].xml	customXml		xl
_rels			docProps
$ ls ~/Documents/Work/CRQ/843940/test/xl
_rels			comments19.xml		comments9.xml
calcChain.xml		comments2.xml		ctrlProps
charts			comments20.xml		drawings
comments1.xml		comments21.xml		embeddings
comments10.xml		comments22.xml		media
comments11.xml		comments23.xml		printerSettings
comments12.xml		comments24.xml		sharedStrings.xml
comments13.xml		comments3.xml		styles.xml
comments14.xml		comments4.xml		theme
comments15.xml		comments5.xml		vbaProject.bin
comments16.xml		comments6.xml		workbook.xml
comments17.xml		comments7.xml		worksheets
comments18.xml		comments8.xml
$ ls ~/Documents/Work/CRQ/843940/unzipped/xl/media
image1.png	image2.jpeg	image4.emf	image6.emf	image8.emf
image10.emf	image3.emf	image5.emf	image7.emf	image9.png
$ ls ~/Documents/Work/CRQ/843940/unzipped/xl/embeddings
Microsoft_Visio_2003-2010_Drawing111.vsd
Microsoft_Visio_2003-2010_Drawing222.vsd
Microsoft_Visio_2003-2010_Drawing333.vsd
Microsoft_Visio_2003-2010_Drawing444.vsd
oleObject1.bin
oleObject2.bin
oleObject3.bin
oleObject4.bin
$

[ More Info ]

[/software/office/excel] permanent link

Wed, Mar 01, 2017 10:42 pm

Discarding configuration changes for a Juniper SRX router/firewall

If you've been entering commands for configuration changes on a Juniper Neworks SRX router/firewall, which runs the Juniper Network Operating System, Junos OS, but haven't committed those changes to make them active, you can discard them using the command rollback 0. which will replace the "candidate config", i.,e., the one you've been editing, with the active configuration, which is also the boot configuration.
root@Alder# rollback 0
load complete

[edit]
root@Alder#

The device can store multiple prior configurations and you can revert to one of those other prior configurations, instead, using rollback n where n is the number for the prior configuration. You can also rollback to a saved "rescue" configuration with rollback rescue. You an see a list of the stored configurations to which you can revert using the command rollback ?.

[ More Info ]

[/security/firewalls/SRX] permanent link

Tue, Feb 28, 2017 10:57 pm

Viewing Firefox cookie information with sqlite3 on Mac OS X

On a Macintosh, aka Mac, OS X/macOS system, the user profile directory where the Firefox web browser stores its data can be found at "/Users/account_name/Library/Application Support/Firefox/Profiles" where account_name is the relevant user name. The profile directory for the account will be a sequence of 8 characters followed by ".default". E.g.:

$ ls "/Users/jasmith1/Library/Application Support/Firefox/Profiles"
bgq13udo.default
$

Within that directory will be a cookies.sqlite file within which Firefox stores browser cookies. You can view those cookies outside of Firefox using the SQLite relational database management system software found on OS X/macOS systems. You can examine the sqlite file with the sqlite3 command, which you can run from a command line interface (CLI), i.e., a Bash shell prompt, by opening a Terminal window; the Terminal application is found in the Applications/Utilities directory. You can examine the structure of the database using the SQLite .schema command. There is a moz_cookies table within the database.

[ More Info ]

[/network/web/browser/firefox] permanent link

Sun, Feb 26, 2017 10:23 pm

Obtainining info on the optical drive in a CentOS Linux system

If you need to determine the manufacturer, type, or model of optical disc drive that is in a CentOS Linux system, you can log into the root account and use the dmesg command and pipe the output into the egrep command looking for key terms, such as "cdrom", "dvd", "cr/rw", or "writer" as shown below:

# dmesg | egrep -i 'cdrom|dvd|cd/rw|writer'
[    1.571327] ata1.00: ATAPI: TSSTcorpCD/DVDW SH-S182M, SB02, max UDMA/33
[    1.598476] scsi 0:0:0:0: CD-ROM            TSSTcorp CD/DVDW SH-S182M SB02 PQ: 0 ANSI: 5
[    1.635809] sr 0:0:0:0: [sr0] scsi3-mmc drive: 48x/48x writer dvd-ram cd/rw xa/form2 cdda tray
[    1.635819] cdrom: Uniform CD-ROM driver Revision: 3.20
#

[ More Info ]

[/os/unix/linux/centos] permanent link

Sat, Feb 25, 2017 10:48 pm

Determining the differences between the current version and a vi swap file

When I attempted to edit a file, index.php, using the vi editor, I saw the following message:

E325: ATTENTION
Found a swap file by the name ".index.php.swp"
          owned by: joe   dated: Mon Feb 20 19:36:11 2017
         file name: ~joe/www/UVNC/index.php
          modified: YES
         user name: joe   host name: example.com
        process ID: 19776
While opening file "index.php"
             dated: Mon Feb 20 19:38:44 2017
      NEWER than swap file!

(1) Another program may be editing the same file.  If this is the case,
    be careful not to end up with two different instances of the same
    file when making changes.  Quit, or continue with caution.
(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r index.php"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file ".index.php.swp"
    to avoid this message.

Swap file ".index.php.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:

I hit the q key to return to the Bash shell prompt. When I compared the time stamps on the current version of the file and the .swp file, I saw that the current version had a time stamp 2 minutes after the time stamp for the .swp file.

$ ls -al | grep 'index.php'
-rw-rw-r--. 1 joe joe   7571 Feb 20 19:38 index.php
-rw-r--r--. 1 joe joe  20480 Feb 20 19:36 .index.php.swp
$

[ More Info ]

[/software/editors/vi] permanent link

Fri, Feb 24, 2017 10:10 pm

Allowing UltraVNC server connectivity through BullGuard Firewall

If you are using BullGuard Firewall, which is part of the BullGuard Internet Security and Antivirus protection software, if you install UltraVNC for remote desktop management, you will see a message stating "VNC server is asking for access to the internet" whenever someone attempts to connect remotely to the system on which BullGuard Firewall is running.

BullGuard Firewall VNC server

[ More Info ]

[/security/firewalls/BullGuard] permanent link

Thu, Feb 23, 2017 10:08 pm

Determining and setting group membership from a command prompt

On a Microsoft Windows system, you can determine the username for an account from a command prompt window using the whoami command as shown below.

C:\Users\enzo\Documents>whoami
slartibartfast\enzo

C:\Users\enzo\Documents>

In the example above, the account name is enzo and the system name is slartibartfast.

If you want to determine what groups the account belongs to, which would enable you to determine if the account is in the administrators group, you could add the /groups argument to the command as shown below. I added the /fo list option as well to format the output as a list; if that option isn't specified the output will be in table format.

[ More Info ]

[/os/windows/commands] permanent link

Wed, Feb 22, 2017 11:10 pm

PhishMe Phishing Email

I received an email message today stating that all users of a system I use for work must update their security questions on a bi-yearly basis and that my account would be locked out in twenty four hours if my security questions were not updated within that time. Within the message was the Uniform Resource Locator (URL) for the relevant website. The message seemed suspicous, since I would expect to have received prior notices before one informing me I had only 24 hours left to update the questions and also I've not encountered instances of such sites requring security questions to be updated on a periodic basis, though it is common to require passwords to be updated periodically.

When I hovered my mouse pointer over the link in the message, I found that the first part of the name in the fully qualified domain name (FQDN) looked like something I would expect in a site name for my employer, but the ending of the domain name was securefileshares.com, which would not be a site I would go to to modify security questions for a work-related system. On my laptop, I use Outlook 2016 as my email; to view the email header for a message in Outlook 2016, you can take these steps, but most email clients provide a mechanism to view a message's header, which will show the originating system and other email servers a message has passed through. Viewing the header information, I saw the following lines:

Received-SPF: Temperror (SPF Temporary Error: DNS 'NoneType' object has no attri
bute 'header') identity=mailfrom; client-ip=52.1.96.230; helo=mail.nova.phishme.
com; envelope-from=postmaster@return--path.com; receiver=john.a.doe@example.com
<text snipped>
Received: from mail.nova.phishme.com (mail.nova.phishme.com [52.1.96.230])	by
<text snipped>
MIME-Version: 1.0
X-Priority: 3
X-PhishMe: Phishing_Training
X-PhishMeTracking: TjaVg7y+fe0Q/<text snipped>

The header lines showed it was a training exercise, since PhishMe is a company that helps organizations train their employees to avoid phishing attempts. But, if you have a question about whether a message you have received is legitimate or is a spoofed message that appears to come from a legitimate sender, such as your employer, bank, or some source you would trust, it is best to type in a link rather than click on one within an email, unless you observe the actual link very closely. It can also help to identify a message sent by someone spoofing a legitimate sender by examining message headers. It is trivially easy for a spammer, malware purveyor, or other malefactor to spoof a "From" address, so you should never assume that a "From" address is a reliable means of identifying a message's actual sender.

[/security/scams/phishing] permanent link

Tue, Feb 21, 2017 11:21 pm

Dovecot not responding

A user reported that she wasn't receiving any email. When I logged into the mail servers, which runs Dovecot for POP3/POP3S and used Telnet to connect to port 110, the well-known port for POP3, I didn't get any response after I entered the user command, so I exited to the telnet prompt with Ctrl-].

$ telnet 127.0.0.1 110
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
user nell
^]
telnet> quit
Connection closed.
$

I logged into the root account and checked today's and yesterday's maillog files for any references to Dovecot or POP3 issues, but saw none.

# grep -i dovecot /var/log/maillog
# grep -i dovecot /var/log/maillog.1
# grep -i pop3 /var/log/maillog.1
# grep -i pop3 /var/log/maillog
#

[ More Info ]

[/network/email/dovecot] permanent link

Tue, Feb 21, 2017 9:09 pm

Viewing the list of IP address ranges for AmazonAWS

If you need to create firewall rules for outgoing connectivity to Amazon Web Services (AWS) addresses, you can obtain a complete listing of the IP address ranges that Amazon uses in JavaScript Object Notation (JSON) format from AWS IP Ranges Are Now Available in JSON Format - the download URL for the file is https://ip-ranges.amazonaws.com/ip-ranges.json

I downloaded the IP address range file from https://ip-ranges.amazonaws.com/ip-ranges.json using cURL, which is present on Apple OS X/macOS systems and is available for Linux and many other operating systems, including Microsoft Windows - see Releases and Downloads.

$ curl -o ip-ranges.json https://ip-ranges.amazonaws.com/ip-ranges.json
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   99k  100   99k    0     0   191k      0 --:--:-- --:--:-- --:--:--  191k
$

The following Python script can be used to extract just the Classless Inter-Domain Routing (CIDR) address blocks, i.e., the ip_prefix information from the JSON data stored in the ip-ranges.json file downloaded from the Amazon website and display it.

#!/usr/bin/python
import json

data = json.load(open('ip-ranges.json'))
for d in data["prefixes"]:
    print d["ip_prefix"]

[ More Info ]

[/languages/python] permanent link

Mon, Feb 20, 2017 10:43 pm

Determining the last system image backup time for a Windows 10 system

I backed up a Windows 10 system to an external USB disk drive using the backup utility that comes with the operating system that can be run by right-clicking on the Windows Start button then choosing Control Panel then Backup and Restore (Windows 7), which is found beneath System and Security, and then choosing Create a system image. If you create a system in that manner and then later wish to know the date and time you backed up the system without reattaching the drive you used, you can do so from a command prompt window with administrator privileges by using the wbadmin get versions command as shown below:

C:\WINDOWS\system32>wbadmin get versions
wbadmin 1.0 - Backup command-line tool
(C) Copyright 2013 Microsoft Corporation. All rights reserved.

Backup time: 2/19/2017 8:31 PM
Backup target: 1394/USB Disk labeled Seagate Backup Plus Drive(E:)
Version identifier: 02/20/2017-01:31
Can recover: Volume(s), File(s), Application(s), Bare Metal Recovery, System State
Snapshot ID: {d4a62a80-ac6f-4aba-8886-6ba570c1284a}


C:\WINDOWS\system32>

Once you have the version identifier(s), you can use it to view the details regarding what volumes were backed up on the system to the external USB drive using a command in the form wbadmin get items -version:version_id.

[ More Info ]

[/os/windows/utilities/backup] permanent link

Sun, Feb 19, 2017 10:45 pm

Deleting a hidden file from a command prompt on a Windows system

The del command can be used at a command prompt on a Microsoft Windows system to delete files. But, if you try to delete a file using that command without specifically specifying that you wish to apply the command to a hidden file, you will receive a message stating windows could not find the file. To delete a hidden file, you need to use the /ah parameter before the file name as shown below.
C:\Users\enzo\Documents>dir /ah *.swp
 Volume in drive C is Windows
 Volume Serial Number is B688-ED25

 Directory of C:\Users\enzo\Documents

02/18/2017  12:51 PM            12,288 .system.html.swp
               1 File(s)         12,288 bytes
               0 Dir(s)  1,954,264,215,552 bytes free

C:\Users\enzo\Documents>del .system.html.swp
Could Not Find C:\Users\enzo\Documents\.system.html.swp

C:\Users\enzo\Documents>del /ah .system.html.swp

C:\Users\enzo\Documents>

The syntax for the del command is shown below:

C:\>del /?
Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

  names         Specifies a list of one or more files or directories.
                Wildcards may be used to delete multiple files. If a
                directory is specified, all files within the directory
                will be deleted.

  /P            Prompts for confirmation before deleting each file.
  /F            Force deleting of read-only files.
  /S            Delete specified files from all subdirectories.
  /Q            Quiet mode, do not ask if ok to delete on global wildcard
  /A            Selects files to delete based on attributes
  attributes    R  Read-only files            S  System files
                H  Hidden files               A  Files ready for archiving
                I  Not content indexed Files  L  Reparse Points
                -  Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.

C:\>

[/os/windows/commands] permanent link

Sat, Feb 18, 2017 3:30 pm

Changing the host name for a Windows system from a command prompt

There are a variety of ways you can determine the system name for a Windows computer from a command line interface (CLI), such as a command prompt or PowerShell prompt window. But what if you wish to rename the computer from a command line interface? You can obtain a command prompt and then use a Windows Management Instrumentation Command-line (WMIC) command in the form shown below where oldname is the curent name of the system and newname is the new name you wish to assign to the system.

wmic computersystem where caption='oldname' rename newname

[ More Info ]

[/os/windows/commands/wmic] permanent link

Fri, Feb 17, 2017 10:55 pm

Email to Text Message

If you would like to be notified of a system event by a SMS messsage, i.e., a text message, or otherwise have a need to send information from a computer to a phone by a text message, you can use a text to email capability provided by some phone service providers. To send a text message via email to a Verizon user, you can use the Verizon phone number for the person followed by @vtext.com - don't put any dots nor dashes in the phone number, just the digits of the phone number. E.g., if the person's phone number is 555-765-4321, you would send the message to 5557654321@vtext.com. If the person uses Sprint for phone and text messaging service, you would append @messaging.sprintpcs.com to the 10-digit phone number, i.e., 5557654321@messaging.sprintpcs.com. If the user has AT&T for his/her phone service, you can text the user by appending @txt.att.net to the number, e.g. 5557654321@txt.att.net. For T-Mobile, you can append @tmomail.net to the phone number.

[ More Info ]

[/network/email] permanent link

Tue, Feb 14, 2017 11:14 pm

Determining S.M.A.R.T disk drive status from a command prompt

Many hard disk drives have a Self-Monitoring, Analysis and Reporting Technology (S.M.A.R.T.) capability. On a Microsoft Windows system, you can use a utility such as SpeedFan to query the S.M.A.R.T, or SMART, information for a drive. You can also check the status of a drive using a Windows Instrumentation Command-line (WMIC) command by issuing the command wmic diskdrive get status at a command prompt, though you won't get the same level of detail. But if you have multiple drives in or atached to the system, you will need to use an additional parameter to identify which status applies to which drive. You could include the size and/or model, e.g.:

C:\Users\Lila>wmic diskdrive get status, size, model
Model                                   Size           Status
Seagate Backup+  Desk SCSI Disk Device  5000970240000  OK
Seagate Backup+ Desk USB Device         4000776192000  OK
Generic- Compact Flash USB Device                      OK
Generic- SD/MMC USB Device                             OK
Generic- MS/MS-Pro USB Device                          OK
WD My Book 1140 USB Device              2000363420160  OK
Generic- SM/xD-Picture USB Device                      OK
WDC WD4003FZEX-00Z4SA0 ATA Device       4000784417280  OK


C:\Users\Lila>

[ More Info ]

[/os/windows/commands/wmic] permanent link

Sun, Feb 12, 2017 5:44 pm

Configuring Windows 7 to hibernate on low UPS battery power

If you have an uninterruptible power supply (UPS) to provide battery backup for a Microsoft Windows system in the event of a power outage, you may want to change the default setting for the action that Windows takes when the battery charge is nearing depletion. The default setting is to put the system in sleep mode where the system saves the memory state to disk and stops most activities on the system, so that the system is using very little power. But, if the battery charge becomes totally depleted, if a system is in sleep mode when that happens, you will lose any unsaved work. You can reconfigure Windows to hibernate the system, instead. When the system goes into hibernation, the contents of memory are saved to disk in such a way that when the system is rebooted, you will be back to the state it was in before it was hibernated, so you haven't lost unsaved work, such as open documents in a word processor, etc.

[ More Info ]

[/os/windows/win7] permanent link

Sat, Feb 11, 2017 10:27 pm

Using Python to query an SQLite database and return a count of records

I have an SQLite database that I use to track work requests on my MacBook Pro running OS X El Capitan (10.11.6) . Every week I need to determine the number of change requests I've reviewed and approved in the last week. I have been running SQL commands from a text file using sqlite3, but I wanted to start using a Python script, instead, since I want to everntually perform some additional queries as well and display the results as a web page. Initially, I had some problems displaying the record count, but found I could use cursor.fetchone() to display the count. The script I currently have consists of the following code:

#!/usr/bin/python

import sqlite3
conn = sqlite3.connect('/Users/jasmith1/Documents/Work/CRQ/CRQ.db')
cursor = conn.cursor()

sql = 'SELECT COUNT(*) FROM Tasks WHERE Approved >= date(CURRENT_DATE,"-7 day")'
cursor.execute(sql)
result = cursor.fetchone()
numApproved = result[0]
print numApproved

The first step I need to take is to import the sqlite3 module for use in Python. I then need to create a connection object for the database which I assign to conn. After that I need to create a cursor instance that I will use to execute an SQL statement. I assign the SQL statement to the variable sql (the name is arbitrary) and then execute the statement with cursor.execute(sql). The variable result is then assigned the results of cursor.fechone(). If I printed the contents of the result variable, I would see (5,), if the count was 5, since the result is a tuple with one element, but I want to see just the number, so I set numApproved to be result[0]. Instead of setting numApproved to result[0] and printing numApproved, I could skip a step and use the following two lines after sursor.execute(sql):

(numApproved,) = cursor.fetchone()
print numApproved

If I make the script excecutable with chmod 755 and then run the script, I will then see just the number of reccords approved within the last week:

$ chmod 755 weeklyApprovalCount.py
$ ./weeklyApprovalCount.py
5

References:

  1. sqlite3 — DB-API 2.0 interface for SQLite databases
    Python documentation

[/languages/python] permanent link

Fri, Feb 10, 2017 10:37 pm

Attempting to kill unkillable processes

When I tried to update WireShark on a Windows 10 system to version 2.2.4, I saw the message "Wireshark or one of its associated programs is running. Please close it first."

Wireshark or one of its associated programs is running

I had to forcibly terminate two Wireshark processes with the Windows Task Manager prior to that message appearing in order to proceed with the upgrade, since I had seen a message that the installation could not proceed with Wireshark running, yet those instances of Wireshark wouldn't close when I tried to close them normally; one of the two was due to my trying a second time to start Wireshark when there was a long delay before it appeared.

I ran the Windows Task Manager with administrator privileges by typing Task Manager in the Cortana "Ask me anything" field and then right-clicking on Task Manager when it was returned in the search results. I saw Dumpcap, which is a process Wireshark and TShark run to perform packet capture, listed in the process list, so clicked on it to select it and then clicked on the End Task button, but that didn't actually terminate the process.

[ More Info ]

[/os/windows/processes] permanent link

Thu, Feb 09, 2017 10:51 pm

Installing MySQL on OS X El Capitan

The steps below can be taken to install the MySQL relational database management system software on an Apple OS X/macOS system. The steps were taken for MySQL version 5.7.17 on a MacBook Pro laptop running OS X El Capitan, but should be similar, if not exactly the same for other versions of MySQL and on other versions of OS X.

[ More Info ]

[/os/os-x] permanent link

Wed, Feb 08, 2017 8:41 pm

Running SQL commands from a text file using sqlite3

Every week I need to determine the number of tasks I reviewed and approved in the prior week. I track the tasks in a database on my MacBook Pro laptop using the SQLite utility that is part of the OS X operating system - see Using SQLite. I have a database named "CRQ" that contains a table named "Tasks". The schema for the table is shown below; approval dates are stored as integers; SQLite does not have a storage class specifically for dates, instead, the built-in Date And Time Functions of SQLite are capable of storing dates and times as TEXT, REAL, or INTEGER values1.

$ sqlite3 ~/Documents/Work/CRQ/CRQ.db
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.
sqlite> .schema Tasks
CREATE TABLE "Tasks" (
`CRQ`	TEXT NOT NULL,
`Task`	TEXT NOT NULL,
`URL`	TEXT,
`Received`	INTEGER,
`Reviewed`	INTEGER,
`Approved`	INTEGER,
`Notes`	TEXT,
`Summary`	TEXT
);
sqlite> .exit
$

I can open the database and manually type the command to count the records with an approval date on or after a date I specify using an SQL command like the one below:

$ sqlite3 ~/Documents/Work/CRQ/CRQ.db
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.
sqlite> SELECT COUNT(*) FROM Tasks WHERE Approved >= '2017-02-01';
11
sqlite>

[ More Info ]

[/software/database/sqlite] permanent link

Tue, Feb 07, 2017 9:43 pm

Attachments not visible in Outlook 2016

I recently received an update from Microsoft® Office 2011 on my MacBook Pro laptop to Microsoft Office 2016. Included with that update was the 2016 version of Microsoft Outlook for Mac, though if I click on Outlook from Outlook's menu bar and then select About Outlook, I see the following version information (image):

Version 15.27 (161010)
Product ID: 03109-000-000001
License: Volume License

One annoying issue I've encountered is that I don't see a way to view attachments sent with some messages within Outlook. I can see a paperclip icon to the right of the sender's name in the left pane of the outlook window, which indicates the message has been received with an attachment, but in the right pane where the contents of the window is displayed, there is no indication that the message has an attachment. And, if I double-click on the message to open it in a separate window there is no indication the message has an attachment. The only way I've found to easily gain access to the attachment is to view the message in Outlook Web App in a web browser. In its right pane, I see a "To:" line followed by a "CC:" line and then an "Attachments:" line with the name of the attachment shown. I can click on the attachment name to open of save it.

In Outlook 2016, if I right-click on the first message where I observed this problem and choose View Source, I see the following in the header lines, which indicates the message does indeed have an attachment:

Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: yes

[ More Info ]

[/network/email/clients/outlook/2016] permanent link

Mon, Feb 06, 2017 10:59 pm

Using Python scripts with Apache on OS X El Capitan

If you've got the Apache web server software working under OS X El Capitan, but want to use Python scripts with Apache, the following steps will allow you to run Python scripts from a cgi-bin directory.

First, ensure that the hash sign (#) is removed from the LoadModule cgi_module libexec/apache2/mod_cgi.so in /etc/apache2/httpd.conf. If you need to remove the hash/pound sign, restart Apache after modifying the file, which you can do with sudo apachectl restart. You will also need to use the sudo command to edit the file, if you edit it with a text editor such as GNU nano or vi.

[ More Info ]

[/os/os-x/apache] permanent link

Sun, Feb 05, 2017 10:51 pm

Using Perl with Apache under OS X El Capitan

If you've got Apache running on your Mac OS X system and want to be able to display the output of Perl programs, you need to remove the hash sign (#) from the following line in /etc/apache2/httpd.conf.

#LoadModule cgi_module libexec/apache2/mod_cgi.so

You will neeed to edit the file with a text editor, such as the TextEdit app found in the Applications directory, or GNU nano or vi. And you will need to run the editor with root, i.e., administrator privileges by using the sudo command in order to be able to save modifications to the file. E.g.:

sudo nano /etc/apache2/httpd.conf

[ More Info ]

[/os/os-x/apache] permanent link

Sat, Feb 04, 2017 10:44 pm

PHP for Apache on OS X El Capitan

If you are running an Apache web server under OS X El Capitan and want to use PHP with Apache, you will need to take some additional steps after you've got Apache running on OS X/macOS. Once you've got Apache working on the system, you can create a .php file, e.g. phptest.php and have the page displayed by your browser if you visit the page, but PHP code within the page won't be executed. E.g., suppose the phptest.php page contains the following code:

<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PHP Test</title>
</head>

<body>

<h2>A test page</h2>

<?php phpinfo(); ?>

</body>
</html>

If I visit the page using a browser, the HyperText Markup Language (HTML) code on the page will be displayed, e.g. the "A test page" heading will be displayed, but the information that the phpinfo() command would display regarding the PHP settings for a system on which PHP is working won't be displayed. You could also try a simple PHP echo command, e.g. <?php echo "This is the output from a PHP echo command."; ?>, but the output from that command would not be displayed, either.

[ More Info ]

[/os/os-x/apache] permanent link

Fri, Feb 03, 2017 10:54 pm

Running an Apache web server under OS X El Capitan

Apple's OS X/macOS operating system (OS) comes with the Apache webserver software, which I decided to enable on my MacBook Pro laptop running OS X El Capitan, version 10.11.6 on the laptop.

The Apache web server software isn't running by default and you can no longer enable it through the Sharing option under System Preferences as in some earlier versions of OS X, but you can start it from a command line interface (CLI) by opening a Terminal window (Terminal is found in the Applications/Utilities folder), with the command sudo apachectl start. Once you start the software, you will see the system is listening on the well-known port for Hypertext Transfer Protocol (HTTP) connections, port 80, by using the netstat command.

$ sudo apachectl start
Password:
$ netstat -a | grep http | grep LISTEN
tcp46      0      0  *.http                 *.*                    LISTEN     
$

[ More Info ]

[/os/os-x] permanent link

Thu, Feb 02, 2017 10:04 pm

UltraVNC not responding to connection attempts

A user reported he was unable to connect to a Microsoft Windows 8 system functioning as a VNC server using UltraVNC. The remote vncviewer program was reporting "Failed to connect to server !" I logged into the system and verified that the system was listening on the registered port for VNC, port 5900 using the netstat command.
C:\Users\Collen>netstat -a | find "5900"
  TCP    0.0.0.0:5900           Speleologist:0         LISTENING

C:\Users\Collen>

I used windump, a free packet capture tool for Microsoft Windows systems, similar to the tcpdump tool found on OS X/macOS and Linux systems, to verify that the system was seeing the incoming connections to network port 5900.

[ More Info ]

[/os/windows/software/remote-control/vnc/ultravnc] permanent link

Wed, Feb 01, 2017 10:42 pm

Allowing the untrusted interface on a Juniper SRX router/firewall to be pinged

If you wish to allow the untrust interface, which is usually the Internet-facing interface on a Juniper Networks SRX router/firewall running the Junos operating system, to be pinged from external systems, you can use the command set security zone security-zone untrust interface ge-0/0/0.0 host-inbound-traffic system-services ping after placing the device in configuration mode with the configure command, presuming, of course, that the untrust interface is ge-0/0/0.0. If it is some other port on the router, substitute that port identifier, instead.

root@Alder> configure
Entering configuration mode

[edit]
root@Alder# set security zone security-zone untrust interface ge-0/0/0.0 host-inbound-traffic system-services ping

[edit]
root@Alder# commit
commit complete

[edit]
root@Alder#

Afer committing the configuration, you should be able to successfully ping the IP address of the untrusted, i.e., Internet side of the device.

[/security/firewalls/SRX] permanent link

Tue, Jan 31, 2017 11:10 pm

Creating a rescue configuration for a Juniper SRX Firewall

You can create a rescue configuration to be used in the event you make some change to a Juniper Networks SRX router/firewall, which runs Junos OS, that makes the device inaccessible. With a rescue configuration saved on the device, you can return the router/firewall to a known operational state. The rescue configuration saved on the device can provide a last resort means of quickly restoring the device to operational status. You can use either the web-based graphical user interface (GUI) method to create a saved rescue configuration via a web browser connection to the system or a command line interface (CLI) method.

[ More Info ]

[/security/firewalls/SRX] permanent link

Mon, Jan 30, 2017 10:49 pm

Checking a website's security certificate with OpenSSL

You can use OpenSSL, which is commonly installed on Mac OS X and Linux systems and which is also available for other operating systems (the source code can be downloaded from OpenSSL Downloads and a Windows implementation is available at OpenSSL for Windows), to check the security certificate of a website using an openssl command in the form openssl s_client -showcerts -connect fqdn:port where fqdn is the fully qualified domain name (FQDN) of the website and port is the port that the website is listening on for HTTPS connections, which is usually well-known port 443, though it may sometimes be another port, such as the registered port 8443. The showcerts option instructs openssl to show all certificates in the public key certificate chain.

[ More Info ]

[/security/encryption/openssl] permanent link

Sun, Jan 29, 2017 7:52 pm

Setting up the Windows Subsystem for Linux on Windows 10

With the Anniversary Edition of the Microsoft Windows 10 operating system (OS), Microsoft provides a an Ubuntu-based Bash shell that will allow you to run Linux software on your Microsoft Windows 10 system. If you are unsure whether the Anniversary Edition update to Windows 10 is installed on a system, you can follow the steps listed at Determining which version of Windows 10 is installed. You can also use the instructions at Determining the version of Microsoft Windows from the command line. The Anniversary Edition is version 1607 of Windows. Or just checking the software build will reveal whether the Anniversary Edition is installed; if you see "build 14393" or later, then the Anniversary Edition is installed on the system.

The Windows system will also need to be using the 64-bit version of Windows 10 rather than the 32-bit version - see Determining if your version of Windows is a 32-bit or 64-bit version for methods that can be used to determine if the installed version of Windows is a 32-bit or 64-bit version.

If the version of Windows is appropriate, then you can follow these step by step instructions to install the Linux subsystem.

[/os/windows/win10] permanent link

Sat, Jan 28, 2017 9:46 pm

Setting the default mail application on Windows 10

If you wish to set or change the default mail app on a Microsoft Windows 10 system, you can take the following steps:
  1. Click on the Windows Start button.
  2. Click on Settings.
  3. Click on System.
  4. Click on Default apps.
  5. Click on "Choose a default" under Email.
  6. You should then see a list of email applications on the system; click on the one you wish to be the default mail application.
  7. Once you've chosen an email program, you can click on the "X" at the upper, right-hand corner of the window to close it.

[ More Info ]

[/os/windows/win10] permanent link

Fri, Jan 27, 2017 10:29 pm

Changing the UltraVNC passwords

To change the password used for connectivity to a system running the UltraVNC free and open-source software that provides remote-administration/remote-desktop-software functionality for Microsoft Windows, select the icon representing UltraVNC in the system tray; it has an eye within it.

UltraVNC system tray icon

Right-click on it and select Admin Properties. At the Admin Properties window, you can type a password in the "View-Ony Password" that can be used to allow remote users access to the system via VNC. It will only check the first 8 characters of a password.After making any password change, click on the Apply button.

[ More Info ]

[/os/windows/software/remote-control/vnc/ultravnc] permanent link

Thu, Jan 26, 2017 10:56 pm

You can't open the application "Firefox.app" because it is not responding

I killed Firefox on my MacBook Pro laptop running OS X Yosemite (10.10.5) by clicking on the Apple icon at the upper, left-hand corner of the screen then selecting Force Quit and then selecting Firefox and clicking on the Force Click button. But when I tried to reopen Firefox, I saw the message 'You can't open the application "Firefox.app" because it is not responding.'

I clicked on OK and used Force Quit Applications again. I saw Firefox in the list and again forced it to quit. I then clicked on the Firefox icon in the Dock at the bottom of the screen again, but Firefox didn't appear to open. I double-clicked on it again, but it still didn't appear to open, though it appeared in the Force Quit Applications list again with "not responding" appearing next to its entry in the list of open apps. I tried clicking on the Firefox icon in the Dock a third time and this time saw the 'You can't open the application "Firefox.app" because it is not responding' message again, though reopening Force Quit Applications again did not show "not responding" next to the Firefox entry in its list. Nor was any other application listed as being unresponsive. I tried the Force Quit step again. Firefox remained in the list until I closed and reopened Force Quit Applications. Though Firefox wasn't in the Force Quit Applications list, I did see a process associated with Firefox when I used the ps command to view processes running on the system.

$ ps -ef | grep -i Firefox | grep -v grep
723184451  6861     1   0  8:46AM ??         0:00.03 /Applications/Firefox.app/Conte
nts/MacOS/plugin-container.app/Contents/MacOS/plugin-container /Library/Internet Plu
g-Ins/JavaAppletPlugin.plugin -greomni /Applications/Firefox.app/Contents/Resources/
omni.ja -appomni /Applications/Firefox.app/Contents/Resources/browser/omni.ja -appdi
r /Applications/Firefox.app/Contents/Resources/browser 1635 gecko-crash-server-pipe.
1635 org.mozilla.machname.776527788 plugin
$

[ More Info ]

[/os/os-x] permanent link

Wed, Jan 25, 2017 11:08 pm

Extracting information from a pem file

The X.509 standard is used to manage digital certificates used for public key encryption. One of the filename extensions used for X.509 certificates is .pem, which stands for "Privacy Enhanced Mail". These certificates are Base64 encoded DER certificates. If you have a .pem certificate and want to view information about the contents of the certificate, you can do so with OpenSSL software, which is commonly found on Linux and Mac OS X systems, but is available for other operating systems as well. If you just want to view the expiration date for a certificate you can use an openssl command like the one below:

$ openssl x509 -enddate -noout -in cacert.pem
notAfter=Aug 13 23:59:00 2018 GMT
$

[ More Info ]

[/security/encryption/openssl] permanent link

Tue, Jan 24, 2017 9:28 pm

Viewing available upgrades in Radia Client Automation Application Self-Service Manager

If the Radia Client Automation Self-Service Manager is in use on a Mac OS X system, the app may be found in the Applications/HPCA/Agent folder on the system's disk drive. You can double-click on Application Self Service Manager.app to see what software updates are available for the system. If the system isn't connected to the corporate network, e.g., if you need to establish a virtual private network (VPN) connection to be able to connect to the server, and you see the message "Error code 769 encountered during the connect. Do you want to work offline?", you can click on Yes to still see available updates stored on the system which you can install.

[ More Info ]

[/software/hpca] permanent link

Mon, Jan 23, 2017 10:07 pm

Firefox Profile Location on an Apple OS X System

The Firefox web browser stores information about its user settings and state in a "profile" directory for each user. On a Mac OS X system (now macOS), such as my MacBook Pro laptop, you can have Firefox open a Finder window showing you the relevant profile folder or you can find it from a command line interface (CLI), i.e., a shell prompt, by opening a Terminal window (you can find the Terminal program in the Applications/Utilities folder). For the latter method, you can see the location of the profile directory by issing the command ls -l ~/Library/Application\ Support/Firefox/Profiles. (you need to put a backslash before the space in the directory path)

$ ls -l ~/Library/Application\ Support/Firefox/Profiles
total 0
drwx------  53 jasmith1  ABC\Domain Users  1802 Jan 23 11:56 bgq13udo.default
$

[ More Info ]

[/network/web/browser/firefox] permanent link

Sun, Jan 22, 2017 9:32 pm

Minecraft memory usage

You can control the amount of memory used by Java for the Minecraft sandbox video game by setting parameters in the server_start.bat file located in the directory where the Minecraft software was installed. To reduce the contention of the Minecraft server with other software running on the system for the system's memory, you can specify the maximum memory it will consume with a Xmx parameter. E.g., the following example uses a server_start.bat file where the maximum of memory that Java will use for running the game software is 1 gigabyte (GB)

java -Xmx1G -Xms1G -jar forgeserver.jar nogui
PAUSE

[ More Info ]

[/os/windows/software/games/minecraft] permanent link

Sat, Jan 21, 2017 11:33 pm

Error occurred message when upgrading freeSSHd

I needed to upgrade freeSSHd, which is free Secure Shell (SSH) server software for Microsoft Windows systems, on a Windows 8 system. The software allows remote users to log into a command line interface on the Windows system via SSH and provides the capability to transfer files via the SSH File Transfer Protocol (SFTP). When I attempted to install the latest version of the software over a prior version, however, the installation was unsuccessful. If you see the following error message, you may need to stop the SSHD service prior to performing the upgrade:

An error occurred while trying to replace the existing file:
DeleteFile failed; code 5.
Access is denied.

Click Retry to try again, Ignore to skip this file (not recommended), or Abort to cancel installation.

[ More Info ]

[/os/windows/network/ssh/freeSSHd] permanent link

Fri, Jan 20, 2017 10:02 pm

Installing an encryption plugin for UltraVNC

An encryption plugin is available for the UltraVNC open source remote administration/remote desktop software. The SecureVNC Plugin has the following specifications:

[ More Info ]

[/os/windows/software/remote-control/vnc/ultravnc] permanent link

Thu, Jan 19, 2017 11:06 pm

Setting up a Juniper Networks SRX100 Router/Firewall

You can configure a Juniper Networks router/firewall, such as a Dell J-SRX100H, which is manufacturered by Juniper Networks by connecting a network cable between one of the 0/1 through 0/7 ports on the SRX100; don't use the 0/0 port, because that is the default port for the "untrusted" side of the device, i.e., for connections on the "outside" or Internet-facing side of the device. If you have the connected device set to obtain an IP address by the Dynamic Host Configuration Protocol (DHCP), it will be assigned an address from the 192.168.1.1/24 subnet, 192.168.1.2. You can then log into the router by opening a browser window and pointing the browser to http://192.168.1.1.

[ More Info ]

[/security/firewalls/SRX100] permanent link

Wed, Jan 18, 2017 10:46 pm

Allowing inbound connectivity for an application under Windows 8

To permit inbound access to an application through the Microsoft Windows Firewall on a Windows 8 system, you can take the following steps:
  1. Move the mouse pointer to the lower, left-hand corner of the window until you see the Windows Start button appear. When you see it, right-click on it and select Control Panel.
  2. From the Control Panel, select System and Security.
  3. Click on Windows Firewall.
  4. Click on Allow an app or feature through Windows Firewall.
  5. Click on the Change settings button. Once you do so, the "Allow another app" button will no longer be grayed out and you can click on it.
  6. Find the application for which you wish to allow access through the firewall and click on it to highlight and select it.
  7. Click on the Add button. You should then see the program added to the list of apps allowed to communicate through Windows Firewall. By default access is allowed on "private" networks, such as your home or work network. If you also want to allow access on "public" networks, such as you would find at a coffe shop or airport, you can also click the check box for "public".
  8. Click on the OK button. You can then close the Windows Firewall window. You should be able to connect to whatever port or ports the application opens now from another system on the same local area network (LAN).

[ More Info ]

[/os/windows/win8] permanent link

Tue, Jan 17, 2017 10:30 pm

prisoner.iana.org

While using Wireshark to troubleshoot a Domain Name System (DNS) issue for a server that sits behind a firewall that performs Network Address Translation (NAT), I noticed a DNS response coming back where Wireshark showed the following in the "Info" field for a packet:

Standard query response 0x21e1 No such name PTR 5.1.168.192.in-addr.arpa SOA prisoner.iana.org

The server for which I was performing the troubleshooting has an IP address of 192.168.1.5, which is a private IP address. There are 3 private IP address ranges; these ranges are also sometimes referred to as "RFC 1918 addresses", since the private IP address space is defined in RFC 1918 . A Request for Comments (RFC) is a document published by the Internet Engineering Task Force (IETF). Some RFCs, such as RFC 1918 become Internet Standards.

[ More Info ]

[/network/dns] permanent link

Mon, Jan 16, 2017 10:35 pm

Selecting records containing a string in a MySQL or MariaDB database

If you wish to select only the records containing a particular string, e.g., some word, etc., from a MySQL or MariaDB database table then you can use LIKE in the SQL SELECT command. E.g., if I have a table named Books that contains book information and one of the columns in the database is Title, I can select any books from the database where the title contains "Unix" with the command below:

SELECT * FROM Books WHERE Title LIKE "%Unix%";

The percent sign (%) serves as a wildcard character indicating that any number of other charcters will match it. So by putting the percent sign before and after the word Unix, the expression will find any books with titles that have "Unix" anywhere in the title, e.g., at the beginning, middle, or end of the title. If I only wanted to find those records in the Books table where the title began with the word Unix, I could use the command below:

SELECT * FROM Books WHERE Title LIKE "Unix%";

Any characters that came after the word Unix would match, but the title would need to start with "Unix". To find only those books where the word appears at the end of the title, I could use the following command:

SELECT * FROM Books WHERE Title LIKE "%Unix";

If I wanted, instead, to find all of the records where the title doesn't contain the word "Unix", I could put NOT before LIKE.

SELECT * FROM Books WHERE Title NOT LIKE "%Unix%";

[/software/database/mysql] permanent link

Sun, Jan 15, 2017 10:30 pm

Turning on network discovery and file sharing on a Windows 8 system

If you wish to see folders from other Microsoft Windows systems on a local area network (LAN) or those shared from Linux systems via Samba, you may need to turn on network discovery on the Windows system(s) in order to see the shared folder. E.g., if you double-click on Network in the Windows File Explorer and see "Network discovery and file sharing are turned off. Network computers and devices are not visible. Click to change...", click on the message to enable network discovery.

[ More Info ]

[/os/windows/win8] permanent link

Sat, Jan 14, 2017 11:07 pm

Determining or changing the system name for a computer running Windows 8

To determine the system name for a computer running the Microsoft Windows 8 operating system, you can right-click on the Windows Start Button at the lower, left-hand corner of the screen. If you don't see it, hit the Esc key and move the mouse pointer to the lower, left-hand corner of the screen where it should appear. You will see the system's name listed in the "Computer name, domain, and workgroup settings" section. If you want to give the system a new name, click on Change settings and then click on the Change button.

If you want to obtain the information through a command-line interface (CLI) method, instead, you can do so either at a command prompt or PowerShell prompt.

[ More Info ]

[/os/windows/win8] permanent link

Fri, Jan 13, 2017 10:27 pm

Deleting up to a word or back to a word in the Vi or Vim editor

In the vi or Vim text editor, you can delete all characters on a line up to a specified word by placing the cursor on the line at the point where you wish to start the deletion then hit the d key followed by the slash key followed by the word up to which you wish to remove the characters on the line. E.g., suppose you have the following line:

If you can force your heart and nerve and sinew To serve your turn long after they are gone, And so hold on when there is nothing in you Except the Will which says to them: “Hold on”;

From the poem If— by Rudyard Kipling (1865-1936)

If you wished to delete all of the text on the line from the word "To" up until, but not including the word "And" in "And so hold on...", while in command mode, not insert mode, you could move the cursor to the "T" in "To" and then hit the d key followed by the forward slash key (/) and then type And (make sure you use the matching capitalization). The line would then appear as shown below.

If you can force your heart and nerve and sinew And so hold on when there is nothing in you Except the Will which says to them: “Hold on”;

Suppose, instead, you had the cursor at the word "To" as before, but wanted to delete backwards through the word "If", i.e., all the way to the beginning of the line, instead. You could then hit the d key while in command mode, then hit the question mark (?) key and type If. You would then have the text below.

To serve your turn long after they are gone, And so hold on when there is nothing in you Except the Will which says to them: “Hold on”;

For the backwards deletion, the word you type after the question mark is included in the deletion. In this case, if you wished to delete backwards to the beginning of the line, you could also have hit the d key followed by the ? key and then hit the caret (^) key, which represents the beginning of the line. Likewise, you could hit the dollar sign ($) key to delete forward to the end of the line, which it represents, or you could just hit the D key, instead of the lower-case "d" to delete from the current cursor position to the end of the line.

[/software/editors/vi] permanent link

Thu, Jan 12, 2017 10:13 pm

Whitelisting email from a sender or domain using GoDaddy's email service

If you are using Godaddy's email service and email sent from a particular sender isn't showing up in your inbox, check the bulk mail folder, since there is a possibility that the mail was treated as junk email and placed there. To keep email from a particular sender from being subjected to checks that may result in email from that sender going into the bulk mail folder or never appearing in any folder in your account, you can add the sender's email address to a list of whitelisted email addresses, i.e., ones that won't undergo the normal checks to ascertain if the email is email spam, which can sometimes result in false positives, i.e., a legitimate email you would want to receive is mistakenly classified as spam by a software algorithm that checks all incoming email. To whitelist an email address or an entire domain, e.g., all email from any email address at example.com, take the following steps while logged into your GoDaddy email account through the web interface to your email account.

[ More Info ]

[/network/email/godaddy] permanent link

Wed, Jan 11, 2017 10:36 pm

tar extraction errors - Cannot utime: Operation not permitted

I needed to copy the contents of one directory belonging to a user from one Linux system to another. While logged into her account on the source system, I created a tar file, aka a "tarball", of the directory with the command tar -cvf game.tar game to copy the contents of her "game" directory and all of its subdirectories to the tar file. The tar file was about 20 MB in size, so I compressed it with the gzip command gzip game.tar resulting in a game.tar.gz file about 5 MB in size, which I transferred to the destination system. While logged into her account on the destination system, I uncompressed the .gz file with gunzip game.tar.gz and then attempted to extract the contents of the tar file into the same directory on the destination system as on the source system. The directory already existed on the destination server because I had many months ago copied everything in her home directory from the source to the destination system. When I ran the command tar -xvf game.tar to extract the contents of the tar file, I saw files extracted, but I also saw several "Cannot open: File exists" lines in the output from the command, which terminated prematurely with the following lines:

game/Update
tar: game/Update: Cannot open: File exists
game/FAQ
tar: game/FAQ: Cannot open: File exists
game/CONVERT.22
tar: game/CONVERT.22: Cannot open: File exists
game/BETA
tar: game/BETA: Cannot open: File exists
tar: game: Cannot utime: Operation not permitted
tar: Exiting with failure status due to previous errors

[ More Info ]

[/os/unix/commands] permanent link

Tue, Jan 10, 2017 10:47 pm

Determining which version of Windows 10 is installed

There have been various iterations of Microsoft Windows 10 since it was first released. Though you might think of Windows 10 as one version compared to Windows XP, Vista, 7, 8, etc., but there are versions of Windows 10 itself and "builds" within those versions. You can determine which version of Microsoft Windows 10 is installed on a system running Windows 10 by typing winver in the Cortana "Ask me anything" field. You will then see a window, such as the one below, displaying the version and build number of the operating system. In the example shown below from a Dell laptop, the system is running Version 1511 build 10586.713 of the Windows 10 operating system (OS), which is the "November Update" to the OS.

Windows 10 version and build information

[ More Info ]

[/os/windows/win10] permanent link

Mon, Jan 09, 2017 10:32 pm

Thunderbird and Proxy Server Settings

When attempting to check email after installing Mozilla Thunderbird on a Windows 10 system and configuring an email account in Thunderbird, instead of email being downloaded, Thunderbird would show "Connecting to pop3.example.com" and seemed to be indefinitely stuck at that point. When I opened Wireshark to observe the network traffic between the Windows 10 laptop and the email server, I didn't see any traffic whether Thunderbird was configured to use the Post Office Protocol version 3 (POP3) port 110 or the secure version of the protocol POP3S on port 995. I set the Wireshark filter to be tcp.port eq 110 || tcp.port eq 995. I didn't see any traffic between to/from the server when I changed the filter to look for traffic to/from the IP address of the server with ip.addr == xxx.xxx.xxx.xxx where xxx.xxx.xxx.xxx was the IP address of the server. After puzzling over the matter for awhile, it finally dawned on me that I had prevoiusly configured the Microsoft Edge browser to use a SOCKS proxy server via a Secure Shell (SSH) tunnel set up with PuTTY. I had disconnected the PuTTY connection to the SSH server, but hadn't changed the proxy server settings for the system so I realized the was likely the cause of the problem, though I hadn't expected Thunderbird to use the system proxy server setting by default.

[More Info]

[/network/email/clients/thunderbird] permanent link

Sun, Jan 08, 2017 10:50 pm

Altering the contents of a file using sed

On Unix, Linux, and OS X systems, the sed (stream editor) utility can be used to modify the contents of a file replacing one string, i.e., sequence of characters, with another. E.g., suppose the file named myfile contains the following lines:

pink blue
red Blue
orange
blue purple blue
blue

If I want to replace all occurrences of the word "blue" with "green", I could issue the following sed command at a Bash shell prompt.

$ sed -i -e 's/blue/green/g' myfile

[ More Info ]

[/os/unix/commands] permanent link

Sat, Jan 07, 2017 11:12 pm

Day of the week for dates in Excel and Calc

If you wish to display the day of the week, i.e, Monday, Tuesday, Wednesday, etc., that corresponds to a particular date in Microsoft Excel you can simply format the display of the date using a custom format of ddd. E.g., in Microsoft Excel 2013, if I have dates in column A displayed in mm/dd/yyyy format, but I also want the day of the week corresponding to those days to appear in column B as shown below.

Excel 2013 dates with days of the week

[ More Info ]

[/os/windows/office/excel] permanent link

Fri, Jan 06, 2017 8:44 pm

Wireshark showing RST packets when unable to access website

I was unable to access a website on a webserver I frequently access. When I examined the network traffic to and from the server with Wireshark network analyzer software, I could see a repeating sequence of SYN packets from the IP address of the Windows laptop from which I was attempting to access the web server followed immediately by RST, ACK packets from the IP address of the server. That sequence repeated over and over again. E.g.:

130	2.766497	TCP	74	44970?80 [SYN] Seq=0 Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=1029178963 TSecr=0 WS=16
131	2.768022	TCP	60	80?44970 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
132	2.800200	TCP	74	27779?80 [SYN] Seq=0 Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=1029178972 TSecr=0 WS=16
133	2.801724	TCP	60	80?27779 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0

[More Info ]

[/network/web/server] permanent link

Thu, Jan 05, 2017 4:02 pm

Email stuck in the sendmail queue

A user repoted that she didn't receive an email someone sent her today. I checked the /var/log/maillog file to see if the mail server, which is running Sendmail, received the email. When I searched on part of the sender's email address, I saw the message had been received by the mail server:

# grep sbear /var/log/maillog
Jan  5 14:08:08 moonpoint sendmail[6276]: v05IxmvR006276: from=<sbearab1@y0hoo.c
om>, size=2339942, class=0, nrcpts=1, msgid=<1226622358.574156.1483642780691@mai
l.y0hoo.com>, proto=ESMTP, daemon=MTA, relay=omp1011.mail.ne1.y0hoo.com [98.138.
87.11]

So I checked Sendmail's queue with the mailq command and saw the message was stuck there. Note: Mailq is identical to sendmail -bp .

# mailq
                        /var/spool/mqueue (1 request)
-----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
v05IxmvR006276  2338155 Thu Jan  5 14:08 <sbearab1@y0hoo.com>
                 (host map: lookup (yahoo.com): deferred)
                                         <abad_kitty@moonpoint.com>
                Total requests: 1
#

The sendmail queue can be flushed with the command sendmail -q -v .

#  sendmail -q -v

Running /var/spool/mqueue/v05IxmvR006276 (sequence 1 of 1)
<abad_kitty@moonpoint.com>... aliased to ann
ann... Connecting to local...
ann... Sent
# mailq
/var/spool/mqueue is empty
                Total requests: 0
#

The meaning of the -q and -v options to the sendmail command are shown below:

  -q[time]
              Process saved messages in the queue at given intervals.  If time
              is  omitted,  process the queue once.  Time is given as a tagged
              number, with `s' being seconds, `m' being minutes (default), `h'
              being  hours, `d' being days, and `w' being weeks.  For example,
              `-q1h30m' or `-q90m' would both set  the  timeout  to  one  hour
              thirty  minutes.   By  default,  sendmail  will run in the back-
              ground.  This option can be used safely with -bd.

      -v     Go into verbose mode.  Alias expansions will be announced, etc.

[/network/email/sendmail] permanent link

Wed, Jan 04, 2017 10:32 pm

SSH brute-force break-in attempts from 49.116.40.31

While troubleshooting a problem with a Linux system this evening, I opened Wireshark and noticed a Secure Shell (SSH) packet from an unexpected source address, 49.116.40.31. When I checked the fail2ban log on the system, I noticed that the IP address had been banned temporarily several times today, but break-in attempts resumed whenever the timeout period for the ban expired.

# grep '49.116.40.31' /var/log/fail2ban.log | grep 'Ban\|Unban'
2017-01-04 17:20:46,190 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 17:30:47,135 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 17:31:15,276 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 17:41:16,250 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 17:41:43,390 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 17:51:44,299 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 17:52:14,441 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 18:02:15,243 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 18:02:43,383 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 18:12:44,182 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 18:13:13,323 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 18:23:14,227 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 18:24:23,414 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 18:34:24,183 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 18:35:33,368 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 18:45:34,148 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 18:46:44,331 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 18:56:45,126 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 18:57:14,282 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 19:07:15,124 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 19:07:44,270 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 19:17:45,043 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 19:18:14,190 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 19:28:15,111 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 19:29:23,297 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 19:39:23,304 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 19:39:51,441 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 19:49:52,326 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 19:50:21,472 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 20:00:22,251 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 20:00:49,390 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 20:10:50,192 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 20:11:19,338 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 20:21:20,121 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 20:21:49,263 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 20:31:50,036 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 20:33:38,258 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 20:43:39,059 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
2017-01-04 20:44:37,358 fail2ban.actions        [25142]: NOTICE  [sshd] Ban 49.116.40.31
2017-01-04 20:54:37,372 fail2ban.actions        [25142]: NOTICE  [sshd] UnBan 49.116.40.31
#

[ More Info ]

[/security/attacks/ssh] permanent link

Tue, Jan 03, 2017 10:23 pm

Executing a JavaScript function when a browser window is resized

Sometimes you may want to have a certain event take place if a visitor to your website resizes his or her browser window. With HTML 5, you can use the onresize Event Attribute. You can apply the event attribute to the body tag, e.g.:

<body onresize="someFunction()">

The event that would occur when the browser window is resized will depend upon the code you place in the JavaScript function referenced, which in this case I've named someFunction.

Note: the onresize attribute is new to HTML5 and isn't supported in HTML 4.01 and older versions oF HTML. You can expect current versions of browsers to support it, but if a visitor has an outdated browser version, the function may not work for the visistor.

[ More Info ]

[/network/web/html] permanent link

Mon, Jan 02, 2017 10:42 pm

Determining the program that is connecting to specific IP addresses

While troubleshooting a network issue using the free and open source (FOSS) network analyzer Wireshark, I noticed connections to IP addresses that I thought might be associated with adware sites. The connections were occurring from a Microsoft Windows 10 system. I suspected that the connections were occuring via a browser tab that was open to a website within the K-Meleon web browser, but I wanted to confirm that was the case and then, if it was, to attempt to identify the particular tab open in the browser and the web page that was responsible for the traffic, since there were several tabs open in the browser. There were also other browsers open on the system with multiple windows and tabs, so I might also need to check the tabs open in those browsers.

To see all of the connections to websites on the HTTP port, which is the well-known port 80, I can open a command prompt window and use the netstat command netstat -an and then pipe its output into the find command, looking for ":80". The -a option shows all connections and the -n option converts IP addresses and application layer protocols, such as HTTP, to numeric form.

[ More Info ]

[/os/windows] permanent link

Sun, Jan 01, 2017 8:45 pm

Determining if a directory exists in a Bash script

I have a Bash script that copies the prior day's mail log file from /var/log/maillog.1 to another directory for archiving. The archive directory contains a subdirectory for each year's mail logs. Today is the first day of a new year, so I needed to create a 2017 directory. I could manually create the directory, but I thought I'd modify the Bash script that runs from Cron to check on whether the current year's directory exists and, if it doesn't create it, so, if I forget in future years to create a new year's directory the script will create it for me.

You can check if a directory exists with code similar to what is shown below:

if [ -d "$DIRECTORY" ]; then
  # Insert code to be executed
fi

Or, to check if a directory doesn't exist and execute commands if it doesn't:

if [ ! -d "$DIRECTORY" ]; then
  # Insert code to be executed
fi

Note: putting the $DIRECTORY variable in double quotes allows for cases where the directory name may contain a space. Though that won't be the case for my yearly subdirectories, it is something you can allow for by enclosing the variable name in double quotes.

[ More Info ]

[/os/unix/bash] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo