This repository has been archived by the owner on Sep 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
HACKING.es
80 lines (50 loc) · 2.16 KB
/
HACKING.es
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
###############################################
Informacion sobre modificacion de TCOS
###############################################
TCOS es un conjunto de scripts que copia binarios
y liberias en una imagen de arranque, es posible
añadir más utilidaddes según se vayan necesitando.
Usar como plantilla /etc/tcos/hacking/template
Forma de añadir soporte a un programa:
Ejemplo, añadir en la imagen soporte para display
( visualizador de imagenes => ImageMagick )
Crea un archivo en /etc/tcos/hacking/
####### /etc/tcos/hacking/display ##############
# script TCOS para soporte del comando display
cpifexists /usr/bin/display /usr/bin
##############################################
Ayudantes que podemos usar:
* cpifexits [BINARIO] [RUTA_DESTINO]
Copia un BINARIO dado por su ruta completa en
RUTA_DESTINO dentro del initramfs
Esta función copia las _dependencias_, es decir
las librerías de las que depende el binario => man ldd
Ejemplos:
cpifexists /sbin/fdisk /sbin/
Internamente se ejecuta:
$ ldd /sbin/fdisk
linux-gate.so.1 => (0xffffe000)
libc.so.6 => /lib/tls/libc.so.6 (0xb7e3e000)
/lib/ld-linux.so.2 (0xb7f8f000)
Y se copian las librerias enlazadas.
NOTA: Se intentará no copiar nada que tenga que ver con /lib/tls/
Tambien se pueden copiar archivos normales:
cpifexists /etc/hosts.allow /etc/
* copydir [DIR] [RUTA_DESTINO]
Copia un directorio dentro de la imagen initramfs
equivale a ejecutar cp -ra DIR $INITRAMFS/$DESTINO
Ejemplos:
copydir /etc/dropbear/ /etc/
* stat_before
Crea un punto de ajuste de tamaño, vease stat_after
* stat_after "TEXTO"
Lee el punto de ajuste de tamaño creado por stat_before,
calcula la diferencia en Kb y lo imprime por pantalla
Ejemplo completo:
stat_before
cpifexists /usr/bin/display /usr/bin/
stat_after "ImageMagick display"
Esto copia el binario (y librerías) en el initramfs
y calcula el tamaño en Kb que hemos añadido a la imagen con
esta accion, por lo que imprimiría por pantalla:
=> Package ImageMagick display get XXX Kb.