Skip to content

networklib

PhilippeLeroux edited this page Oct 9, 2018 · 5 revisions

Table of contents


networklib.sh last modified : 29/09/2018

  • Publics functions : 12
  • Undocumented functions : 0
  • Privates functions : 1

Public functions

Public function ping_test

$1 server to ping
return 0 if server is reachable, else other value.

Public function port_open

$1 server name
$2 port
return 0 if port $2 open, else return 0

Public function exit_if_cannot_connect_to

$1 server name
exit 1 if ssh not available on port 22 or server unreachable.

Public function right_pad_ip

pad ip $1 with .0
Ex : 192.250.240 ==> 192.250.240.0

Public function convert_net_prefix_2_net_mask

Convert net prefix to net mask
$1 net prefix
return net mask

Public function get_if_hwaddr

Retourne l'adresse mac de l'Iface $1

Public function dns_test_if_ip_exist

Retourne 0 si l'ip $1 existe sinon 1

Public function get_ip_for_host

retourne l'IP de l'host $1, ou rien si l'IP n'est pas trouvée.

Public function remove_ip_from_known_hosts

Supprime l'ip $1 du fichier ~/.ssh/know_hosts

Public function remove_from_known_hosts

Supprime du fichier ~/.ssh/know_host l'hôte $1

Public function get_server_public_key

$1 server name.
return public key for server $1

Public function add_to_known_hosts

Ajoute le serveur $1 au fichier ~/.ssh/known_hosts

Private functions

Private function cleanup_know_host

Permet de nettoyer mon bordel.

Clone this wiki locally