How to: Monitor CPU/GPU/HDD temperature in Linux (Debian/Ubuntu/Kali Linux/CentOS/RHEL etc.) easily

1 glances

Monitors CPU usage, RAM usage, SWAP usage, system load, process list, hard drive I/O, Network I/O, sensors (temperature), battery, file system usage, Docker, Monitor, alarm, system information, up time etc.

Install on Debian/Ubuntu/Kali Linux

sudo apt install glances -y

Usage

sudo glances
glances
glances

2 sensor

By default, it’s installed on some Linux distros like Ubuntu etc. It can show CPU, HDD, temperature, fan RPM etc.

Install on Debian/Ubuntu/Kali Linux

sudo apt install lm-sensors

Usage

# Initialize/Detect sensors
sudo sensors-detect
 
# Show sensors information
sudo sensors

Output

coretemp-isa-0000 Adapter: ISA adapter Core 0:       +47.0°C  (high = +105.0°C, crit = +105.0°C) Core 1:       +46.0°C  (high = +105.0°C, crit = +105.0°C) acpitz-virtual-0 Adapter: Virtual device temp1:        +51.0°C  (crit = +105.0°C) thinkpad-isa-0000 Adapter: ISA adapter fan1:         674 RPM temp1:        +50.0°C temp2:        +51.0°C temp3:        +52.0°C temp4:         -1.0°C temp5:         +0.0°C temp6:         +0.0°C temp7:        +32.0°C temp8:         +0.0°C

How to: Start/Use/Initialize OpenVAS – Open Vulnerability Assessment Scanner on Kali Linux (Intro)

Before using the OpenVAS, we need to setup and update it.

1 Launch a terminal, and run setup for OpenVAS

sudo openvas-setup

Wait until it finishes downloading and updating, it will take awhile

2 When it’s done, it will show the admin login username and admin login password, note them down, we will need them every time we try to login to OpenVAS

openvas-setup done
openvas-setup done

*3 Update feed for OpenVAS (Only required if there is new updates), when initializing, this step was done once already.

sudo openvas-feed-update

If failed (You might encounter this error)

rsync: failed to connect to feed.openvas.org (xx.xx.xx.xx): Connection refused (111)
rsync: failed to connect to feed.openvas.org (xx:xx:xx:xx::xx): Connection timed out (110)
rsync error: error in socket IO (code 10) at clientserver.c(127) [Receiver=3.1.3]

Just try again with the same command, it should get through.

4 Launch OpenVAS

sudo openvas-start

It will tell us the address for webui, in this case, it is https://127.0.0.1:9392

OpenVAS webui
OpenVAS webui

(We might encounter following error)

Failed to execute default Web Browser
Failed to execute default Web Browser

It’s OK, just close it, then launch our favourite web browser then enter https://127.0.0.1:9392 as the address

Now we should have the OpenVAS login screen in front of us.

OpenVAS login screen
OpenVAS login screen

5 Enter your login detail recorded from step 2

Now you will see the Dashboard of OpenVAS.

Happy hunting/fixing 🙂


How to: Optimize MySQL, MariaDB with Simple Tools

1 mysqltuner.pl

mysqltuner.pl
mysqltuner.pl

Supports MySQL, MariaDB, Percona Server etc. with over 300

Tuning MySQL performance, checks configuration, including log file settings, storage engine, security. Outline potential issues/fix.

1.1 Download

cd /tmp
 
wget https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl
 
chmod +x mysqltuner.pl

1.2 Usage

 ./mysqltuner.pl --socket /var/lib/mysql/mysql.sock 

1.3 Output

Items with [!!] are important e.g. Maximum possible memory usage: 10G (300% of installed RAM)

Last section with “Recommendations” tells us where we can look into, which Variables we should adjust and suggested values etc.

mysqltuner.pl: https://github.com/major/MySQLTuner-perl

2 tuning-primer.sh

Similar to mysqltuner.pl.

Currently it handles recomendations for the following:

  • Slow Query Log
  • Max Connections
  • Worker Threads
  • Key Buffer [MyISAM only]
  • Query Cache
  • Sort Buffer
  • Joins
  • Temp Tables
  • Table (Open & Definition) Cache
  • Table Locking
  • Table Scans (read_buffer) [MyISAM only]
  • InnoDB Status

2.1 Download

cd /tmp
 
wget https://launchpad.net/mysql-tuning-primer/trunk/1.6-r1/+download/tuning-primer.sh
 
