:::: MENU ::::

Monthly Archives / March 2016

  • Mar 30 / 2016
  • 0
Linux, Python

Generate SHA-512 hash on command-line with Python

Need to generate the hash for a password? No need to use an online generator, totally insecure for your passwords …
This simple command will ask you which string you want to hash and will return you the result after pressing “Enter” key!

python -c "import crypt, getpass, pwd; print crypt.crypt(raw_input(), '\$6\

Besoin de générer un hash pour un mot de passe ? Pas besoin d’utiliser un générateur en ligne, totalement insécurisé pour vos mots de passe …
Cette simple commande vous demandera pour quelle chaine vous souhaitez effectuer un hash et vous retournera le résultat dès que vous presserez “Entrée” !

python -c "import crypt, getpass, pwd; print crypt.crypt(raw_input(), '\$6\

 + raw_input() + '\

  • Mar 09 / 2016
  • 0
Linux

Define the MTU size for current network

To limit the fragmentation of packets and optimize your network, it can be necessary to find the best MTU size to set up on your interface. In order to find this best value, you can use a simple ping command.

We’re first trying with a MTU size of 1500 bytes:

$ ping -M do -s 1500 mysite.com
PING mysite.com (1.2.3.4) 1500(1528) bytes of data.
ping: local error: Message too long, mtu=1500
ping: local error: Message too long, mtu=1500
ping: local error: Message too long, mtu=1500

We can clearly see that with the overhead, it’s sending 1528 bytes, too long for the MTU size allowed on the network (1500). Message will be fragmented.

We’re changing the value to 1472 bytes:

$ ping -M do -s 1472 mysite.com
PING mysite.com (1.2.3.4) 1472(1500) bytes of data.
1480 bytes from 1.2.3.4: icmp_seq=1 ttl=58 time=0.94 ms
1480 bytes from 1.2.3.4: icmp_seq=2 ttl=58 time=0.62 ms
1480 bytes from 1.2.3.4: icmp_seq=3 ttl=58 time=0.53 ms

Right now, we can see that packets are not fragmented anymore, exactly what we were expected!

On most of Linux distributions, MTU size can be set with this command:

ifconfig eth0 mtu 1472 up

You can check the results with the ip addr show command:

$ ip addr show
[...]
2: eth0: <no-carrier,broadcast,multicast,up> mtu 1492 qdisc fq_codel state DOWN group default qlen 1000
    link/ether 12:34:56:78:90:12 brd ff:ff:ff:ff:ff:ff
[...]
</no-carrier,broadcast,multicast,up>

Question ? Contact