Wednesday, October 26, 2022

DNS For Malware Blocking

The Domain Name System protocol maps a human-readable hostname to an IP number. The DNS protocol can be leveraged to filter these lookups. While an application can use a hard-coded IP number, hostname lookups can have any logic or filtering applied by the DNS resolver.

People have effectively self-hosted the Pi-hole solution at home. Typically it is configured to reduce ads which can improve website performance and reduce tracking. For those with some desire to configure a small device, pi-hole is a straightforward and lightweight method to take some control of your network.

There are also hosted DNS solutions which can provide varying levels of filtering and blocking.

Using a phone over a mobile network or public wifi, you may want to have some DNS filtering while not using the Pi-hole solution at home. For an Android phone, there is a setting to allow use of "Private DNS". Go to settings, Network & Internet, Private DNS. If you want to use the Cloudflare DNS offering of 1.1.1.1, Android will require an actual hostname instead of the 1.1.1.1 number scheme. In the settings prompt for Private DNS, enter the hostname 1dot1dot1dot1.cloudflare-dns.com and press save. Your Android phone should then use the Cloudflare DNS filtering. Using one.one.one.one as the hostname seems to have unreliable effects as it does not always properly resolve that name.

Android Private DNS setting:








Look up 1dot1dot1dot1.cloudflare-dns.com which resolves to 1.1.1.1:










Cloudflare's 1.1.1.1 is fast and convenient. For additional levels of filtering, look into using their family filtering at 1.1.1.3. For family filtering, also consider using OpenDNS.

Sunday, January 02, 2022

Tar and Curl in MS Windows 10

I wanted to scp a deep directory structure to a unix machine. In MS Windows 10, I tried to use the File Explorer to click once on the directory and right-click to use the SendTo and choose "Compressed (zipped) folder". That did not work and there was no error message. It simply failed silently.

I opened a PowerShell and found, to my surprise, that both curl and tar are now in Windows 10. To put directories and files into one larger file, the tar command may be used. By itself tar does not compress, though it put everything into one file to make it easier to take a snapshot of a directory structure.

The basics of tar on MS Windows 10 is to open a PowerShell window. Navigate to the top of the directory structure. Type:
tar -cf filename1 filename2 directory3 directory4 newTARfilename.tar

If you want to have ongoing feedback from the command, add the verbose flag:
tar -cvf filename1 filename2 directory3 directory4 newTARfilename.tar

This example uses PowerShell and shows the tar help, the directory, and the tar command.

PS C:\temp\showcompress> tar /?
Usage:
  List:    tar.exe -tf <archive-filename>
  Extract: tar.exe -xf <archive-filename>
  Create:  tar.exe -cf <archive-filename> [filenames...]
  Help:    tar.exe --help
PS C:\temp\showcompress> dir


    Directory: C:\temp\showcompress


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2021-12-29     15:59                DecemberFolder


PS C:\temp\showcompress> tar -cf DecemberFolder.tar DecemberFolder
PS C:\temp\showcompress> dir


    Directory: C:\temp\showcompress


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2021-12-29     15:59                DecemberFolder
-a----        2021-12-30     00:22    39059677696 DecemberFolder.tar






















You may also want to explore the Compress-Archive command in Powershell.


An example curl command will look like:

C:\>curl 2600.com
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://2600.com/">here</a>.</p>
</body></html>