chmod +x tuning-primer.sh

2.2 Usage

./tuning-primer.sh

tuning-primer.sh: https://github.com/BMDan/tuning-primer.sh

3 pt-variable-advisor

Analyses MySQL variables, output suggestions based on those variables.

3.1 Download

https://www.percona.com/downloads/percona-toolkit/LATEST/

3.2 Usage

pt-variable-advisor localhost --socket /var/lib/mysql/mysql.sock

4 pt-qurey-digest

Analyses log, process list, tcpdump for MySQL queries. Mainly used to analyze slow queries. pt-qurey-digest outputs more details compare to py-query_digest.

4.1 Download

Sames as “3 pt-variable-advisor”

4.2 Usage

pt-query-digest /var/lib/mysql/slowtest-slow.log

4.3 Other usages

# Analyze slow quires
pt-query-digest /var/lib/mysql/slowtest-slow.log > slow_report.log
 
# Quires within 24 hours
pt-query-digest --since=24h /var/lib/mysql/slowtest-slow.log > slow_report.log
 
# Quires within specified time frame
pt-query-digest /var/lib/mysql/slowtest-slow.log --since '2020-01-01 00:00:00' --until '2012-01-10 00:00:00'> > slow_report.log
 
# Slow quires with select
pt-query-digest --filter '$event->{fingerprint} =~ m/^select/i' /var/lib/mysql/slowtest-slow.log> slow_report.log
 
# Query from specific user
pt-query-digest --filter '($event->{user} || "") =~ m/^root/i' /var/lib/mysql/slowtest-slow.log> slow_report.log
 
# All full table scanning, full join slow quires
pt-query-digest --filter '(($event->{Full_scan} || "") eq "yes") ||(($event->{Full_join} || "") eq "yes")' /var/lib/mysql/slowtest-slow.log> slow_report.log

List of 8 useful free software/program for macOS

1 VLC

Free/open source music/video player, can play almost all of audio/video formats

VLC
VLC

Download

2 IINA

Another free/open source music/video player which can play almost all of audio/video formats

IINA
IINA

Download

3 Cheat Sheet

Display shortcut keys, great for learning shortcut keys, eventually you won’t need it once you have them in your mind

Cheat Sheet
Cheat Sheet

Download

4 Spectacle

Move or resize windows easily with keyboard like in Microsoft Windows

Spectacle keys
Spectacle keys
Spectacle - Whole
Spectacle – Whole
Spectacle - Left
Spectacle – Left
Spectacle - Right
Spectacle – Right
Spectacle - Right
Spectacle – Right
Spectacle - Center
Spectacle – Center

Download

5 Aerial

a Mac screensaver based on the new Apple TV screensaver that displays the Aerial movies Apple shot over New York, San Francisco, Hawaii, China, etc. Starting with version 1.6, this also includes the new undersea videos available in tvOS 13!

Aerial screensaver
Aerial screensaver

More information & Download

6 Snip

Take screenshot easily, it can also scroll the web-page and take screenshot of it, so that we can get a full web-page screenshot

Snip
Snip

Downlaod

7 Itsycal

A tiny menu bar calendar.

Itsycal
Itsycal
Itsycal
Itsycal

Download

8 Amphetamine

Simply keep the mac awake…

Amphetamine can keep your Mac, and optionally its display(s), awake through a super simple on/off switch, or automatically through easy-to-configure Triggers. Amphetamine is extremely powerful and includes advanced features for those who need them, yet remains intuitive and easy-to-use for those who don’t need all of the bells and whistles.

(You can also disable sleep function from the systems settings without installing any Apps to achieve the same results)

Amphetamine
Amphetamine

Download

(Can be downloaded directly from App store)


How to: Quickly and Easily search a folder, partition or even computer for files in Microsoft Windows

When using Windows built-in search function, it can take ages to search a partition, it will take even longer if you want to search files across all partitions.

Everything is a free filename search software for Windows that can bring up your search results in seconds.

Everything
Everything
  • Small installation file
  • Clean and simple user interface
  • Quick file indexing
  • Quick searching
  • Quick startup
  • Minimal resource usage
  • Small database on disk
  • Real-time updating
  • Multilingual support
  • Has official portable version

Download Everything 1.4.1.935

Installer

64-bit Installer

Portable zip

64-bit Portable zip

Supported Languages

Language pack for Everything

Resource

Official website


Powerful Linux Interactive shell

