Translate

miércoles, octubre 02, 2019

buildroot

Preparar entorno para compilar una imagen builroot:

1. Para ver las tarjetas soportadas:

make list-defconfigs

2.elegir la tarjeta que usaremos (en este caso raspi zero w):
make raspberrypi0_defconfig

3.Configuramos nuestra imagen, elegimos software, confings, etc:
make menuconfig
nota: podemos hacer un backup de la ocnfiguracion copiando el fichero generado .config

4.Siqueremos confiuurar el kernel linux antes de construir la imagen

make linux-menuconfig

5.finalmente ordenar
make

6.Montar la imagen .img generada para modificar (aplicar modificacions de shell, wifi, ssh,..):

fdisk -l imagen.img

Tendremos que fijarnos en el numero del sector de "inicio" y en donde indica: Unidades: sectores de 1 * 512 = 512 bytes Entonces para poder montar las particiones tendremos que multiplicar el "sector de inicio(start) " por las "unidades de sector", tal que asi:
2ª partición 512 * sector de inicio (start) = resultado

mount -v -o offset=resultado -t ext4 imagen.img /mnt

Una vez modificada la desmontamos:
umount /mnt

7.Grabar imagen desde la shell linux:

sudo dd bs=1M if=imagen.img of=/dev/sdx


Configurar Wifi EN LA RASPI ZERO W


1***Fichero /etc/wpa_supplicant.conf

# /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
 ssid="Argalario"
 psk="surfing75"
 key_mgmt=WPA-PSK
}


2****Fichero /etc/network/interfaces

auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant.conf


3****Fichero /etc/inittab /en este fichero se realiza un bucle que inicia los servicios de /etc/init.d

...........
# Load Wifi driver
::sysinit:/sbin/modprobe brcmfmac
# now run any rc scripts
::sysinit:/etc/init.d/rcS
.....

4*****Fichero /etc/init.d/S35wifi (despues de crearlo chmod 755 S35wifi)

#!/bin/sh
#
# Start the wifi....
#

# MODEM
#modprobe ppp_generic
#modprobe ppp_async

# WIFI
#modprobe brcmfmac
wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf

exit $?

5****** Scripts para habilitar puerto 22 in/out ssh


#!/bin/sh
iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT

#!/bin/sh
iptables -A OUTPUT -p tcp --sport 22 -m conntrack --ctstate ESTABLISHED -j ACCEPT


nota: para que root pueda entrar por ssh hay que modificar el fichero /etc/ssh/sshd_config PermitRootLogin   yes

viernes, septiembre 20, 2019

USB Reverse Tethering No Root No ADB Android (all versions) & Windows 10

USB Reverse Tethering No Root No ADB Android (all versions) & Windows 10

