un petit push, parfois

This commit is contained in:
tth 2022-01-29 22:46:41 +01:00
parent 6cbac48848
commit a6ff3f5086
12 changed files with 188 additions and 44 deletions

View File

@ -472,6 +472,36 @@ Libérer deux fois la mémoire.
% =========================================================
\section{Debug} \index{Debug}
Des outils et astuces en page \pageref{chap:Debug}.
\begin{quote}
splint is an annotation-assisted lightweight static checker.
It is a tool for
statically checking C programs for security vulnerabilities and coding
mistakes.
If additional effort is invested in adding annotations to programs,
splint can perform stronger checking.
\end{quote}
% =========================================================
\section{Legalize}
"The two forms of conforming implementation are hosted and freestanding.
A conforming hosted implementation shall accept any strictly conforming
program. A conforming freestanding implementation shall accept any
strictly conforming program in which the use of the features specified
in the library clause (Clause 7) is confined to the contents of the
standard headers <float.h> , <iso646.h> , <limits.h> , <stdalign.h> ,
<stdarg.h> , <stdbool.h> , <stddef.h> , <stdint.h> , and <stdnoreturn.h>
. Additionally, a conforming freestanding implementation shall accept
any strictly conforming program in which the use of the features
specified in the header <string.h> , except the following functions:
strdup , strndup , strcoll , strxfrm , strerror ." (4p6)
% =========================================================
\section{Ailleurs dans cet ouvrage}
Il y a plein d'autres exemples de code en C, sur des sujets

View File

@ -70,6 +70,8 @@ tth@tranxene:~$
\subsection{dig}
\index{dig}
% https://jvns.ca/blog/2021/12/04/how-to-use-dig/
Dig (\textit{domain information groper}) est un outil d'interrogation
des serveurs DNS. Par défaut, il questionne les serveurs
listés dans \texttt{/etc/resolv.conf}.
@ -80,6 +82,10 @@ Pour résoudre récursivement un nom de domaine à partir de la racine :
Pour obtenir le reverse d'une adresse IP :
\texttt{\$ dig +trace -x <adresse.ip>}
% ------------------------------------------------------------
% \subsection{delv}
% \index{delv}

View File