fish (friendly interactive shell) is a smart and user-friendly command line shell for Linux, macOS, and the rest of the family.

Autosuggestions

Autosuggestion Thumbnail

fish suggests commands as you type based on history and completions, just like a web browser. Watch out, Netscape Navigator 4.0!

Glorious VGA Color

Colors Thumbnail

fish supports 24 bit true color, the state of the art in terminal technology. Behold the monospaced rainbow.

Sane Scripting

Scripting Thumbnail

fish is fully scriptable, and its syntax is simple, clean, and consistent. You’ll never write esac again.

Web Based configuration

Web Config Thumbnail

For those lucky few with a graphical computer, you can set your colors and view functions, variables, and history all from a web page.

Man Page Completions

Man Page Completions Thumbnail

Other shells support programmable completions, but only fish generates them automatically by parsing your installed man pages.

Works Out Of The Box

Works Out of the Box Thumbnail

fish will delight you with features like tab completions and syntax highlighting that just work, with nothing new to learn or configure.

fish can be installed easily on most Linux distros with their default package manager.

Linux

# Debian/Ubuntu/Kali Linux etc.
sudo apt install fish
 
# RHEL/CentOS/Fedora
sudo dns install fish
or, for older version
sudo yum install fish
 
# Archlinux
pacman -S fish
 
# gentoo Linux
emerge fish
 
# void-Linux
xbps-install fish-shell
 
# NixOS
nix-env -i fish
 
# Guix
guix package -i fish
 
# Solus
eopkg install fish
 
# Hombrew
brew install fish

BSD

# FreeBSD
pkg install fish
 
# OpenBSD
pkg_add fish

Windows

# Cygwin
fish is available in setup, in the Shells category.
 
# Windows Subsystem for Linux
sudo apt install fish
or
depend on the Linux distro you've chose, refer to the above "Linux" part to find correct command to use
 
# MSYS2
pacman -S fish

masOS

# Homebrew
brew install fish
 
# MacPorts
sudo port install fish
 
# Installer
https://github.com/fish-shell/fish-shell/releases/download/3.1.0/fish-3.1.0.pkg
 
10.6+: Installs to /usr/local/

Bonus

  • To use, type fish in the terminal then hit Enter key

To check fish version

echo $FISH_VERSION

HTML version help document

help

To switch default shell to fish

sudo chsh -s /usr/bin/fish

To switch back to default bash shell

sudo chsh -s /bin/bash

(If your default shell is zsh)

sudo chsh -s /usr/zsh

Open source/Free tools to find vulnerability in Active Directory (AD) – Grouper2

Grouper2 vs Grouper

Grouper

1 The computer must be joined to the domain with GPMC and RSAT installed

2 User must use Get-GPOReport with PowerShell to generate XML report

3 The report is required by Grouper

4 Users must manually filter out useful data

Grouper2

Grouper2 does not rely on Get-GPOReport, it still needs to parse different types of files format.

1 More accurate file permission detection, no read/write of storage required

2 Won’t ignore GPP password

3 Provide HTML format output

4 Multi-thread support

5 Supports offline mode

Official description

What is it for?

Grouper2 is a tool for pentesters to help find security-related misconfigurations in Active Directory Group Policy.

It might also be useful for other people doing other stuff, but it is explicitly NOT meant to be an audit tool. If you want to check your policy configs against some particular standard, you probably want Microsoft’s Security and Compliance Toolkit, not Grouper or Grouper2.

What does it do?

It dumps all the most interesting parts of group policy and then roots around in them for exploitable stuff.

How is it different from Grouper?

Where Grouper required you to:

  • have GPMC/RSAT/whatever installed on a domain-joined computer
  • generate an xml report with the Get-GPOReport PowerShell cmdlet
  • feed the report to Grouper
  • a bunch of gibberish falls out and hopefully there’s some good stuff in there.

Grouper2 does like Mr Ed suggests and goes straight to the source, i.e. SYSVOL.

This means you don’t have the horrible dependency on Get-GPOReport (hooray!) but it also means that it has to do a bunch of parsing of different file formats and so on (booo!).

Other cool new features:

  • better file permission checks that don’t involve writing to disk.
  • doesn’t miss those GPP passwords that Grouper 1 did.
  • HTML output option so you can preserve those sexy console colours and take them with you.
  • aim Grouper2 at an offline copy of SYSVOL if you want.
  • it’s multithreaded!
  • a bunch of other great stuff but it’s late and I’m tired.