This guide allows you to share the Internet connection of a Windows 10 PC with your Android device via a common USB cable that is also charging your phone. This is useful if you can not or want to use the WIFI on your smartphone and you do not want to consume traffic from your data plan. A good reason to limit the use of wireless connections on your phone is the electromagnetic pollution hitting your body. But that's another story.
The important thing about this guide is that it is not required that your phone is rooted. Then, I repeat it, all works without Rooting your precious smartphone. Unfortunately, this involves that some apps (but not the most important) require the fictitious use of the data connection at least, because you can not install Xposed modules to workaround the stupid limitations of these apps. But this is the lesser evil. Moreover this guide will also work with Android versions from Lollipop onwards.
This guide requires only the built-in Android usb tethering function and a Windows 10 PC and so it works on all Android versions without even the need to install ADB (Android Debug Bridge) on Windows. It uses the free open-source "openvpn" program for Android and Windows. The only limitation is that it only works for a single Android device at a time.
SETUP
Download "openvpn for Windows" from here or from below. Double click on the file you’ve just downloaded to start installation and confirm the Windows security messages.
Make sure all the components are selected during the installation process.
OpenVPN installation components. ESCAPE='HTML'
Click on "Install" again when a message appears as this:
TAP-Windows driver ESCAPE='HTML'
Now you can find “OpenVPN GUI” on the desktop. Right click on “OpenVPN GUI” and go to “Properties”. Go to “Compatibility” tab and make sure in Privilege Level “Run this program as administrator” is selected. Click “Apply” then “OK” and close the window.
Search "Generate a static OpenVPN key" among the installed programs (Start menu --> All apps), right-click on it and "run as adminstrator", then press OK when a black command prompt window appears.
Download the "android.ovpn" file from below:
and copy it in "C:\Program Files\OpenVPN\config".
Now Double click on "OpenVPN GUI" on your desktop to start the program.
Network Connections
Right click on Start menu Windows flag (left bottom corner on the desktop) and select "Network connections" (or if you prefer, right click on the small Monitor icon in system tray and open "Open Network and Sharing Center", then on the left of the new opened window go to "change adapter settings"). Then select the network card that you are using for connecting to Internet and right click on it and open "Properties". Go to "Sharing" tab, select "Allow other network users to connect through this computer's Internet connection" and choose under "Home networking connection" the network adapter name that corresponds to the "TAP-Windows adapter" as you can see in "Network Connections" that you get access as above.
Go to "C:\Program Files\OpenVPN\config", open the file "key.txt" and copy all text in it.
Dowload the "smart.conf" file from below, open it as text file and copy the content of "key.txt" between the last two rows "" "".
Save it and move it to your Android device memory.
Connect your Android device via usb cable to the Windows PC. Enable "USB tethering" on Android (Settings --> Wireless and Networks --> Tethering) and wait untill Windows installs drivers if you need those. Click yes on Windows request to "Allow your PC to be discoverable by other PCs and devices on this network" if it appears.
Now open "Network connections" as above. Then select the "Remote NDIS" network adapter, right click on it and open "Properties". Double click on "Internet Protocol Version 4 (TCP/IPv4)" and set IP as "192.168.42.128", Subnet mask as "255.255.255.0" and Gateway as "192.168.42.129". Click OK and exit.
Set manual IP adress. ESCAPE='HTML'
Check in "Open Network and Sharing Center" (right click on the small Monitor icon in system tray and open "Open Network and Sharing Center") under "View your active networks" that the network which corresponds to the "Remote NDIS" adapter is "private" and not "public".
Windows Networks ESCAPE='HTML'
Network sharing center ESCAPE='HTML'
If it is "public", left click on Start Menu flag (left bottom corner on the desktop), select "Settings", then "Network & Internet", then "Ethernet", select from the right column the ethernet connection that you want to change, then set to "on" the first option "Allow your PC to be discoverable by other PCs and devices on this network...".
Network & Internet
Ethernet Networks
Select right ethernet connection
Set network as private
Disconnect the USB cable.
Install from Google Play Store (or from above) the app "OpenVPN for Android" on your device. Finally open "OpenVPN for Android" and in global "settings" uncheck the option "Reconnect on network change". Then import from the top right icon the file "smart.conf" you had saved earlier. Save the new created profile and later from pencil icon go to "Routing" tab: there select "Use default Routing" in IPv4 menu and exit. Optionally create an "OpenVPN for Android" widget on your home screen that links to your profile. Finished.
RUNNING
Now, to connect your smartphone to internet via lan connection of your Windows PC just follow the following steps. Double click on "OpenVPN GUI" on your Windows desktop (make sure you run the program "as administrator" from right click if you have not already configured it as we said above). On Windows system tray, right click on the OpenVPN icon and press connect.  Finally connect your Android device via usb cable to your PC, enable "USB tethering" in "Settings --> Wireless and Networks --> Tethering" on Android, then temporarily enable your phone data connection (2G/3G/4G) and tap on your "OpenVPN for Android" widget (or on the profile name in "OpenVPN for Android" app). If you read "success" somewhere at the top (log screen), you're OK.
IMPORTANTE: dentro de los ajustes de la app OpenVPN para android hay que quitar la casilla "reconectar en cambio de red", si no la quitamos al deshabilitar datos moviles se desconecta la VPN.

