Verify Ubuntu iso on Windows

On Windows you can use the CertUtil utility to verify an iso image.

First, you’ll need the checksum of the iso. Should be on the page where you downloaded the iso. More info about that here.

Next generate the hash by running the following in a command prompt. Replace the path and ISO name with the one you downloaded

certutil -hashfile Downloads\ubuntu-19.04-live-server-amd64.iso sha256

Example output

SHA256 hash of Downloads\ubuntu-19.04-live-server-amd64.iso:
25d483341ccd0d522a6660b00db933787c86c47b42f1845bcf997127f4b61e9d
CertUtil: -hashfile command completed successfully.

Compare the output with the checksum. If they are the same, you should be good to go.

Raspberry Pi – Ping IP Address and Toggle LED

The following script is for monitoring if an IP address is reachable or not. If it becomes unavailable the script will turn on a LED that is plugged into one of the GPIO pins of the Raspberry Pi. View pinout here

Script

#!/bin/bash
# Script to ping ip address and turn on LED on if device is unreachable.
                                                                                                                                                                                                 nPin="18"  # Change if GPIO pin is different                                                                                                     
ledPin="gpio${nPin}"                                                                                                                                                                                                                            toPing="8.8.8.8"  # Change to address you want to ping

echo "${nPin}" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/${ledPin}/direction

if ( fping -r1 $toPing | grep -v alive ); then
         echo "Internet unreachable"
         # Turn on LED
         echo "1" > /sys/class/gpio/${ledPin}/value
 else
         # Turn off LED 
         echo "0" > /sys/class/gpio/${ledPin}/value
 fi

Save script as ping_led.sh and make it executable.

chmod +x ping_led.sh

and run the script.

sh ping_led.sh

Run script in crontab

You can setup the script to run every minute using a crontab

crontab -e

Add the following line

*/1 * * * * /home/pi/ping_led.sh

Should now execute the script every minute and not need any human interaction.

Delete files older than x days – Linux


You can use find command to find and delete files older than the specified days. In this case 30.

find /backup/* -mtime +30 -exec rm {} \;

Non recursive example. The -prune option should limit find to only look for files in the /backup directory. So it won’t check any subdirectories.

find /backup/* -prune -mtime +30 -exec rm {} \; 

CHIPSEC notes

The following is some quick notes on using CHIPSEC to compare the EFI whitelist on your current machine with the BIOS Dell provides

Quick notes.

  1. Install prerequisites (Uses python 2)
  2. Git clone Chipsec
  3. Install (Had to use a -i option, is in the manual)
  4. Run (Use spaces like below)

Extract Bios ROM from Dell EXE
Use the BIOS exe to output a .rom file that you can use in Linux. Run the following command from Windows command prompt, accept the security request. Change the EXE to the BIOS you downloaded.

Alienware_17_R2_1.5.0.EXE /writeromfile

The BIOS rom is named dell.rom in the following commands

Get list of Computer ROM

Should create fw.bin file and efilist.json file from local machine

sudo python chipsec_main.py -m tools.uefi.whitelist

Get list from Dell rom

sudo python chipsec_main.py -m tools.uefi.whitelist -a generate efilist.json dell.rom

Compare the current ROM against the one downloaded from Dell

sudo python chipsec_main.py -m tools.uefi.whitelist -a check efilist.json fw.bin

For some reason Ubuntu was not recognizing the last three options after the -a as individual options unless there was a space in between them.  All the examples online show that they had commas between them.  Which should work, so wonder if it was an environment variable problem or something.

The tell tell sign was the [*] Module arguments Line only shows 1 argument, needs 3.

Other links

Install instructions here.
https://github.com/chipsec/chipsec/wiki/Installing-CHIPSEC-in-Linux

LUV Linux download
https://01.org/linux-uefi-validation

Manual
https://github.com/chipsec/chipsec/blob/master/chipsec-manual.pdf

Setting up Proxy over SSH on Linux

Initiate a ssh connection to the server or device you want to use as a proxy. You can change the port to something else if so desired.

ssh username@ipaddress -D 1880

Log in and leave the session running

You can now setup your computer or browser to use the Proxy.
Specify SOCKS Host, hostname is either localhost or 127.0.0.1, the port is 1880.

Firefox example below.

Find IP address from command line on Linux

Using ip command

ip add

example output

bob@localhost:~$ ip add
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eno1: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 38:ea:a7:13:a4:fe brd ff:ff:ff:ff:ff:ff
inet 192.168.1.21/24 brd 192.168.1.1 scope global dynamic noprefixroute eno1
valid_lft 513sec preferred_lft 513sec
inet6 13ac::98fe::ae78:d1ff/64 scope link noprefixroute
valid_lft forever preferred_lft forever
bob@localhost:~$

ifconfig

You may need to install net-tools to use

ifconfig  

example output

bob@localhost:~$ ifconfig 
eno1: flags=4163 mtu 1500
inet 192.168.200.58 netmask 255.255.255.0 broadcast 192.168.1.21
inet6 13ac::98fe::ae78:d1ff prefixlen 64 scopeid 0x20
ether b8:ac:6f:91:01:e8 txqueuelen 1000 (Ethernet)
RX packets 184950632 bytes 9487577263452
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 128473456 bytes 234612443785
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Using the hostname command

hostname -I

Output is just the IP address. Example below

192.168.1.21

Vim config file .vimrc

Line numbers

Turn line numbers on

:set nu

Turn line numbers off

:set nu!

Color Scheme

:colorscheme evening

Syntax Highlighting

Turn Syntax highlighting on

:syntax on

Turn Syntax highlighting off

:syntax off

Highlight all search terms

:set hlsearch

https://vim.fandom.com/wiki/Highlight_all_search_pattern_matches

You can add the following to your ~/.vimrc in Linux or ~\.vimrc in Windows so the options are used every time you run vim.

colorscheme evening 
syntax on
set hlsearch
set nu