Also, it’s written in C# instead of PowerShell.

How do I use it?

Literally just run the EXE on a domain joined machine in the context of a domain user, and magic JSON candy will fall out.

If the JSON burns your eyes, add -g to make it real pretty.

If you love the prettiness so much you wanna take it with you, do -f "$FILEPATH.html" to puke the candy into an HTML file.

If there’s too much candy and you want to limit output to only the tastiest morsels, set the ‘interest level’ with -i $INT, the bigger the number the tastier the candy, e.g. -i 10 will only give you stuff that will probably result in creds or shells.

If you don’t want to dig around in old policy and want to limit yourself to only current stuff, do -c.

If you want the candy to fall out faster, you can set the number of threads with -t $INT – the default is 10.

If you want to see the other options, do -h.

I don’t get it.

OK have a look at this:

A picture of some Grouper2 output

In the screenshot above we can see an “Assigned Application” policy that is still being pushed to computers, but the MSI file to install is missing, and the directory it’s being installed from is writable by the current user.

If you created a hacked up MSI (e.g. with msfvenom) and then modified it to match the UIDs at the bottom of the picture, it would get executed on machines targeted by the GPO. Sweet!

A picture of some Grouper2 output

In this one you can see that someone’s done something absolutely insane to the ACLS on the registry.

You get the picture.

Resource

Official Github page


Open source SSH/Telnet client

There are many open source and free SSH/Telnet clients, one of them is PuTTY.

PuTTY is very easy to use since it has GUI.

It can be downloaded from their official website

It has Microsoft Windows version, both in msi and exe format. It can be installed on the system or executed directly without installation.

It has Unix/Linux version as well, which can be downloaded from their official website too (source archive)

For Linux operating systems, we can also install directly from package managers as well.

Install on Linux

# Debian/Ubuntu/Kali Linux etc.
sudo apt install putty
 
# CentOS/RHEL/Fedora
sudo dnf install putty
or
sudo yum install putty
 
# Arch Linux
sudo pacman -S putty

Install on Linux from source

tar -xvf putty-0.73.tar.gz
cd putty-0.73/
./configure
sudo make && sudo make install

How to: Remove junk file from Linux easily

tmpwatch/tmpreaper is the tool we can use for this purpose. It can be used to remove files and folders which haven’t being used for a specific time. (find command can be used to achieve the same result as well)

By default, tmpwatch/tmpreaper can use access time, inode change time, modification time to remove files.

Usually, tmpwatch/tmpreaper is used to remove files from “/tmp” folder and other folders like old log files.

Warning: Do not run this command within root folder “/”!

1 Installation

# CentOS/RHEL/Fedora
sudo dnf install tmpwatch
 
# Older version of CentOS
sudo yum install tmpwatch
 
# Debian/Ubuntu Kali Linux etc.
sudo apt install tmpreaper
 
# OpenSUSE
sudo zypper install tmpwatch

2 Using tmpwatch/tmpreaper

tmpwatch and tmpreaper have identical commands/switches.

2.1 Remove files which haven’t being accessed over X days

tmpreaper 30d /var/log/

30d = 30 days

d: Days

h: hours

m: minutes

s: seconds

By default, without specifying the unit it is considered as hours (In following example, 24 hours)

# Remove files haven't being accessed over 10 hours
tmpreaper 24 /var/log/

2.2 Remove files which haven’t being modified over X days

tmpreaper -m 30d /var/log/

2.3 Remove symbolic links

tmpreaper -s 1d /var/log/

2.4 Remove all files (Include files, folders and symbolic files)

tmpreaper -a 1d /var/log/

2.5 Skip folder/directory when deleting

tmpreaper -am --nodirs /var/log/

2.6 Test deleting

tmpreaper -t 5d /var/log/

2.7 Force deleting

tmpreaper -f 3d /var/log/

2.8 Skip files when deleting

tmpreaper --protect '*.txt' 3d /var/log/

tmpreaper can be used with cron job, e.g. delete tmp or log file from 90 days ago every night at 2:00.


How to: Put panorama photo together – Panorama photo stitcher

Sometimes we want to put panorama photos together, so that we can have a complete photo.

It can be time consuming if we do it manually, also it requires skill to be done.

To make it easier, we can use software to achieve same or even better results.

Hugin is an open source and completely free software just does that and it’s easy to use as well.

Hugin
Hugin

Some technical details can be found here: Photometric alignment and vignetting correction

Download