STUFF uid=1000(x1nux)
Hacking, Cracking, Training, Manuals, Research, Feelings, Tricks and more.
miércoles, 4 de abril de 2012
Iphone + Ubuntu + tethering
El presente post es para narrar acerca de una eventualidad que actualmente vivo; por cosas del destino "Una corrida" tengo un Iphone 3gs, dicho Iphone tiene un plan de datos, pero aveces necesito conectar la Laptop con el Internet del celular.
La forma antigua era tener el Iphone con JailBreak e instalar un software crakeado llamado "MyWi" pero con el tiempo se volvió mas difícil encontrar dicho software y ponerlo a funcionar.
Dicho software "MyWi" colocaba el Iphone como AP, lo cual uno solo se conectaba a una red Wifi la cual era el Iphone.
La otra forma es conectar el Iphone con el cable USB y decirle a Linux que lo tome como una interfaz, pero eso hasta hace unos meses no se podía hacer si no con MAC, pero ahora lo podemos hacer con Ubuntu.
NOTA: No se que tipo de modificaciones Hicieron los de Ubuntu sobre el kernel y los módulos que manejan el Iphone, pero es la única distro que lo puede hacer. "Compartir Internet desde el Iphone usando el cable USB" es Ubuntu.
Con MAC, usted conecta el Iphone por cable USB y le da la opción compartir Internet al Iphone y el MAC toma el Iphone como una tarjeta de red.
Ese es exactamente el proceso que debemos hacer pero con Ubuntu.
COMO ???
1. Instalar un software llamado "blueman"
#apt-get install blueman
2. Instalar un software llamado "ipheth-utils"
#apt-get install ipheth-utils
3. Reiniciar el Ubuntu y probar
#reboot
y listo ! ya deberia de funcionar.
Espero les funcione, estamos en contacto.
jueves, 3 de noviembre de 2011
knockd - a port-knocking server

In computer networking, port knocking is a method of externally opening ports on a firewall by generating a connection attempt on a set of prespecified closed ports. Once a correct sequence of connection attempts is received, the firewall rules are dynamically modified to allow the host which sent the connection attempts to connect over specific port(s). A variant called Single Packet Authorization exists, where only a single 'knock' is needed, consisting of an encrypted packet.[1][2]
The primary purpose of port knocking is to prevent an attacker from scanning a system for potentially exploitable services by doing a port scan, because unless the attacker sends the correct knock sequence, the protected ports will appear closed.
knockd is a port-knock server. It listens to all traffic on an ethernet (or PPP) interface, looking for special "knock" sequences of port-hits. A client makes these port-hits by sending a TCP (or UDP) packet to a port on the server. This port need not be open -- since knockd listens at the link-layer level, it sees all traffic even if it's destined for a closed port. When the server detects a specific sequence of port-hits, it runs a command defined in its configuration file. This can be used to open up holes in a firewall for quick access.
Install knockd
Download:
Download from official site. Click Here
Unzip tar.gz file:
# tar xvfz knock-0.5.tar.gz
Configure command:
# ./configure
Compile command:
# make
Install command:
# make install
Configure Knockd
The configuration main file = /etc/knockd.conf
#vi /etc/knockd.conf
[options]
logfile = /var/log/knockd.log
[openSSH]
sequence = 1025,1026,1027
seq_timeout = 5
command = /usr/sbin/iptables -A INPUT -s %IP% -p tcp -m tcp --dport 22 -j ACCEPT
tcpflags = syn
[closeSSH]
sequence = 1027,1026,1025
seq_timeout = 5
command = /usr/sbin/iptables -D INPUT -s %IP% -p tcp -m tcp --dport 22 -j ACCEPT
tcpflags = syn
Choose ports combinations in flag "sequence"; and remember that a sequence is to close ssh service and another to open ssh service.
By default
Open the SSH service: 1025, 1026, 1027
Close the SSH service: 1027, 1026, 1025
This would be the knock!!
Close ssh port in server knockd
You must be sure that ssh port "22" is closed in server machine. "Where to install the knockd"
In my case, i execute the following command to close ssh port:
# iptables -A INPUT -p tcp --dport 22 -j DROP
How to run knokd server ?
In my case i work with default Path of configuration file: /etc/knokd.conf. then execute:
#knockd -c /etc/knockd.conf
To Help .. Run:
# knockd -h
usage: knockd [options]
options:
-i, --interface
-d, --daemon run as a daemon
-c, --config
-D, --debug output debug messages
-l, --lookup lookup DNS names (may be a security risk)
-v, --verbose be verbose
-V, --version display version
-h, --help this help
Install knock Client in other machine.
Then ... go to other machine and install knock Client.
In my case i used ubuntu:
#apt-get install knockd
Open the SSH ports in server Knockd
Then ... try knock ports in remote server:
ubuntu@user$knock 192.168.0.1 1025:tcp 1026:tcp 1027:tcp
Then .. try ssh login:
ubuntu@user$ssh -l root 192.168.0.1
Note 0: If port is opened, asked for the ssh password.
Close the SSH port using remote knock:
ubuntu@user$knock 192.168.0.1 1027:tcp 1026:tcp 1025:tcp
Note 1: If port is closed, when you try start a session ssh, the terminal does not respond. "is in a loop".
TIP !!
In my case i had to create the following configuration trying to open ssh port :
In seccion [openSSH] in "command" tag from configuration file in knokd server; add following line:
command = /usr/sbin/iptables -A INPUT -s %IP% -p tcp -m tcp --dport 22 -j ACCEPT && iptables -D INPUT -p tcp --dport 22 -j DROP && iptables -A INPUT -p tcp --dport 22 -j DROP
This line have three commands,
1. Open port to incoming IP.
2. Delete rule that block ssh port.
3. Add rule to block ssh port, again.
Note 2: In my case i dont use firewall, so i add these lines in the command tag
Thks !!
010001 - tcpxtrac - 100100

