script v0.1
This commit is contained in:
		
							
								
								
									
										9
									
								
								applications/android-wifi/android-wifi.desktop
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								applications/android-wifi/android-wifi.desktop
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| [Desktop Entry] | ||||
| Name=Android WiFi | ||||
| Comment=Mirror and control Android devices over Wi-Fi | ||||
| Exec=/home/valere/.local/bin/android-wifi.sh | ||||
| Icon=/home/valere/.local/share/icons/android-wifi.svg | ||||
| Terminal=false | ||||
| Type=Application | ||||
| Categories=Utility; | ||||
| StartupNotify=true | ||||
							
								
								
									
										66
									
								
								applications/android-wifi/android-wifi.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								applications/android-wifi/android-wifi.sh
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| LOG=/tmp/android-wifi.log | ||||
| echo "===== $(date) =====" >> "$LOG" | ||||
|  | ||||
| # Vérifier adb | ||||
| if ! command -v adb >/dev/null 2>&1; then | ||||
|   echo "adb non trouvé dans le PATH" >> "$LOG" | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| # Vérifier scrcpy | ||||
| if ! command -v scrcpy >/dev/null 2>&1; then | ||||
|   echo "scrcpy non trouvé dans le PATH" >> "$LOG" | ||||
|   exit 1 | ||||
| fi | ||||
|  | ||||
| # Chercher device TCP existant | ||||
| TCP_DEVICE=$(adb devices | awk '$1 ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+:5555$/ {print $1}') | ||||
|  | ||||
| if [ -n "$TCP_DEVICE" ]; then | ||||
|     # Device Wi-Fi déjà actif | ||||
|     echo "Device TCP déjà actif: $TCP_DEVICE" >> "$LOG" | ||||
|     IP="$TCP_DEVICE" | ||||
| else | ||||
|     # Récupérer un device USB | ||||
|     USB_ID=$(adb devices | awk 'NR>1 && $2=="device" && $1 !~ /:/ {print $1; exit}') | ||||
|     if [ -z "$USB_ID" ]; then | ||||
|         echo "Aucun device USB détecté" >> "$LOG" | ||||
|         exit 1 | ||||
|     fi | ||||
|     echo "Device USB détecté: $USB_ID" >> "$LOG" | ||||
|  | ||||
|     # Récupérer IP via USB | ||||
|     IP=$(adb -s "$USB_ID" shell ip addr show wlan0 2>>"$LOG" | grep 'inet ' | awk '{print $2}' | cut -d/ -f1) | ||||
|     if [ -z "$IP" ]; then | ||||
|         echo "Impossible de récupérer l'IP du téléphone (wlan0 introuvable)" >> "$LOG" | ||||
|         exit 1 | ||||
|     fi | ||||
|     echo "IP détectée: $IP" >> "$LOG" | ||||
|  | ||||
|     # Passer en mode TCP | ||||
|     echo "[+] Passage en mode TCP 5555" >> "$LOG" | ||||
|     adb -s "$USB_ID" tcpip 5555 >> "$LOG" 2>&1 | ||||
|  | ||||
|     # Connexion Wi-Fi | ||||
|     echo "[+] Connexion à $IP:5555" >> "$LOG" | ||||
|     adb connect "$IP:5555" >> "$LOG" 2>&1 | ||||
|  | ||||
|     # Déconnecter USB pour éviter conflit multiple devices | ||||
|     echo "[+] Déconnexion du device USB $USB_ID" >> "$LOG" | ||||
|     adb disconnect "$USB_ID" >> "$LOG" 2>&1 | ||||
| fi | ||||
|  | ||||
| # Attendre que le device TCP soit prêt | ||||
| echo "[+] Attente du device TCP $IP" >> "$LOG" | ||||
| while ! adb devices | grep -q "$IP.*device"; do | ||||
|     sleep 1 | ||||
| done | ||||
| echo "[+] Device TCP prêt" >> "$LOG" | ||||
|  | ||||
| # Lancer scrcpy | ||||
| echo "[+] Lancement de scrcpy sur $IP" >> "$LOG" | ||||
| scrcpy -s "$IP" >> "$LOG" 2>&1 | ||||
|  | ||||
| echo "[✓] Fin du script" >> "$LOG" | ||||
							
								
								
									
										16
									
								
								applications/android-wifi/android-wifi.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								applications/android-wifi/android-wifi.svg
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | ||||
| <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" version="1.1"> | ||||
|  <path style="opacity:0.2" d="m 16.846877,12 c -1.116351,0 -2.227419,0.912229 -2.015075,2 l 3.122973,16 -5.596557,11.109375 C 11.959876,41.871734 11.885244,42.336988 12.177176,43 c 0.278672,0.632897 0.998812,1 1.747448,1 H 24 34.075375 c 0.748637,0 1.468777,-0.367103 1.747448,-1 0.291932,-0.663012 0.217302,-1.128266 -0.181041,-1.890625 L 30.045225,30 33.168198,14 c 0.212344,-1.087771 -0.898724,-2 -2.015075,-2 H 24 Z"/> | ||||
|  <path style="fill:#cccccc" d="m 16.846877,11 c -1.116351,0 -2.227419,0.912229 -2.015075,2 l 3.122973,16 -5.596557,11.109375 C 11.959876,40.871734 11.885244,41.336988 12.177176,42 c 0.278672,0.632897 0.998812,1 1.747448,1 H 24 34.075375 c 0.748637,0 1.468777,-0.367103 1.747448,-1 0.291932,-0.663012 0.217302,-1.128266 -0.181041,-1.890625 L 30.045225,29 33.168198,13 c 0.212344,-1.087771 -0.898724,-2 -2.015075,-2 H 24 Z"/> | ||||
|  <rect style="opacity:0.2" width="40" height="32" x="4" y="6" rx="2" ry="2"/> | ||||
|  <path style="fill:#e4e4e4" d="m 4,33 v 2 c 0,1.108 0.892,2 2,2 h 36 c 1.108,0 2,-0.892 2,-2 v -2 z"/> | ||||
|  <path style="opacity:0.1" d="m 11.494141,15 a 1.5,1.5 0 0 0 -0.832032,0.255859 1.5,1.5 0 0 0 -0.40625,2.082032 l 3.13086,4.654297 C 10.404945,24.606192 8.4012371,28.299159 8.0019531,32.460938 7.9284599,34.000879 9.5546875,34 9.5546875,34 H 38.40625 c 0,0 1.672856,-3.38e-4 1.591797,-1.617188 -0.416529,-4.131451 -2.415618,-7.796833 -5.380859,-10.394531 l 3.126953,-4.65039 a 1.5,1.5 0 0 0 -0.40625,-2.082032 1.5,1.5 0 0 0 -1.125,-0.228515 1.5,1.5 0 0 0 -0.957032,0.634765 l -3.072265,4.566407 C 29.78649,18.814887 26.990024,18 24.001953,18 c -2.989385,0 -5.786177,0.815488 -8.183594,2.230469 l -3.074218,-4.56836 A 1.5,1.5 0 0 0 11.787109,15.027344 1.5,1.5 0 0 0 11.494141,15 Z"/> | ||||
|  <path style="fill:#077063" d="M 6,5 C 4.892,5 4,5.892 4,7 V 33 H 44 V 7 C 44,5.892 43.108,5 42,5 Z"/> | ||||
|  <path style="opacity:0.1;fill:#ffffff" d="M 6,5 C 4.892,5 4,5.892 4,7 V 8 C 4,6.892 4.892,6 6,6 h 36 c 1.108,0 2,0.892 2,2 V 7 C 44,5.892 43.108,5 42,5 Z"/> | ||||
|  <path style="fill:none;stroke:#30dd81;stroke-width:3;stroke-linecap:round" d="M 15.1998,21.000026 11.5,15.5"/> | ||||
|  <path style="fill:none;stroke:#30dd81;stroke-width:3;stroke-linecap:round" d="M 32.799764,21.000026 36.5,15.5"/> | ||||
|  <path style="fill:#30dd81" d="m 24.002386,17.000034 c -8.355868,0 -15.2214979,6.346843 -15.9999669,14.460906 C 7.9289259,33.000882 9.5544999,33 9.5544999,33 H 38.406003 c 0,0 1.672201,-3.35e-4 1.591142,-1.617185 C 39.182807,23.305596 32.331836,17.000034 24.002386,17.000034 Z"/> | ||||
|  <path style="opacity:0.2" d="m 16,25 a 1.9999959,1.9999959 0 0 0 -2,2 1.9999959,1.9999959 0 0 0 2,2 1.9999959,1.9999959 0 0 0 2,-2 1.9999959,1.9999959 0 0 0 -2,-2 z m 16,0 a 1.9999959,1.9999959 0 0 0 -2,2 1.9999959,1.9999959 0 0 0 2,2 1.9999959,1.9999959 0 0 0 2,-2 1.9999959,1.9999959 0 0 0 -2,-2 z"/> | ||||
|  <path style="fill:#ffffff" d="M 15.999996,24.000008 A 1.9999959,1.9999959 0 0 1 17.999992,26.000004 1.9999959,1.9999959 0 0 1 15.999996,28 1.9999959,1.9999959 0 0 1 14,26.000004 1.9999959,1.9999959 0 0 1 15.999996,24.000008 Z"/> | ||||
|  <path style="fill:#ffffff" d="M 31.999996,24.000008 A 1.9999959,1.9999959 0 0 1 33.999991,26.000004 1.9999959,1.9999959 0 0 1 31.999996,28 1.9999959,1.9999959 0 0 1 30,26.000004 1.9999959,1.9999959 0 0 1 31.999996,24.000008 Z"/> | ||||
|  <path style="fill:#ffffff;opacity:0.2" d="M 11.494141 14 A 1.5 1.5 0 0 0 10.662109 14.255859 A 1.5 1.5 0 0 0 10.115234 16.001953 A 1.5 1.5 0 0 1 10.662109 15.255859 A 1.5 1.5 0 0 1 11.494141 15 A 1.5 1.5 0 0 1 11.787109 15.027344 A 1.5 1.5 0 0 1 12.744141 15.662109 L 15.818359 20.230469 C 18.215776 18.815488 21.012568 18 24.001953 18 C 26.990024 18 29.78649 18.814887 32.183594 20.228516 L 35.255859 15.662109 A 1.5 1.5 0 0 1 36.212891 15.027344 A 1.5 1.5 0 0 1 37.337891 15.255859 A 1.5 1.5 0 0 1 37.910156 16.001953 A 1.5 1.5 0 0 0 37.337891 14.255859 A 1.5 1.5 0 0 0 36.212891 14.027344 A 1.5 1.5 0 0 0 35.255859 14.662109 L 32.183594 19.228516 C 29.78649 17.814887 26.990024 17 24.001953 17 C 21.012568 17 18.215776 17.815488 15.818359 19.230469 L 12.744141 14.662109 A 1.5 1.5 0 0 0 11.787109 14.027344 A 1.5 1.5 0 0 0 11.494141 14 z M 35.033203 21.369141 L 34.617188 21.988281 C 37.477056 24.493668 39.433905 27.993356 39.943359 31.945312 C 39.986866 31.783283 40.008864 31.598575 39.998047 31.382812 C 39.601372 27.448291 37.768055 23.938648 35.033203 21.369141 z M 12.970703 21.373047 C 10.220358 23.959215 8.3822757 27.496796 8.0019531 31.460938 C 7.9920657 31.668114 8.0150508 31.844846 8.0585938 32 C 8.5570234 28.027243 10.515755 24.509049 13.386719 21.992188 L 12.970703 21.373047 z"/> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 4.5 KiB | 
		Reference in New Issue
	
	Block a user