You can then disable phone data connection if you use Browsers such as Chrome or many other app such as WhatsApp. Anyway some apps (as Gmail, Download etc.) check if a wireless connection (WIFI or 3G) is present at boot otherwise they will not start or work, so they require at least data connection enabled to work. Nevertheless all internet traffic is always routed over the usb connection and therefore your data plan is safe. Furthermore, for the same reason, your body is subjected to a considerably lower electromagnetic pollution. Enjoy!
OpenVPN Log ESCAPE='HTML'
OpenVPN stop and pause ESCAPE='HTML'
Note 1: this tutorial assumes that the IP address of your smartphone in USB tethering mode is 192.168.42.129, as it should be. Check this by typing "netcfg" in "android terminal" app of PlayStore and eventually change it accordingly above, together with the 192.168.42.128 address of the "Remote NDIS" interface.
Note 2: If after a smartphone (or tablet) restart the "Remote NDIS" network name changes, set the new one as "private network" again as we explained above, otherwise it will not work anymore.
Note 3: with slight modifications this guide should also work with Windows versions lower than 10.

martes, agosto 06, 2019

CAPTURAR UNA IMAGEN DE WINDOWS 10 DESDE WDS



CAPTURAR UNA IMAGEN DE WINDOWS 10 DESDE WDS






Hola que tal amigos pues en esta ocasión vamos a ver la forma de utilizar Windows Deployment Services con la opción de captura de nuestra imagen de Windows 10.
El escenario a lograr es tener nuestro sistema operativo actualizado de Windows 10 con algunos componentes y características especiales, una vez hecho ese procedimiento podremos capturar la imagen no sin antes haber hecho un sysprep a nuestro sistema operativo. para poder realizar la captura de la misma con WDS.
Para preparar el escenario de WDS lo primero que haremos sera importar nuestro archivo boot.wimdesde nuestra imagen básica de Windows 10 tal y como se muestra a continuación.
Si es la primera vez que utilizamos WDS debemos levantar el servidor de implementacion, dando clic en configurar.
1
Para el tema de configurar el servidor es prácticamente sencillo dando clic en siguiente a la ventana de wizard del mismo.
al finalizar tendremos nuestro servidor listo.
2
Ahora con nuestro .ISO montado de Windows 10, procedemos a inyectar nuestro archivo boot.wimdando clic en Boot Images y agregandolo.
3
Una vez finalizado, tendremos nuestra imagen boot.wim lista.
Ahora vamos a utilizar la opción de captura de imagen, veamos la siguiente.
4
La siguiente pantalla mostrara el comienzo del wizard para la configuración de la captura, para ello vamos a colocar un nombre descriptivo, y la ubicación de nuestra captura. Veamos la imagen.
5
Tiltamos la opcion de agregar y damos clic en siguiente en nuestro wizard.
6
Listo.
7
Ahora vamos a correr nuestro WDS configurado, para poder hacer el despliegue de los archivos, sobre una imagen de Windows 10 previamente configurada y preparada con sysprep.
Windows 10 x64-2016-08-23-19-33-50
una vez apagada la maquina de Windows 10, procedemos a ejecutar nuestro boot PXE de WDS para arrancar en red.
Windows 10 x64-2016-08-23-20-02-19
Nota. para realizar este proceso es importante para este ejemplo si estamos utilizando VMWare es configurar la red en modo Bridge y bootear desde la bios en Network
Damos clic en Imagen de captura, nos aparecerá el wizard, damos clic en siguiente.
Windows 10 x64-2016-08-23-20-04-56
muy importante en la siguiente pantalla debemos de seleccionar el volumen a capturar, este se genera a raíz de correr sysprep en nuestro Windows 10, damos un nombre a la captura y una descripción.
Windows 10 x64-2016-08-23-20-09-03
Seleccionamos en donde se capturara y listo damos clic en siguiente para comenzar el proceso
Windows 10 x64-2016-08-23-20-15-59
Aquí la captura de nuestra imagen de Windows 10
Windows 10 x64-2016-08-23-20-17-35
Utilizando command prompt podemos hacer este procedimiento con la siguiente sintaxis
También podemos realizar un discover de nuestras imagenes de WDS, en otras palabras podemos preparar nuestra imagen para poder realizar un copiado en medios extraibles como USB CD/DVD.
Para ello podemos dar clic derecho en una de nuestras imagenes de booteo para poder despegarlas en los medios antes mencionados
40
Damos clic en nombre de la imagen, la ubicación y el servidor al que se comunicara para el despliegue.
41
42
También una de las opciones que maneja WDS es poder desplegar nuestras imagenes completas de Windows en la sección de imagenes de instalación.
43
Por medio de comandos podemos utilizar la siguiente estructura.
 44

Felices Despliegues