Enviado em 09/01/2015 - 14:04h
Preciso fazer um script onde é enviado um comando no terminal e que depois trate o retorno, parâmetro por parâmetro. A primeira parte eu consegui fazer, o comando roda, mas a intenção é que o comando rode e depois de encerrado jogue o resultado pra uma variável para fazer comparações. Por exemplo:Enviado em 09/01/2015 - 14:27h
Enviado em 09/01/2015 - 14:51h
#cat /proc/cpuinfo | grep -i "model name" >> set vargb && export $vargb
Enviado em 09/01/2015 - 15:05h
Verifique se é mais ou menos isto o que procura:while IFS=':' read key value; do echo "key = '$key'; value = '$value'" done < <(sed 's/\s\+:\s\+/:/' /proc/cpuinfo)
Enviado em 09/01/2015 - 16:43h
Então fiz desse jeito seu mas me parece estar com erro de sintaxe. Tirei os ";" e identei tudo. Mesmo assim ele não ta jogando pra variável. Ta dando esse erro aqui o:#!/bin/bash echo "Inicializando placa de rede no modo promiscuo..." airmon-ng start wlan0 echo "Verificando roteadores disponíveis..." i=0 while read line do echo [$((++i))]: $line done < airodump-ng mon0
((i = 0)); while read line; do echo [$((++i))]: $line; done </proc/cpuinfo
Enviado em 09/01/2015 - 16:50h
Não entendi esse código seu. Nunca trabalhei com o sed, mas eu quero pegar, ou seja, listar todos os parâmetros do retorno do comando, pra depois identificar e trabalhar com ele.while IFS=':' read key value; do echo "key = '$key'; value = '$value'" done < <(sed 's/\s\+:\s\+/:/' /proc/cpuinfo)
Enviado em 09/01/2015 - 21:37h
key = 'processor'; value = '0' key = 'vendor_id'; value = 'GenuineIntel' key = 'cpu family'; value = '6' key = 'model'; value = '37' key = 'model name'; value = 'Intel(R) Core(TM) i5 CPU M 460 @ 2.53GHz' key = 'stepping'; value = '5' key = 'microcode'; value = '0x2' key = 'cpu MHz'; value = '1197.000' key = 'cache size'; value = '3072 KB' key = 'physical id'; value = '0' key = 'siblings'; value = '4' key = 'core id'; value = '0' key = 'cpu cores'; value = '2' key = 'apicid'; value = '0' key = 'initial apicid'; value = '0' key = 'fdiv_bug'; value = 'no' key = 'f00f_bug'; value = 'no' key = 'coma_bug'; value = 'no' key = 'fpu'; value = 'yes' key = 'fpu_exception'; value = 'yes' key = 'cpuid level'; value = '11'
Enviado em 12/01/2015 - 17:15h
Minha real intenção é de pegar dados dos roteadores que estão na rede para fazer testes. O comando é o airodump-ng que gera a seguinte saída:BSSID PWR Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID 00:24:6C:5B:5E:B1 -87 8 0 0 1 54e. OPN UFU-P 00:24:6C:5B:5E:B0 -87 8 1 0 1 54e. WPA2 CCMP MGT UFU-I 00:1A:1E:7A:CF:E1 -83 14 0 0 1 54e. OPN UFU-P 00:1A:1E:7A:CF:E0 -82 11 0 0 1 54e. WPA2 CCMP MGT UFU-I 00:1A:1E:7A:C9:01 -44 27 8 3 1 54e. OPN UFU-P 00:1A:1E:7A:C9:00 -45 27 0 0 1 54e. WPA2 CCMP MGT UFU-Iu u BSSID STATION PWR Rate Lost Packets Probes u (not associated) CC:C3:EA:D1:FD:57 -88 0 -12 2 2 (not associated) 14:2D:27:E2:63:FF -75 0 -12 19 3 UFU-Institu (not associated) F4:8E:09:0B:C4:ED -87 0 -12 0 1 UFU-Institu 00:1A:1E:7A:C9:01 B4:52:7E:AA:4A:2B -72 0 - 9 0 1 00:1A:1E:7A:C9:01 68:A3:C4:3F:AC:87 0 9e- 0e 0 9 00:1A:1E:7A:C9:00 A8:8E:24:3C:65:2D -77 0 - 9 0 1
while IFS=':' read key value; do echo "key = $key; value = $value" done << sed s/\s\+:\s\+/:/ airodump-ng
sudo airodump-ng mon0 >> saida.txt
key = 'processor'; value = '0' key = 'vendor_id'; value = 'GenuineIntel' key = 'cpu family'; value = '6' key = 'model'; value = '37' key = 'model name'; value = 'Intel(R) Core(TM) i5 CPU M 460 @ 2.53GHz' key = 'stepping'; value = '5' key = 'microcode'; value = '0x2' key = 'cpu MHz'; value = '1197.000' key = 'cache size'; value = '3072 KB' key = 'physical id'; value = '0' key = 'siblings'; value = '4' key = 'core id'; value = '0' key = 'cpu cores'; value = '2' key = 'apicid'; value = '0' key = 'initial apicid'; value = '0' key = 'fdiv_bug'; value = 'no' key = 'f00f_bug'; value = 'no' key = 'coma_bug'; value = 'no' key = 'fpu'; value = 'yes' key = 'fpu_exception'; value = 'yes' key = 'cpuid level'; value = '11'
Enviado em 12/01/2015 - 17:53h
BSSID PWR Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID 00:24:6C:5B:5E:B1 -87 8 0 0 1 54e. OPN UFU-P 00:24:6C:5B:5E:B0 -87 8 1 0 1 54e. WPA2 CCMP MGT UFU-I 00:1A:1E:7A:CF:E1 -83 14 0 0 1 54e. OPN UFU-P 00:1A:1E:7A:CF:E0 -82 11 0 0 1 54e. WPA2 CCMP MGT UFU-I 00:1A:1E:7A:C9:01 -44 27 8 3 1 54e. OPN UFU-P 00:1A:1E:7A:C9:00 -45 27 0 0 1 54e. WPA2 CCMP MGT UFU-Iu u BSSID STATION PWR Rate Lost Packets Probes u (not associated) CC:C3:EA:D1:FD:57 -88 0 -12 2 2 (not associated) 14:2D:27:E2:63:FF -75 0 -12 19 3 UFU-Institu (not associated) F4:8E:09:0B:C4:ED -87 0 -12 0 1 UFU-Institu 00:1A:1E:7A:C9:01 B4:52:7E:AA:4A:2B -72 0 - 9 0 1 00:1A:1E:7A:C9:01 68:A3:C4:3F:AC:87 0 9e- 0e 0 9 00:1A:1E:7A:C9:00 A8:8E:24:3C:65:2D -77 0 - 9 0 1
Enviado em 13/01/2015 - 08:26h
Eu queria pegar somente o BSSID da rede, ou seja, o nome dela. E feito isso comparar dentro de estruturas condicionais(if, swtch etc). Tem como fazer isso usando bash?BSSID PWR Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID 00:24:6C:5B:5E:B1 -87 8 0 0 1 54e. OPN UFU-P 00:24:6C:5B:5E:B0 -87 8 1 0 1 54e. WPA2 CCMP MGT UFU-I 00:1A:1E:7A:CF:E1 -83 14 0 0 1 54e. OPN UFU-P 00:1A:1E:7A:CF:E0 -82 11 0 0 1 54e. WPA2 CCMP MGT UFU-I 00:1A:1E:7A:C9:01 -44 27 8 3 1 54e. OPN UFU-P 00:1A:1E:7A:C9:00 -45 27 0 0 1 54e. WPA2 CCMP MGT UFU-Iu u BSSID STATION PWR Rate Lost Packets Probes u (not associated) CC:C3:EA:D1:FD:57 -88 0 -12 2 2 (not associated) 14:2D:27:E2:63:FF -75 0 -12 19 3 UFU-Institu (not associated) F4:8E:09:0B:C4:ED -87 0 -12 0 1 UFU-Institu 00:1A:1E:7A:C9:01 B4:52:7E:AA:4A:2B -72 0 - 9 0 1 00:1A:1E:7A:C9:01 68:A3:C4:3F:AC:87 0 9e- 0e 0 9 00:1A:1E:7A:C9:00 A8:8E:24:3C:65:2D -77 0 - 9 0 1
Enviado em 13/01/2015 - 10:38h
BSSID PWR Beacons #Data, #/s CH MB ENC CIPHER AUTH ESSID 00:24:6C:5B:5E:B1 -87 8 0 0 1 54e. OPN UFU-P 00:24:6C:5B:5E:B0 -87 8 1 0 1 54e. WPA2 CCMP MGT UFU-I 00:1A:1E:7A:CF:E1 -83 14 0 0 1 54e. OPN UFU-P 00:1A:1E:7A:CF:E0 -82 11 0 0 1 54e. WPA2 CCMP MGT UFU-I 00:1A:1E:7A:C9:01 -44 27 8 3 1 54e. OPN UFU-P 00:1A:1E:7A:C9:00 -45 27 0 0 1 54e. WPA2 CCMP MGT UFU-Iu u BSSID STATION PWR Rate Lost Packets Probes u (not associated) CC:C3:EA:D1:FD:57 -88 0 -12 2 2 (not associated) 14:2D:27:E2:63:FF -75 0 -12 19 3 UFU-Institu (not associated) F4:8E:09:0B:C4:ED -87 0 -12 0 1 UFU-Institu 00:1A:1E:7A:C9:01 B4:52:7E:AA:4A:2B -72 0 - 9 0 1 00:1A:1E:7A:C9:01 68:A3:C4:3F:AC:87 0 9e- 0e 0 9 00:1A:1E:7A:C9:00 A8:8E:24:3C:65:2D -77 0 - 9 0 1
tux-gpt - Assistente de IA para o Terminal
Instalação e configuração do Chrony
Programa IRPF - Guia de Instalação e Resolução de alguns Problemas
Como instalar no Linux Jogos da Steam só para Windows
Instalando o Team Viewer no Debian Trixie - problema no Policykit
O Que Fazer Após Instalar Ubuntu 25.04
Atalhos duplicados (sobras de instalações anteriores) (0)
Copiar Layout do Teclado para aplicar em outra Distribuição (9)