tcpxtract is a tool for extracting files from network traffic based on file signatures. Extracting files based on file type headers and footers (sometimes called "carving") is an age old data recovery technique. Tools like Foremost employ this technique to recover files from arbitrary data streams. Tcpxtract uses this technique specifically for the application of intercepting files transmitted across a network. Other tools that fill a similar need are driftnet and EtherPEG. driftnet and EtherPEG are tools for monitoring and extracting graphic files on a network and is commonly used by network administrators to police the internet activity of their users. The major limitations of driftnet and EtherPEG is that they only support three filetypes with no easy way of adding more. The search technique they use is also not scalable and does not search across packet boundries. tcpxtract features the following:
- Supports 26 popular file formats out-of-the-box. New formats can be added by simply editing its config file.
- With a quick conversion, you can use your old Foremost config file with tcpxtract.
- Custom written search algorithm is lightning fast and very scalable.
- Search algorithm searches across packet boundries for total coverage and forensic quality.
- Uses libpcap, a popular, portable and stable library for network data capture.
- Can be used against a live network or a tcpdump formatted capture file.
Install tcpxtract
Note 0: Execute as root.
Download package:
Download from Official we site:
http://tcpxtract.sourceforge.net/
Unzip package:
#tar xvfz tcpxtract-1.0.1.tar.gz
Configure command:
#cd tcpxtract-1.0.1/
#./configure
Compile command:
#make
Install command:
#make install
Usage:
# tcpxtract
Usage: tcpxtract [OPTIONS] [[-d
Valid options include:
--file, -f
--device, -d
--config, -c
--output, -o
--version, -v display the version number of this program
--help, -h display this lovely screen
Use case:
Get all files from eth0 device:
#tcpxtract -d eth0 -o tmp/
NOTE 1: Check tmp directory.
Using tcpxtract you can catch files of any extension like pdf, doc, jpg, png, gif or any kind if they pass through the network interface. It's your main function. !!
Thks !
martes, 1 de noviembre de 2011
Recuperar archivos borrados con foremost

Foremost es un programa de consola para recuperar archivos basados en sus cabeceras, pies de página, y estructuras de datos internas. Este proceso se conoce comúnmente como la talla de los datos. Todo se puede trabajar con archivos de imagen, tales como los generados por dd, SafeBack, EnCase, etc, o directamente en un disco. Los encabezados y pies de página se puede especificar un archivo de configuración o puede usar los interruptores de línea de comandos para especificar incorporado en los tipos de archivo. Estos tipos built-in vistazo a las estructuras de datos de un formato de archivo dado que permite una recuperación más rápidas y fiables.
Instalacion de foremost
Slackware 13.37:
NOTA 0: Usando Slapget
# slapt-get --install foremost
#apt-get install foremost
Ayuda de Foremost:
Ejecutarlo por primera vez para ver su ayuda
#foremost -h
Caso de uso:
Recuperar de una USB de 4GB unos archivos .ppt que fueron borrados accidentalmente.
Solución:
1ro: Sacar la imagen de la USB:
#dd if=/dev/sdc1 of=img_usb.dd
2do: Iniciar la recuperacion de archivos:
#foremost -t ppt -av img_usb.dd -o tmp/
Al terminar, se crearan carpetas dentro de tmp, las cuales indica el tipo de archivos que recuperó, en nuestro caso los ppt.
3ro: Revisar todos los archivos .ppt recuperados:
Entrar a la carpeta tmp/ppt y revizar los archivos que recuperó.
NOTA 1: Las opciones -t, -av y -o están en la ayuda de foremost “Unos renglones mas arriba”.
Buscar otro tipo de archivos con foremost
#foremost -t ppt,pdf,avi,exe,doc,docx,png,jpg -av img_usb.dd -o tmp/
Thks !
Mysql-Cluster Installation under Ubuntu Linux:

MySQL Cluster is the industry's only real-time transactional relational database combining 99.999% availability with the low Total Cost of Ownership (TCO) of open source. It features a "shared-nothing" distributed architecture with no single point of failure to assure high availability and performance, allowing you to meet your most demanding mission-critical application requirements.
MySQL Cluster's real-time design delivers predictable, millisecond response times with the ability to service tens of thousands of transactions per second. Support for in-memory and disk based data, automatic data partitioning with load balancing and the ability to add nodes to a running cluster with zero downtime allows linear database scalability to handle the most unpredictable workloads.
MySQL Cluster eliminates the need for expensive shared storage, and runs on a range of commodity platforms, making it the most open and cost-effective database solution for mission critical applications.
- Alcatel-Lucent
- FreeRADIUS
- Shopatron Inc.
- Telenor
- UTStarcom
- Zillow.com
- go2 Media
- SPEECH DESIGN
- IDC
In order to implement you should know a previous vocabulary:
MySQL Cluster uses three different types of nodes (processes) :
Data node (ndbd/ndbmtd process): These nodes store the data.
Management node (ndb_mgmd process): Used for configuration and monitoring of the cluster. They are required only during node startup.[citation needed]
SQL node (mysqld process): A MySQL server (mysqld) that connects to all of the data nodes in order to perform data storage and retrieval. This node type is optional; it is possible to query data nodes directly via the NDB API.
Generally, it is expected that each node will run on a separate host computer.
Mysql-Cluster Installation under Ubuntu Linux:
Install Management Node:
#apt-get install mysql-server-5.1 mysql-cluster-server-5.1 mysql-cluster-client-5.1
Create following directories:
#mkdir /var/lib/mysql-cluster
Give the following properties:
#chown -R mysql:mysql /var/lib/mysql-cluster
Configure MGM Node service:
#vi /var/lib/mysql-cluster/config.ini
[NDBD DEFAULT]
NoOfReplicas=2
DataMemory=80M # How much memory to allocate for data storage
IndexMemory=18M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the "world" database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.
[MYSQLD DEFAULT]
[NDB_MGMD DEFAULT]
[TCP DEFAULT]
# Section for the cluster management node
[NDB_MGMD]
# IP address of the management node (this system)
HostName=192.168.0.1
# Section for the storage nodes
[NDBD]
# IP address of the first storage node
HostName=192.168.0.101
DataDir=/var/lib/mysql-cluster
BackupDataDir=/var/lib/mysql-cluster/backup
DataMemory=2048M
[NDBD]
# IP address of the second storage node
HostName=192.168.0.102
DataDir=/var/lib/mysql-cluster
BackupDataDir=/var/lib/mysql-cluster/backup
DataMemory=2048M
# one [MYSQLD] per storage node
[MYSQLD]
[MYSQLD]
Startup MGM Node service:
#ndb_mgmd -f /var/lib/mysql-cluster/config.ini
NOTE 0: If you modify or add more nodes in the configuration file, you have to restart the service with these options:
#ndb_mgmd -f /var/lib/mysql-cluster/config.ini –reload
then with
#ndb_mgmd -f /var/lib/mysql-cluster/config.ini –initial
Install Data Node service:
Install ubuntu packages:
#apt-get install mysql-server-5.1 mysql-cluster-server-5.1 mysql-cluster-client-5.1
Configure my.cnf config file:
#vi /etc/mysql/my.cnf
In tag [mysqld] add the following flags
ndbcluster
# IP address of the cluster management node
ndb-connectstring=192.168.0.1
and then … add end of file
[mysql_cluster]
# IP address of the cluster management node
ndb-connectstring=192.168.0.1
Save file ..
Create following directories:
#mkdir /var/lib/mysql-cluster
Give the following properties:
#chown -R mysql:mysql /var/lib/mysql-cluster
Startup - Mysql Data Node:
Login to directory /var/lib/mysql-cluster and execute the following command:
#ndbd --ndb-mgmd-host=192.168.0.1 –initial
Then …. restart mysql-server:
#/etc/init.d/mysql stop
#/etc/init.d/mysql start
NOTE 1: Do de same step to Data Node 2.
Test the Mysql-Cluster
Run in cluster management “MGM Node” the client “ndb_mgm” to check if the cluster nodes are connected:
#ndb_mgm
This should print something like:
ndb_mgm>
Then … execute “show;”
This should print something like:
ndb_mgm> show;
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.0.101 (Version: 5.0.19, Nodegroup: 0, Master)
id=3 @192.168.0.102 (Version: 5.0.19, Nodegroup: 0)
[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.0.103 (Version: 5.0.19)
[mysqld(API)] 2 node(s)
id=4 @192.168.0.101 (Version: 5.0.19)
id=5 @192.168.0.102 (Version: 5.0.19)
ndb_mgm>
to exit type “quit”
ndb_mgm>quit;
Now we create a test database with a test table and some data on Data Node 1:
mysql -u root -p
CREATE DATABASE mysqlclustertest;
USE mysqlclustertest;
CREATE TABLE testtable (i INT) ENGINE=NDBCLUSTER;
INSERT INTO testtable () VALUES (1);
SELECT * FROM testtable;
quit;
NOTE 2: have a look at CREATE statment: we must use ENGINE=NDBCLUSTER for all databases tables that we want to get clusteres! If you use another engine, then clustering will not work!!
Look at a select:
mysql> SELECT * FROM testtable;
+------+
| i |
+------+
| 1 |
+------+
1 row in set (0.03 sec)
Now we create the same database on Data Node 2 (yes, we still have to create it, but afterwards testable and its data should be replicated to Data Node 2, because testable uses ENGINE=NDBCLUSTER).
mysql -u root -p
CREATE DATABASE mysqlclustertest;
USE mysqlclustertest;
SELECT * FROM testtable;
The SELECT statment should deliver you the same result as before on Data Node 1.
mysql> SELECT * FROM testtable;
+------+
| i |
+------+
| 1 |
+------+
1 row in set (0.04 sec)
So .. the data was replicated from Data Node 1 to Data Node 2. Now we insert another row into testable in Data node 2.
INSERT INTO testtable () VALUES (2);
quit;
Now let's go back to Data Node 1 and check if we see the new row there:
mysql> SELECT * FROM testtable;
+------+
| i |
+------+
| 1 |
| 2 |
+------+
2 rows in set (0.05 sec)
So .. both Mysql-Cluster nodes alwas have the same data !!!
that's all ..
To remember
In MGM Node start service as follows:
#ndb_mgmd -f /var/lib/mysql-cluster/config.ini
If you modify or add more nodes in the configuration file, you have to restart the service with these options:
#ndb_mgmd -f /var/lib/mysql-cluster/config.ini –reload
then with
#ndb_mgmd -f /var/lib/mysql-cluster/config.ini –initial
In Data Nodes 1, 2 start service as follows:
#cd /var/lib/mysql-cluster
#ndbd –ndb-mgmd-host=192.168.0.1 –initial
then .. restart mysql-server
#/etc/init.d/mysql restart
or
#service mysql restart
Thks !
Recuperar archivos borrados bajo Linux

Software con el que vamos a trabajar: SleuthKit
- L3503.exe
- R225.exe
- clamwin-0.97.2-setup.exe
- pygobject-2.26.0-x86_64-1.txz
- usuario-claves.txt
- Location_interface.xls
NOTA 5: Recuerda comparar los md5 de los archivos reales con los que imprimio el icat para saber si estan en perfecto estado.
Adicionalmente, un examinador forense digital, dentro del proceso del cómputo forense puede llegar a recuperar información que haya sido borrada desde el sistema operativo.
miércoles, 26 de octubre de 2011
John the Ripper - Herramienta de Desencriptamiento

John the Ripper es un programa de criptografía que aplica fuerza bruta para descifrar contraseñas. Es capaz de romper varios algoritmos de cifrado o hash, como DES, SHA-1 y otros.
Es una herramienta de seguridad muy popular, ya que permite a los administradores de sistemas comprobar que las contraseñas de los usuarios son suficientemente buenas.
John the Ripper es capaz de autodetectar el tipo de cifrado de entre muchos disponibles, y se puede personalizar su algoritmo de prueba de contraseñas. Eso ha hecho que sea uno de los más usados en este campo.
Algoritmos que entiende:
Los que se han usado comúnmente en Unix (con la llamada al sistema crypt): DES, MD5, Blowfish.
Kerberos AFS.
Hash LM (Lan Manager), el sistema usado en Windows NT/2000/XP/2003.
Mediante módulos externos, se puede hacer que también trabaje con:
Carateristicas:
Optimizado para muchos modelos de procesadores.
Funciona en muchas arquitecturas y sistemas operativos.
Ataques de diccionario y por fuerza bruta.
Muy personalizable (es software libre).
Permite definir el rango de letras que se usará para construir las palabras y las longitudes.
Permite parar el proceso y continuarlo más adelante.
Permite incluir reglas en el diccionario para decir cómo han de hacerse las variaciones tipográficas.
Se puede automatizar; por ejemplo, ponerlo en cron.
Ética
Aunque esté catalogada como herramienta de cracking, John the Ripper es una utilidad para administradores muy sencilla y que no comporta peligro para el usuario si la usa de forma adecuada.
No pasa nada malo por ejecutar una herramienta de este tipo en un ordenador personal. Sin embargo, en ordenadores multiusuario a veces se prohíbe su uso, ya que al hacer fuerza bruta, es fácil que consuma todo el tiempo de CPU.
Los administradores de sistemas lo pueden emplear para evitar que sus usuarios pongan contraseñas demasiado fáciles, pero lo habitual es hacerlo mediante un programa automático, que sólo se interese por si la clave se puede adivinar fácilmente o no. En ningún caso es necesario que el administrador conozca la clave exacta; sólo ha de saber si es buena o no.
En un sistema Unix, algunos usuarios malintencionados pueden intentar usar este programa para obtener información de acceso. Para evitarlo, basta con asegurarse de que las contraseñas cifradas no estén visibles en el fichero /etc/passwd, sino en el fichero /etc/shadow, que ha tener desactivado el permiso de lectura para los usuarios normales. Esta es la configuración predeterminada en los sistemas operativos de tipo Unix (BSD, GNU/Linux, Mac OS X, etc.).
Entorno de trabajo:
Sistema Operativo: Slackware 13.37 x86_64
Descarga:
Puede ser descargado de la siguiente URL; Sitio oficial.
Instalación John Ripper
Descomprimir:
$tar xvfz john-1.7.8.tar.bz2
Compilar:
$cd john-1.7.8/
$cd src
$make linux-x86-64
NOTA0: Los binarios o ejecutables de John ripper estan en la carpeta “run”.
Funcionamiento:
Probar john para ver que algoritmos soporta:
$cd john-1.7.8
$cd run
$./john -test
Benchmarking: Traditional DES [128/128 BS SSE2-16]... DONE
Many salts: 2150K c/s real, 2154K c/s virtual
Only one salt: 1811K c/s real, 1811K c/s virtual
Benchmarking: BSDI DES (x725) [128/128 BS SSE2-16]... DONE
Many salts: 72439 c/s real, 72730 c/s virtual
Only one salt: 70374 c/s real, 70515 c/s virtual
Benchmarking: FreeBSD MD5 [32/64 X2]... DONE
Raw: 8551 c/s real, 8551 c/s virtual
Benchmarking: OpenBSD Blowfish (x32) [32/64 X2]... DONE
Raw: 522 c/s real, 523 c/s virtual
Benchmarking: Kerberos AFS DES [48/64 4K]... DONE
Short: 267929 c/s real, 268466 c/s virtual
Long: 835481 c/s real, 835481 c/s virtual
Benchmarking: LM DES [128/128 BS SSE2-16]... DONE
Raw: 9936K c/s real, 9936K c/s virtual
Benchmarking: generic crypt(3) [?/64]... DONE
Many salts: 179788 c/s real, 180510 c/s virtual
Only one salt: 180230 c/s real, 180591 c/s virtual
Benchmarking: dummy [N/A]... DONE
Raw: 70293K c/s real, 70293K c/s virtual
Métodos de desencriptación para utilizar Jhon:
Desencriptar Simple:
$john --single mypasswd
o se puede abreviar:
$john -si mypasswd
Desencriptar múltiples archivos:
$john --single passwd1 passwd2
o
$john --single *passwd* *.pwd
Desencriptar con Lista de password:
$john --wordlist=password.lst --rules mypasswd
o Puede abreviar:
$john -w=password.lst -ru mypasswd
La forma de desencriptar mas poderosa; se llama incremental:
$john --incremental mypasswd
o
$john -i mypasswd
En algunos casos es mas rápido usar el modo incremental pero solo para password mas fáciles de encontrar, el siguiente comando tratara de encontrar password contenidos desde la "a" a "zzzzzzzz" (en un orden óptimo):
$john -i=alpha mypasswd
Jhon se puede usar también para buscar los passwords de solo un UID, usando la opción incremental, en este caso buscaremos el UID 0 que es el del usuario root de nuestro Linux:
#john -i -u=0 *.pwd
Como probar que las contraseñas de los usuarios de mi Linux son fuertes ??
Como desencriptar mis propios archivos de password de mi Linux ?
Vamos a realizar una demostración de como desencriptar los passwords de los usuarios en mi sistema Linux:
Paso #1:
Obtener los archivos que contienen la información de los usuarios del sistema y los passwords encriptados:
Como usuario root debemos sacar una copia de los archivos /etc/passwd y /etc/shadow
#cp -r /etc/passwd /etc/shadow /home/pruebas/
Paso #2
Como el usuario normal del sistema que va a usar el John Ripper; fusionar el passwd y el shadow en un solo archivo llamado mypasswd.
$cd john-1.7.8/run
$unshadow /home/pruebas/passwd /home/pruebas/shadow > mypasswd
Paso #3
Usar cualquiera de los métodos de desencriptación de john ripper en función al archivo mypasswd:
Simple:
$john -si mypasswd
Lista de password:
$john -w=password.lst -ru mypasswd
Incremental:
$john -i mypasswd
Como saber cuando ya desencriptó el password de un usuario ?
Ejemplo de como realizarlo en la maquina local:
Como root sacar las copias de los archivos /et/passwd /etc/shadow y crear un usuario de prueba:
Copias:
#cp -r /etc/passwd /etc/shadow /home/pruebas/
Creación del usuario:
#useradd user1
#passwd user1
XXXXX
XXXXX
Como el usuario del sistema que va a usar el John Ripper, fusionar los dos archivos en uno, para iniciar la desencriptación:
$john-1.7.8/run/unshadow /home/pruebas/passwd /home/pruebas/shadow /home/pruebas/filetocrack
Iniciar el John para la desencriptación:
$john-1.7.8/run/john /home/pruebas/filetocrack
2 segundos después encontró el password que le coloque al usuario user1:
Loaded 1 password hashes with 1 different salts (FreeBSD MD5 [32/64 X2])
12345 (user1)
NOTA1: Cabe de anotar que el password era demasiado fácil por eso lo encontró en 2 segundos …
NOTA2: Para mas formas de uso del john; leer la documentación que está dentro del paquete del John Ripper.Gracias...