From a437ff873cd81540a02931509cbe46c07e469bde Mon Sep 17 00:00:00 2001 From: Arnold Levy Date: Wed, 12 May 2021 19:23:23 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20update=20R=C3=A9seaux/Tor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Réseaux/Tor.html | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/Réseaux/Tor.html b/Réseaux/Tor.html index 9deb123..085042e 100644 --- a/Réseaux/Tor.html +++ b/Réseaux/Tor.html @@ -2,7 +2,7 @@ title: Réseau - Tor description: Comprendre et utiliser le réseau Tor published: false -date: 2021-05-12T19:19:24.185Z +date: 2021-05-12T19:23:21.636Z tags: linux, tor, réseau editor: ckeditor dateCreated: 2021-05-11T19:26:41.152Z @@ -272,7 +272,46 @@ Last login: Wed May 12 10:27:11 2021 from 10.0.0.69
# pip install pynacl

on se créé un petit espace dédié à nos scripts sur le serveur, on fait notre cuisine : 

# mkdir /root/scipts
-# 
-

 

-

 

+# vim /root/scipts/keygen.py +

On colle le script : 

+
# cat /root/scipts/keygen.py 
+#!/usr/bin/env python3
+import base64
+try:
+    import nacl.public
+except ImportError:
+    print('PyNaCl is required: "pip install pynacl" or similar')
+    exit(1)
+
+
+def key_str(key):
+    # bytes to base 32
+    key_bytes = bytes(key)
+    key_b32 = base64.b32encode(key_bytes)
+    # strip trailing ====
+    assert key_b32[-4:] == b'===='
+    key_b32 = key_b32[:-4]
+    # change from b'ASDF' to ASDF
+    s = key_b32.decode('utf-8')
+    return s
+
+
+def main():
+    priv_key = nacl.public.PrivateKey.generate()
+    pub_key = priv_key.public_key
+    print('public:  %s' % key_str(pub_key))
+    print('private: %s' % key_str(priv_key))
+
+
+if __name__ == '__main__':
+    exit(main())
+


et on l'utilise ! 

+
public:  HJN3IK5HZVZR7JXO343JTKFATO5JHCBTZ3PQWRZWOCJMP3KY6VSQ
+private: DK6XMZX7JJZNE464JI2HKIVANRT7ADDUS64PM5ERY6UMVDQW4BKQ
+

 

+

 

+

 

+

 

+

 

+