≡ Menu

A muso duro…

Ho sempre odiato i porci ed i ruffiani
e quelli che rubavano un salario
i falsi che si fanno una carriera
con certe prestazioni fuori orario…

{ 0 comments }

tree…

Did you ever need to look up a file and had no idea where it could be? Or did you want to know how a directory and its sub-directories are structured, but didn’t have any overview? This is where tree comes in.

By running tree you get a nicely looking directory tree, containing the current directory and all the sub-directories.

To install tree on Arch, use the command:

#pacman -S tree

Handy, isn’t it? But there’s more to it! If you look up the man page you see that, as an example, you can append the -lflag to follow symbolic links or append the -fflag to print the relative file path, which is useful if you need the relative path in your code base. Additionally, if you execute treefor a large directory with numerous sub-directories you may limit the depth of the sub-directory traversal to e.g. 2 levels via the tree -L 2 .

{ 0 comments }

Let’s use undescores…

From Python 3.6 (and onwards) you can use underscores to make numbers easier to read.

Let’s look at an example:

The output:

{ 0 comments }

Bug…

Il primo bug…

…alla ricerca degli errori presenti nei miei programmi.

{ 0 comments }

raindrops…

A window covered with raindrops interests me more than a photograph of a famous person.

Saul Leiter

{ 0 comments }

Un CryptoLocker con Python…

Esistono diverse tipologie di malware, con diversi scopi. Quello che proveremo a creare nel seguito avrà lo scopo di localizzare i file della vittima e renderli inaccessibili tramite la crittografia. Solitamente i cracker utilizzano i CryptoLocker per prendere in ostaggio i file della vittima e renderli inaccessibili. La chiave con cui i file vengono criptati, in possesso dei cybercriminali, viene rilasciata poi solamente in cambio di un pagamento in criptovaluta. Useremo Python per creare questo semplice malware.

Lo script cerca i file nella directory corrente e popola la lista files. Si noti che vengono esclusi i file evilquest.py (che contiene il codice che stiamo esaminando), filechiave.key (un file che contiene la chiave con cui verrà criptato il contenuto dei singoli file) e goodquest.py (che conterrà il codice per decriptare i file usando la chiave contenuta in filechiave.key).

Lo script, quando viene eseguito, dopo aver generato una chiave, cripterà tutti i file contenuti nella direcrtory corrente. Lo script seguente, invece, userà la chiave generata (e memorizzata in filechiave.key) per decriptare i file precedentemente criptati.

{ 0 comments }

…era il mio eroe

Si chiamava catch e, da bambino, Antonio Inoki era il mio eroe.
Poi arrivarono gli americani, con il wrestling, e trasformarono il tutto – come al solito – in una enorme buffonata.

{ 0 comments }

Correct time…

It is always a good practice to maintain the correct time on your Linux server or system and it can have the following advantages: maintain a timely operation of system tasks since most tasks in Linux are controlled by time.
Correct time for logging events and other information on the system and many more.

# timedatectl status

# timedatectl

OR

# timedatectl | grep Time

To view all available timezones, run the command below:
# timedatectl list-timezones

# timedatectl list-timezones | grep Europe/I

# timedatectl set-timezone “Europe/Roma”

# timedatectl set-timezone UTC

For who was wondering, Coordinated Universal Time or UTC is the primary time standard by which the world regulates clocks and time.

To set both date and time:

# timedatectl set-time '2022-09-27 09:24:50'

# timedatectl | grep local

Set your hardware clock to local timezone:

# timedatectl set-local-rtc 1

# timedatectl set-ntp true

# timedatectl set-ntp false

{ 0 comments }