@ -180,43 +180,7 @@ Il nius faut donc remplacer le getenv de la libc par notre propre
version qui va écouter et exfiltrer l'utilisation de cette
fonction.
\begin{lstlisting}[language=C]
/*
spy_getenv.so: spy_getenv.c Makefile
gcc -Wall -shared -fPIC $< -ldl -o $@
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define __USE_GNU
#include <dlfcn.h>
typedef char * (*original_getenv)(const char *envname);
char *getenv(char *envname)
{
static char *arrow = "--getenv--> ";
static char *wtf = " --> WTF ?";
char *content;
original_getenv orig_getenv;
orig_getenv = (original_getenv)dlsym(RTLD_NEXT, "getenv");
write(STDERR_FILENO, arrow, strlen(arrow));
write(STDERR_FILENO, envname, strlen(envname));
content = orig_getenv(envname);
if (NULL != content) {
write(STDERR_FILENO, "=", 1);
write(STDERR_FILENO, content, strlen(content));
}
else {
write(STDERR_FILENO, wtf, strlen(wtf));
}
write(STDERR_FILENO, "\n", 1);
return content;
}
\end{lstlisting}
\lstinputlisting[language=C]{code/debug/spy_getenv.c}
Simple et efficace.

View File

@ -52,6 +52,11 @@ map_henon: map_henon.f
Hélas, je n'ai pas de commande \texttt{g77} dans ma machine,
que faire ? En écrire une ?
% ==============================================================
\section{qemu}
\index{qemu}\label{qemu}
http://sven.stormbind.net/blog/posts/deb\_qemu\_local\_openwrt/
% ==============================================================

View File

@ -100,6 +100,27 @@ la commande\texttt{tail} au début du script. Ensuite les deux clauses
coordonnées X et Z, dans le repère POVray, qui n'est pas le même que
celui de Gnuplot.
% ------------------------------------------------
\subsection{image\_map}
% ------------------------------------------------
\subsection{height\_field}
Les champs d'altitude... Toute une histoire...
\begin{verbatim}
#declare Champ_Altitude = object
{
height_field {
png "WS/hf5.png" gamma 1.8
}
pigment { color Cyan }
scale 2
}
\end{verbatim}
% ------------------------------------------------
\subsection{Trucs à voir}
@ -107,15 +128,15 @@ celui de Gnuplot.
\begin{verbatim}
#declare VIRGINIA =
transform{
transform {
matrix < 1, 1, 0,
0, 1, 0,
0, 0, 1,
0, 0, 0 >
}
box{0,1
transform{VIRGINIA}
box { 0, 1
transform {VIRGINIA}
}
\end{verbatim}

View File

@ -111,6 +111,12 @@ changer la dimension de l'image. En détail, j'ai pas tout compris.
% ------------------------------------------
\subsection{Trucs}
convert -average frame*.png output.png
% ------------------------------------------
\subsection{Ressources}
Le futur livre de Brunus. Réclamez les prmiers drafts dans

View File

@ -10,4 +10,4 @@ TP Link
Archer C7
\end{verbatim}
http://sven.stormbind.net/blog/posts/deb\_qemu\_local\_openwrt/

View File

@ -2,6 +2,8 @@
\label{S-lang}
\index{S-lang}
% ----------------------------------------------------------
\section{C'est quoi ?}
S-lang est une bibliothèque de fonctions multi-plateforme
@ -13,6 +15,8 @@ L'exemple le plus éblouissant étant le célèbre
longuement dans les pages consacrées à Usenet\index{Usenet}
(page \pageref{slrn}).
% ----------------------------------------------------------
\section{slsh}
\index{slsh}
@ -40,3 +44,4 @@ tth@plop:~/Essais/Slang$
Cool...
% ----------------------------------------------------------

View File

@ -154,7 +154,7 @@ Elle supporte une grande variété de formats.
La configuration se fait par deux fichiers :
\texttt{/etc/libao.conf} surchargeable par
\texttt{\$HOME/.libao.conf}, et scématiquement, nous pouvons
\texttt{\$HOME/.libao.conf}, et schématiquement, nous pouvons
voir qu'elle est à deux niveaux.
https://www.xiph.org/ao/doc/drivers.html

62
chap/webserver.tex Normal file
View File

@ -0,0 +1,62 @@
%
%
%
\chapter{Web servers}
% ==============================================================
\section{Apache} \index{Apache}
Le grand classique.
% ==============================================================
\section{Lighttpd} \index{Lighttpd}
Un outsider ?
\begin{verbatim}
root@ramen:~# lighty-enable-mod userdir
Enabling userdir: ok
Run "service lighttpd force-reload" to enable changes
root@ramen:~# service lighttpd force-reload
root@ramen:~#
\end{verbatim}
% ==============================================================
\section{Custom made}
\begin{verbatim}
tth@ramen:~/Houba/Fractales90$ apt show libmicrohttpd12
Package: libmicrohttpd12
Version: 0.9.72-2
Priority: optional
Section: libs
Source: libmicrohttpd
Maintainer: Daniel Baumann <daniel.baumann@progress-linux.org>
Installed-Size: 211 kB
Depends: libc6 (>= 2.17), libgnutls30 (>= 3.7.0)
Homepage: https://www.gnu.org/software/libmicrohttpd/
Tag: role::shared-lib
Download-Size: 109 kB
APT-Sources: http://deb.debian.org/debian bullseye/main amd64 Packages
Description: library embedding HTTP server functionality
GNU libmicrohttpd is a small C library that is supposed to make it
easy to run an HTTP server as part of another application.
Key features that distinguish GNU Libmicrohttpd from other
projects are:
* C library: fast and small
* API is simple, expressive and fully reentrant
* Implementation is HTTP 1.1 compliant
* HTTP server can listen on multiple ports
* Four different threading models (select, poll, pthread, thread pool)
* Support for IPv6
* Support for SHOUTcast
* Support for incremental processing of POST data (optional)
* Support for basic and digest authentication (optional)
* Support for SSL3 and TLS
\end{verbatim}
% ==============================================================

45
code/debug/spy_getenv.c Normal file
View File

@ -0,0 +1,45 @@
/*
*
* spy_getenv.so: spy_getenv.c Makefile
* gcc -Wall -shared -fPIC $< -ldl -o $@
*
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#define __USE_GNU
#include <dlfcn.h>
typedef char * (*original_getenv)(const char *envname);
char *getenv(char *envname)
{
static char *arrow = "--getenv--> ";
static char *wtf = " --> (nil)";
char *content;
original_getenv orig_getenv;
orig_getenv = (original_getenv)dlsym(RTLD_NEXT, "getenv");
write(STDERR_FILENO, arrow, strlen(arrow));
write(STDERR_FILENO, envname, strlen(envname));
content = orig_getenv(envname);
if (NULL != content) {
write(STDERR_FILENO, "=", 1);
write(STDERR_FILENO, content, strlen(content));
}
else {
write(STDERR_FILENO, wtf, strlen(wtf));
}
write(STDERR_FILENO, "\n", 1);
return content;
}
/* j'adore quand un plan se déroule sans accrc */

View File

@ -139,7 +139,6 @@ en ligne sur le site du Tetalab. Your mileage may vary\dots
\input{chap/plugins}
\input{chap/Bonjour}
\input{chap/ioctl}
\input{chap/debug}
\input{chap/buzybox}
\input{chap/gif89a}
@ -148,11 +147,12 @@ en ligne sur le site du Tetalab. Your mileage may vary\dots
\input{chap/Usenet}
\input{chap/DNS}
\input{chap/ssh}
\input{chap/webserver}
\input{chap/hardware}
\input{chap/gadgets}
\input{chap/sdr}
% \input{chap/slang}
\input{chap/slang}
\input{chap/curses}
\input{chap/openwrt}
\input{chap/WiFi}