Compare commits
6 Commits
8f161e5910
...
2e5bf7d1a7
Author | SHA1 | Date | |
---|---|---|---|
2e5bf7d1a7 | |||
f289a46857 | |||
1a9139b8fa | |||
b559359843 | |||
b49cb2e7cf | |||
7eae2bacf3 |
@@ -1,12 +1,14 @@
|
||||
:PROPERTIES:
|
||||
:ID: ca50d517-3e8a-4d03-ba38-7ff411e87408
|
||||
:mtime: 20220109135615
|
||||
:mtime: 20220130102557
|
||||
:ctime: 20211230101331
|
||||
:END:
|
||||
#+title: Software
|
||||
|
||||
* Langages
|
||||
** [[id:4fabfe6a-b104-464f-8a87-dfd7d761dbcc][Python]]
|
||||
** [[id:ed8be72a-8a4d-4ef7-92e4-78d07095deaf][C++]]
|
||||
|
||||
** Compilés
|
||||
*** [[id:ed8be72a-8a4d-4ef7-92e4-78d07095deaf][C++]]
|
||||
*** [[id:673d43c9-0b31-4f28-b550-4eb615c41dac][Rust]]
|
||||
** Interprétés
|
||||
*** [[id:4fabfe6a-b104-464f-8a87-dfd7d761dbcc][Python]]
|
||||
* Design pattern
|
||||
|
@@ -1,6 +1,6 @@
|
||||
:PROPERTIES:
|
||||
:ID: 4fabfe6a-b104-464f-8a87-dfd7d761dbcc
|
||||
:mtime: 20220104164359
|
||||
:mtime: 20220130162518
|
||||
:ctime: 20211230101535
|
||||
:END:
|
||||
#+title: Python
|
||||
@@ -13,7 +13,23 @@
|
||||
|
||||
* Frameworks
|
||||
** Web
|
||||
* [[id:26b04294-75e8-4043-a9a6-a20acd952963][Flask]]
|
||||
*** [[id:26b04294-75e8-4043-a9a6-a20acd952963][Flask]]
|
||||
|
||||
* UI
|
||||
** Text UI
|
||||
*** [[id:6cc56ee4-6d42-4d50-beb3-bb22a98298dd][textual]]
|
||||
|
||||
* Outils
|
||||
** Formatter
|
||||
*** [[https://github.com/hhatto/autopep8][autopep8]]
|
||||
Utilitaire formattant le code afin de respecter la [[https://www.python.org/dev/peps/pep-0008/][PEP8]] guideline. Il est basé sur l'analyse de code effectuée par
|
||||
[[https://github.com/PyCQA/pycodestyle][pycodestyle]]. Autopep8 ne modifie que les espaces contenus dans le code (l'option ~--aggressive~ permet d'accroitre le
|
||||
pouvoir d'autopep8 et le laisser modifier le code).
|
||||
*** [[https://github.com/google/yapf][YAPF]]
|
||||
En plus de vérifier la conformité avec la [[https://www.python.org/dev/peps/pep-0008/][PEP8]], YAPF formatte le code afin de respecter un style (approche basée sur
|
||||
~clang-format~ et similaire à ~gofmt~).
|
||||
*** [[https://black.readthedocs.io/en/stable/][Black]]
|
||||
Formatter n'appliquant que le style [[https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html][/black/]]. Il accepte la même synthaxe de contrôle que YAPF.
|
||||
|
||||
* Tips
|
||||
** [[id:4ef76164-0e67-410a-8d26-b03071a0cc41][Compter la fréquence des éléments d'une liste]]
|
||||
|
@@ -1,12 +1,21 @@
|
||||
:PROPERTIES:
|
||||
:ID: e7581fe3-f83f-4243-91ed-6ef7ade6a844
|
||||
:mtime: 20220117200146
|
||||
:mtime: 20220130201008
|
||||
:ctime: 20220109134723
|
||||
:END:
|
||||
#+title: Linux
|
||||
|
||||
* [[id:5943c76c-8b25-4cbd-b0b9-c819e5a490ba][cyber]]
|
||||
|
||||
* Systèmes d'initialisation
|
||||
** [[id:af912c20-4752-44ba-bdc0-99451ac0cd10][systemd]]
|
||||
|
||||
* Fonctionnalités
|
||||
* [[id:fad57303-ce0c-4ae4-9529-294f70ecfaa5][Inotify]]
|
||||
** [[id:fad57303-ce0c-4ae4-9529-294f70ecfaa5][Inotify]]
|
||||
|
||||
* Interpreteur de commandes
|
||||
** [[id:72eb2d10-5b92-4fb7-9e4e-1398bd933335][bash]]
|
||||
|
||||
* Utilitaires
|
||||
** Parsing de contenu json (lib+bin) : [[id:83908b49-3945-4dce-8b26-2a5e4636df13][jq]]
|
||||
** Transfert de données à un serveur (lib+bin) : [[id:5ea61eaa-7f37-464c-aa69-8251de8f81af][curl]]
|
||||
|
@@ -1,6 +1,6 @@
|
||||
:PROPERTIES:
|
||||
:ID: 7a81bb2d-a6cf-4a2d-8308-0de97fab1856
|
||||
:mtime: 20220111174057
|
||||
:mtime: 20220130132903
|
||||
:ctime: 20220110091205
|
||||
:END:
|
||||
#+title: OCF resource agent
|
||||
@@ -20,13 +20,11 @@
|
||||
#+BEGIN_SRC shell
|
||||
apt-get install resource-agents
|
||||
#+END_SRC
|
||||
* Pour tester la conformité d'un ~resource-agent~ créé :
|
||||
* Tester la conformité d'un ~resource-agent~ créé :
|
||||
#+BEGIN_SRC shell
|
||||
ocf-tester -n <nom du resource-agent> <chemin vers le script du resource agent>
|
||||
#+END_SRC
|
||||
|
||||
* A installer dans le répertoire ~/usr/lib/ocf/resource.d/<provider>/~ du noeud concerné
|
||||
* Pour créer une nouvelle ressource:
|
||||
* A installer dans le répertoire ~/usr/lib/ocf/resource.d/<provider>/~ pour créer une nouvelle ressource:
|
||||
#+BEGIN_SRC shell
|
||||
sudo pcs resource create <id de la resource> [<standard>:[<provider>:]]<type>
|
||||
#+END_SRC
|
||||
|
@@ -1,6 +1,6 @@
|
||||
:PROPERTIES:
|
||||
:ID: 012e07b1-e12a-46e9-9a26-a93cde8b92ce
|
||||
:mtime: 20220117112848
|
||||
:mtime: 20220130133509
|
||||
:ctime: 20220117112616
|
||||
:END:
|
||||
#+title: Pacemaker
|
||||
@@ -10,3 +10,6 @@
|
||||
#+BEGIN_SRC shell
|
||||
crm_simulate -sL
|
||||
#+END_SRC
|
||||
|
||||
* Références
|
||||
* [[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_high_availability_clusters/index][Configuring and managing high availability clusters - Red Hat]]
|
||||
|
@@ -1,6 +1,6 @@
|
||||
:PROPERTIES:
|
||||
:ID: af912c20-4752-44ba-bdc0-99451ac0cd10
|
||||
:mtime: 20220117200052
|
||||
:mtime: 20220130135731
|
||||
:ctime: 20220117184604
|
||||
:END:
|
||||
#+title: systemd
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
* Tips
|
||||
** Pour déclencher le démarrage d'une /unit/ une fois une @IP obtenue sur une interface
|
||||
** Déclencher le démarrage d'une /unit/ une fois une @IP obtenue sur une interface
|
||||
* Ajouter les contraintes suivantes à l'/unit/ à déclencher :
|
||||
#+BEGIN_SRC shell
|
||||
[Unit]
|
||||
@@ -35,6 +35,13 @@ ExecStart=/lib/systemd/systemd-networkd-wait-online -i <interface>:routable
|
||||
EOF
|
||||
systemctl enable systemd-networkd-wait-online.service
|
||||
#+END_SRC
|
||||
** Vérifier qu'un service est en cours d'exécution
|
||||
#+BEGIN_SRC shell
|
||||
systemctl is-active --quiet systemd-networkd.service && echo Service is running
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
: Service is running
|
||||
|
||||
* Références
|
||||
* [[https://fr.wikipedia.org/wiki/Systemd][Wikipedia]]
|
||||
|
13
20220130101510-rust.org
Normal file
13
20220130101510-rust.org
Normal file
@@ -0,0 +1,13 @@
|
||||
:PROPERTIES:
|
||||
:ID: 673d43c9-0b31-4f28-b550-4eb615c41dac
|
||||
:mtime: 20220130105705
|
||||
:ctime: 20220130101510
|
||||
:END:
|
||||
#+title: Rust
|
||||
|
||||
* Installation
|
||||
#+BEGIN_SRC shell
|
||||
apt-get install rustc
|
||||
#+END_SRC
|
||||
|
||||
* Gestionnaire de paquets [[id:ffa2f02e-e5bc-4973-8f7d-450f80e325bf][Cargo]]
|
41
20220130105202-cargo.org
Normal file
41
20220130105202-cargo.org
Normal file
@@ -0,0 +1,41 @@
|
||||
:PROPERTIES:
|
||||
:ID: ffa2f02e-e5bc-4973-8f7d-450f80e325bf
|
||||
:mtime: 20220130105707
|
||||
:ctime: 20220130105202
|
||||
:END:
|
||||
#+title: Cargo
|
||||
|
||||
* Répertoire de référence [[https://crates.io/][/crates/]]
|
||||
|
||||
* Commandes
|
||||
** Création d'un projet
|
||||
#+BEGIN_SRC shell
|
||||
cargo new <project-name>
|
||||
#+END_SRC
|
||||
Cette commande:
|
||||
* Créé le répertoire ~<project_name>~,
|
||||
* Crée le fichier ~<project_name>/Cargo.toml~,
|
||||
Le code doit se trouver dans le répertoire ~<project_name>/src~
|
||||
** Compiler un projet
|
||||
#+BEGIN_SRC shell
|
||||
cargo build
|
||||
#+END_SRC
|
||||
Compilation du binaire ~target/debug/<project_name>~ (debug est la target par défaut, ~cargo build --release~ pour une
|
||||
livraison).
|
||||
** Exécuter un projet
|
||||
#+BEGIN_SRC shell
|
||||
cargo run
|
||||
#+END_SRC
|
||||
Recompile le projet en cas de changement du ~Cargo.toml~~ ou du code.
|
||||
** Vérifier que le projet est compilable
|
||||
#+BEGIN_SRC shell
|
||||
cargo check
|
||||
#+END_SRC
|
||||
Commande plus rapide que ~cargo build~.
|
||||
|
||||
* Fichier Cargo.toml
|
||||
** [[https://doc.rust-lang.org/cargo/reference/manifest.html][Spécification du fichier]]
|
||||
|
||||
* Références
|
||||
* [[https://doc.rust-lang.org/book/][The Book]]
|
||||
|
27
20220130131002-jq.org
Normal file
27
20220130131002-jq.org
Normal file
@@ -0,0 +1,27 @@
|
||||
:PROPERTIES:
|
||||
:ID: 83908b49-3945-4dce-8b26-2a5e4636df13
|
||||
:mtime: 20220130131043
|
||||
:END:
|
||||
#+title: jq
|
||||
|
||||
* Installation
|
||||
#+BEGIN_SRC shell
|
||||
apt-get install jq
|
||||
#+END_SRC
|
||||
|
||||
* [[https://github.com/stedolan/jq/wiki/jq-Language-Description][Description du language jq]]
|
||||
|
||||
* [[https://github.com/stedolan/jq/wiki/Cookbook][Cookbook]]
|
||||
|
||||
* Tips
|
||||
** Get a object from a list by attribute value
|
||||
#+BEGIN_SRC shell :results output
|
||||
raw='[{"name":"dummyNameA","toto":0,"titi":1},{"name":"dummyNameC","toto":2,"titi":3},{"name":"dummyNameB","toto":4,"titi":5}]'
|
||||
name='dummyNameB'
|
||||
declare -a infos=($(echo "${raw}" | jq -r '.[] | select(.name | contains("'${name}'")) | (.name) + " " + (.titi|tostring) + " " + (.toto|tostring)'))
|
||||
echo "infos=${infos[@]}"
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
: infos=dummyNameB 5 4
|
||||
|
45
20220130131134-bash.org
Normal file
45
20220130131134-bash.org
Normal file
@@ -0,0 +1,45 @@
|
||||
:PROPERTIES:
|
||||
:ID: 72eb2d10-5b92-4fb7-9e4e-1398bd933335
|
||||
:mtime: 20220130133646
|
||||
:ctime: 20220130131134
|
||||
:END:
|
||||
#+title: bash
|
||||
|
||||
* Installation
|
||||
#+BEGIN_SRC shell
|
||||
apt-get install bash
|
||||
#+END_SRC
|
||||
|
||||
* Tips
|
||||
** Initialiser une variable non intialisée ou null
|
||||
#+BEGIN_SRC shell :output dispay
|
||||
a=
|
||||
c='AAA'
|
||||
${a:='coucou'}
|
||||
${b:=123}
|
||||
${c:='coucou'}
|
||||
echo "a=${a}"
|
||||
echo "b=${b}"
|
||||
echo "c=${c}"
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
| a=coucou |
|
||||
| b=123 |
|
||||
| c=AAA |
|
||||
** Initialiser une variable non initialisée
|
||||
#+BEGIN_SRC shell :output dispay
|
||||
a=
|
||||
c='AAA'
|
||||
${a='coucou'}
|
||||
${b=123}
|
||||
${c='coucou'}
|
||||
echo "a=${a}"
|
||||
echo "b=${b}"
|
||||
echo "c=${c}"
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
| a= |
|
||||
| b=123 |
|
||||
| c=AAA |
|
49
20220130133727-curl.org
Normal file
49
20220130133727-curl.org
Normal file
@@ -0,0 +1,49 @@
|
||||
:PROPERTIES:
|
||||
:ID: 5ea61eaa-7f37-464c-aa69-8251de8f81af
|
||||
:mtime: 20220130135414
|
||||
:ctime: 20220130133727
|
||||
:END:
|
||||
#+title: curl
|
||||
|
||||
* Introduction
|
||||
* Abréviation de Client URL Request Library,
|
||||
* Librairie écrite en C (/libcurl/) et une Interface en ligne de commande,
|
||||
* Destinée à récupérer le contenu d'une ressource (désignée à l'aide d'une URL) accessible via un réseau.
|
||||
* Permet de créer ou modifier une ressource (contrairement à wget), il peut ainsi être utilisé en tant que client REST,
|
||||
* Nombreux bindings (C++, Java, .NET, Perl, PHP, Ruby...),
|
||||
* Supporte (/libcurl/) les protocoles DICT, file, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet et TFTP.
|
||||
|
||||
* Installation
|
||||
#+BEGIN_SRC shell
|
||||
sudo apt-get install curl
|
||||
#+END_SRC
|
||||
|
||||
* Tips
|
||||
** Obtenir l'en-tête HTTP d'une URL:
|
||||
#+BEGIN_SRC shell :output dispay
|
||||
curl -I git.adrien.run
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
| HTTP/1.1 | 301 | Moved | Permanently | | | |
|
||||
| Server: | nginx/1.18.0 | (Ubuntu) | | | | |
|
||||
| Date: | Sun, | 30 | Jan | 2022 | 12:50:54 | GMT |
|
||||
| Content-Type: | text/html | | | | | |
|
||||
| Content-Length: | 178 | | | | | |
|
||||
| Connection: | keep-alive | | | | | |
|
||||
| Location: | https://git.adrien.run/ | | | | | |
|
||||
| | | | | | | |
|
||||
** Problème server de certificats
|
||||
Pour outrepasser les erreurs de certificat d'un server (certificat auto-signé par exemple), ajouter le paramètre ~--insecure~
|
||||
** Pour obtenir le code HTTP de retour
|
||||
#+BEGIN_SRC shell :output display
|
||||
result=$(curl -s -o /dev/null -w \"%{http_code}\" https://git.adrien.run)
|
||||
echo $result
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS:
|
||||
: 200
|
||||
|
||||
* Références
|
||||
* [[https://curl.se/docs/manpage.html][Man page]]
|
||||
* [[https://yurisk.info/2020/03/13/curl-cookbook/][Yuri Slobodyanyuk curl cookbook]]
|
17
20220130140137-cyber.org
Normal file
17
20220130140137-cyber.org
Normal file
@@ -0,0 +1,17 @@
|
||||
:PROPERTIES:
|
||||
:ID: 5943c76c-8b25-4cbd-b0b9-c819e5a490ba
|
||||
:mtime: 20220130203043
|
||||
:ctime: 20220130140137
|
||||
:END:
|
||||
#+title: cyber
|
||||
|
||||
|
||||
* Solution de contrôle d'intégrité ou de scellement
|
||||
** Linux: [[id:262f233d-9ae9-4bd7-a8e9-cba392a2c1f6][AIDE]]
|
||||
|
||||
* Serveur
|
||||
** Tips
|
||||
*** [[id:9eedbc4b-a961-4057-b2d8-8f10845f0478][Vérification des cyphers suites acceptées par un serveur]]
|
||||
|
||||
* Frameworks
|
||||
** Flask: [[id:5f41e674-eb59-4d69-981b-46a18cf28452][Flask-security]]
|
19
20220130153624-textual.org
Normal file
19
20220130153624-textual.org
Normal file
@@ -0,0 +1,19 @@
|
||||
:PROPERTIES:
|
||||
:ID: 6cc56ee4-6d42-4d50-beb3-bb22a98298dd
|
||||
:mtime: 20220130154530
|
||||
:ctime: 20220130153624
|
||||
:END:
|
||||
#+title: textual
|
||||
#+filetags: :Python:UI:
|
||||
|
||||
* Introduction
|
||||
Framework de création d'IHM inspiré par le developpement web moderne (CSS) basé sur Rich.
|
||||
Rich est une librairie Python permettant de :
|
||||
* Appliquer des styles à la sortie sur le terminal,
|
||||
* Afficher des tables et du contenu markdown,
|
||||
* Appliquer une coloration synthaxique.
|
||||
|
||||
* Références
|
||||
* [[https://github.com/Textualize/textual][Textual - Github]]
|
||||
* [[https://github.com/Textualize/rich][Rich - Github]]
|
||||
* [[https://rich.readthedocs.io/en/latest/introduction.html][Rich - ReadTheDocs]]
|
@@ -0,0 +1,41 @@
|
||||
:PROPERTIES:
|
||||
:ID: 9eedbc4b-a961-4057-b2d8-8f10845f0478
|
||||
:mtime: 20220130165326
|
||||
:ctime: 20220130165153
|
||||
:END:
|
||||
#+title: Vérification des cyphers suites acceptées par un serveur
|
||||
|
||||
* Howto
|
||||
#+begin_src shell :results output verbatim
|
||||
#!/usr/bin/env bash
|
||||
# from https://superuser.com/questions/109213/how-do-i-list-the-ssl-tls-cipher-suites-a-particular-website-offers
|
||||
|
||||
# openssl requires the port number.
|
||||
server='git.adrien.run:443'
|
||||
delay=1
|
||||
|
||||
ciphers=$(openssl ciphers 'all:enull' | sed -e 's/:/ /g')
|
||||
|
||||
echo obtaining cipher list from $(openssl version).
|
||||
|
||||
for cipher in ${ciphers[@]}
|
||||
do
|
||||
echo -n testing $cipher...
|
||||
result=$(echo -n | openssl s_client -cipher "$cipher" -connect $server 2>&1)
|
||||
if [[ "$result" =~ ":error:" ]] ; then
|
||||
error=$(echo -n $result | cut -d':' -f6)
|
||||
echo no \($error\)
|
||||
else
|
||||
if [[ "$result" =~ "cipher is ${cipher}" || "$result" =~ "cipher :" ]] ; then
|
||||
echo yes
|
||||
else
|
||||
echo unknown response
|
||||
echo $result
|
||||
fi
|
||||
fi
|
||||
sleep $delay
|
||||
done
|
||||
#+end_src
|
||||
|
||||
* Référence
|
||||
* [[https://superuser.com/questions/109213/how-do-i-list-the-ssl-tls-cipher-suites-a-particular-website-offers][How do I list the ssl tls cipher suites a particular website offers]]
|
24
20220130200215-aide.org
Normal file
24
20220130200215-aide.org
Normal file
@@ -0,0 +1,24 @@
|
||||
:PROPERTIES:
|
||||
:ID: 262f233d-9ae9-4bd7-a8e9-cba392a2c1f6
|
||||
:mtime: 20220130200546
|
||||
:ctime: 20220130200215
|
||||
:END:
|
||||
#+title: AIDE
|
||||
#+filetags: :TODO:
|
||||
|
||||
* Présentation
|
||||
* Advanced Intrusion Detection Environment ([[https://aide.github.io/][AIDE]])
|
||||
* Permet de vérifier la non altération d'un fichier, suite, par exemple, à une intrusion.
|
||||
* Licence: GPLv2
|
||||
* Fonctionnement :
|
||||
1. Premier "instantané" des fichiers à surveiller => base de données de référence,
|
||||
2. Test d'intégrité périodique (/cron/): comparaison du statut courant du FS avec la "l'instantané" initialement
|
||||
réalisé. Tout changement peut être considéré comme une erreur.
|
||||
|
||||
* Howto
|
||||
TODO
|
||||
|
||||
* Références
|
||||
* [[https://aide.github.io/][Github]]
|
||||
* [[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-using-aide][Checking Integrity with AIDE - RedHat]]
|
||||
* [[https://www.it-connect.fr/aide-utilisation-et-configuration-dune-solution-de-controle-dintegrite-sous-linux/][AIDE : Utilisation et configuration d’une solution de contrôle d’intégrité sous Linux - IT Connect]]
|
Reference in New Issue
Block a user