Saturday, March 27, 2021

BASH tricks with strings

I've been trying to leave Bash Scripting for a long time, favoring Python scripting. But when I guess I can't go further with Bash scripting, it just brings me something cool and new!

I must accept ICMP from a few OVH IPs, and among them are 2 IPs from my server network, where the last octet will be 250 and 251. To make it easier to understand, suppose that my server IP is a.b.c.d. So I must ACCEPT ICMPs from a.b.c.250 and a.b.c.251.

So, this is the amazing solution Bash Scripting offers me:

# ==========================================

# Dedicated Server IP external interface

IF_EXT="enp2s0"    # define here your external interface, such as eth0, vmbr0, etc

IP_EXT=$(ip -4 a|grep "${IF_EXT}$"|awk '{print $2}'|cut -d/ -f1)


# OVH monitoring IPs array

#    Here is the thing: the last item of this array!

IP_MONITORING=(37.187.231.251 151.80.231.244 151.80.231.245 151.80.231.246 151.80.231.247 213.186.33.62 92.222.184.0/24 92.222.185.0/24 92.222.186.0/24 167.114.37.0/24 213.186.45.4 213.251.184.9 37.59.0.235 8.33.137.2 213.186.33.13 213.186.50.98 ${IP_EXT%.*}.25{0,1})


# And finally the iptables command

for i in $(seq 0 $[${#IP_MONITORING[@]}-1]) ; do

        iptables -A INPUT -p icmp -s ${IP_MONITORING[$i]} -d ${IP_EXT} -j ACCEPT

done

# ==========================================


Notes:

- Obviously, you must run this script as root!

- I know Python would do it too. What I didn't know is that Bash could carry it out so "gracefully"!!

- I welcome any suggestion that may improve this code!!!


I hope it can help somebody out there. If it does, make me aware of it!

Wednesday, December 30, 2020

LVM GUI Tools

LVM is not simple to deal with. And although I do believe that I must know how to deal with it by using CLI environment, it's always a good thing to know how to use some LVM GUI tools. This article presents some good ones. Just remember: first and foremost, you must understand how it works under the hoods, and then dare to test some of these good tools.

Read the article at https://www.linuxjournal.com/content/review-gui-lvm-tools

bpytop – Awesome Linux, macOS and FreeBSD resource monitor

It is always a good idea to keep a resource monitor open. HTop has been my pet for years. But now, I guess it is time to change. 

BPyTop is an awesome alternative, lightweight, and fully featured. Excellent job, written in Python. After that, I haven't seen my Htop interface for days! Read this concise article, and give BPyTop a try, if you haven't already!

Read more here: https://www.cyberciti.biz/open-source/command-line-hacks/bpytop-awesome-linux-macos-and-freebsd-resource-monitor/

Thursday, December 17, 2020

Almost 3M users with infected devices with Chrome and Edge extensions

Up to 3 million devices infected by malware-laced Chrome and Edge add-ons.

Many of the "smart" and "advanced" users who use browser extensions (browser extensions) to download photos, videos, and other content from sites like Facebook, Instagram, Vimeo, and Spotify, have just "achieved" the results that security professionals have always warned about: they managed to contaminate their equipment with silent password stealers, who work without drawing almost any attention, even making the user think "he is safe and that he never had any problem with viruses and malware".

In reality, end users usually don't even know what malware is ...

Read more on this subject at ArsTechnica.

Monday, December 14, 2020

Are Linux Smartphones about to KILL Android?

In this video, not only another Linux phone will be presented. The author will dive into some questions about privacy and profit. In the end, he will think about Linux as a good option for mobiles.

Worthy a peek!

Are Linux Smartphones about to KILL Android?