WHM/cPanel – Change Main Server IP

Change IP Address from command line

Open up the following file, change eth0 to your primary ethernet adapter. More info here.

 vi /etc/sysconfig/network-scripts/ifcfg-eth0

and under IPADDR set it to the new IP. Update netmask and gateway if needed.

Save file and restart network

systemctl restart network

Update License

You may need to run the following to update the license on the server.

/usr/local/cpanel/cpkeyclt

Change Server IP in WebHost Manager

Change IP for server in Basic WebHost Manager Setup

Other things to do

You may need to migrate IP’s to the new address.
If you are keeping the old address on the server, then you may need to readd it through the IP Functions.

VIM delete all lines not matching pattern

In Vi you can use the following command to search for a pattern and delete all those lines

:%g/pattern-to-search-for/d

To inverse the operation and delete all lines not matching the pattern, change g to v

:%v/pattern-to-search-for/d

Export Saved Firefox logins

https://support.mozilla.org/pt-BR/questions/1253828

Enable Dev Tools

Open up a new tab, go to about:config. Search for “devtools.chrome.enabled” and set to true

Enable Firefox Devtools Browser Console

Now open up the Browser Console with “Ctrl + Shift + J” and past in the following

try {
  signons = Services.logins.getAllLogins();
  var csv = '"Site","Username","Password"';
  for (var i=0; i<signons.length; i++){
    csv += '\n';
    csv += signons[i].httpRealm ? 
      ('"' + signons[i].hostname + ' (' + signons[i].httpRealm + ')","') : 
      '"' + signons[i].hostname + '","';
    csv += signons[i].username + '","' + signons[i].password + '"';
  }
  console.log(csv);
} catch (err) {
  console.log('Problem reading or outputting logins: '+err);
}
Browser Console, Running Script

Hit enter to run the command and return all the saved logins. You can copy and paste them, or export to file.

Crack LUKS volume with Hashcat

Install hashcat

apt install hashcat

Find LUKS Volume

bob@localhost:~/$ dmesg
...
[ 1057.776074] sd 0:0:0:0: [sda] Write Protect is off
[ 1057.776074] sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
[ 1057.776593] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 1057.780234]  sda: sda1
[ 1057.783346] sd 0:0:0:0: [sda] Attached SCSI removable disk
bob@localhost:~/$

From the above we see that the drive we just pluGged into the system is “sda” so our path and partition is “/dev/sda1”

Run hashcat

The following command will run hashcat against “/dev/sda1”, change if the encrypted partition is different. Mode is to brute force every 8 numeric character combination. Refer to the following link to learn more about mask attacks.
https://hashcat.net/wiki/doku.php?id=mask_attack

Note: You should be able to dump the header and work off of that as well.

sudo hashcat -a 3 -m 14600 /dev/sda1 ?d?d?d?d?d?d?d?d

Show human readable time in dmesg

The -T option lets dmesg show user readable time.

Example:

$ dmesg -t
...
[Sat Nov 15 12:15:12 2019] CPU1: Package temperature/speed normal
[Sat Nov 15 12:14:12 2019] CPU3: Package temperature/speed normal
[Sat Nov 15 12:14:12 2019] CPU0: Package temperature/speed normal
[Sat Nov 15 12:14:12 2019] CPU4: Package temperature/speed normal
$

dmesg time options

$ dmesg -h | grep time
  -d, --show-delta            show time delta between printed messages
  -e, --reltime               show local time and time delta in readable format
  -T, --ctime                 show human-readable timestamp (may be inaccurate!)
  -t, --notime                don't show any timestamp with messages
      --time-format   show timestamp using the given format:
                                [delta|reltime|ctime|notime|iso]
Suspending/resume will make ctime and iso timestamps inaccurate.

Install KDE on Linux Mint 19.2

First add the following repo

sudo add-apt-repository ppa:kubuntu-ppa/backports

Make sure you are updated and upgraded

sudo apt-get update && sudo apt-get dist-upgrade

And if needed do a reboot

sudo reboot

Install the KDE desktop

sudo apt install kubuntu-desktop

Log out, select Plasma and log back in.

https://computingforgeeks.com/how-to-install-kde-plasma-desktop-on-linux-mint-19/

Clamp rotation of camera in Unity

Some notes and issues when trying to clamp the rotation of a camera in Unity. All the code was put on a script assigned to a controller that controlled the camera view. Used the Simple Touch Controller from the asset store.

Problem trying to clamp EulerAngles

It appears that the following code does not work as EulerAngles expects a value from 0-365.

transform.localEulerAngles = new Vector3(Mathf.Clamp(transform.localEulerAngles.x - rightController.GetTouchPosition.y * Time.deltaTime * speedContinuousLook, 0f , 20f ),transform.localEulerAngles.y + rightController.GetTouchPosition.x * Time.deltaTime * speedContinuousLook, 0f);

Extra debug info

Debug.Log("Rotation = " + transform.localEulerAngles.ToString());

Code to clamp rotation

You have to do some math to take the value from 0-365, then translate it to -90 – 90 so it can be clamped properly

// Put these with the rest of your public variables.  These should show up in the Unity Inspector and allow you to modify the values
public float speedProgressiveLook;
public float clampXRotationUp;
//  The following lines allow the script to Clamp the camera X rotation and should go in the Update function

float playerRotation = transform.localEulerAngles.x - rightController.GetTouchPosition.y * Time.deltaTime * speedContinuousLook; 

if (playerRotation > 180)        {             
    playerRotation = playerRotation - 360 ;  // Sets our working numbers between -180 - 180  
}    
     
playerRotation = Mathf.Clamp(playerRotation, clampXRotationDown, clampXRotationUp);

Vector3 newRotation;
newRotation.x = playerRotation;
newRotation.y = transform.localEulerAngles.y + rightController.GetTouchPosition.x * Time.deltaTime * speedContinuousLook;
newRotation.z = 0;

transform.localEulerAngles = newRotation;

The following links were helpful.

https://gamedev.stackexchange.com/questions/120500/using-mathf-clamp-in-vector3-to-restrict-object-drag

https://www.reddit.com/r/Unity3D/comments/8ue9fp/mathfclamp_is_refusing_to_work_can_anybody_offer/

https://stackoverflow.com/questions/26682155/using-mathf-clamp-in-unity-for-boundries

LibreNMS dump devices in MySQL database

All the devices are stored in the librenms datebase devices table.

You can dump all of them with the following command from a shell prompt.

sudo mysql -u librenms  -p librenms -e "select hostname,sysName from devices"

Example output

[jim@localhost ~]$ sudo mysql -p librenms -e "select hostname,sysName from devices"
 Enter password:
 +----------------------------------------+--------------------------------+
 | hostname                               | sysName                        |
 +----------------------------------------+--------------------------------+
 | 192.168.1.1                            | linksys                        |
 | 192.168.1.9                            | wifi-unifi                     |
 +----------------------------------------+--------------------------------+