como instalar um adaptador wifi sem marca?

1. como instalar um adaptador wifi sem marca?

erich8
erich8

(usa Ubuntu)

Enviado em 22/02/2017 - 13:19h

tenho um adaptador usb sem marca, com a tampa ele parece um potao e tem a seguinte inscriçao: 360 [caractere chines][caractere chines] wifi2
nao sei como instalar, o lsusb trava com este adaptador o drivers adicionais nao reconhece.

encontrei esta pagina, nao sei si é do adaptador certo.
https://github.com/yajin/360-wifi-linux

e tbm nao sei si tem algo malicioso no codigo que eles deixaram para baixar;

#!/bin/bash

function usage() {
echo "[x] Usage: `basename $0` [360-wifi-interface] [public-network-interface] [password(optional)] "
echo " [360-wifi-interface]: the network interface of 360-wifi, wlan0 for example."
echo " [public-network-interface]: the network interface of public network, eth0 for example."
echo " [password(optional)]: password of your new WIFI network (>=8 bytes). "
exit
}


if [ $# -lt 2 ] || [ $# -gt 3 ] ; then
usage
fi

key=$(echo $RANDOM)$(echo $RANDOM)

if [ $# -eq 3 ]; then
key=$3
fi

if [ ${#key} -lt 8 ]; then
echo "[x] The length of password can not be less than 8."
exit
fi


in_interface=$1
out_interface=$2

WIFI_HOME=~/.360wifi

export LANG='en_US.UTF-8'


#[1] Check whether we have 360 wifi inserted

echo "[*] Checking 360-wifi ... "
result=$(lsusb | grep -E "148f:5370|148f:760b")

if [ $? -ne 0 ]; then
echo "[x] Please insert 360-wifi into the USB interface"
exit
fi

#[2] check whether kernel has CONFIG_RT2800USB_RT53XX configuration
#CONFIG_RT2800USB_RT53XX=y
echo "[*] Checking kernel version ... "

kernel_version=$(uname -r)
# echo $kernel_version

result=$(cat /boot/config-$kernel_version | grep -e "CONFIG_RT2800USB_RT53XX=y")

if [ $? -ne 0 ]; then
echo "[x] Sorry, your kernel version is not currently supported"
exit
fi


# [3] install necessary packages
echo "[*] Installing necessary packages ... "
echo " -->[a] hostapd"
sudo apt-get install hostapd > /dev/null

echo " -->[b] isc-dhcp-server"
sudo apt-get install isc-dhcp-server > /dev/null


# [4] set isc-dhcp-server
echo "[*] Setting isc-dhcp-server ... "
if [ -f /etc/dhcp/dhcpd.$in_interface.conf ]; then
sudo rm /etc/dhcp/dhcpd.$in_interface.conf
fi

ip_prefix=`ifconfig ${out_interface} | grep "inet addr" | awk -F: '{print $2}' | awk -F. '{print $1}'`
case ${ip_prefix} in
"10")
ip_prefix="172.16"
;;
"172")
ip_prefix="192.168"
;;
"192")
ip_prefix="10.0"
;;
"")
echo '!are you sure you have connected to internet'
exit
;;
*)
ip_prefix="10.0"
;;
esac
subnet="${ip_prefix}.9"
echo "default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet ${subnet}.0 netmask 255.255.255.0 {
range ${subnet}.100 ${subnet}.200;
option domain-name-servers 8.8.8.8;
option routers ${subnet}.1;
default-lease-time 600;
max-lease-time 7200;
}" | sudo tee /etc/dhcp/dhcpd.$in_interface.conf > /dev/null
sudo ifconfig $in_interface ${subnet}.1 up
sudo dhcpd -q -cf /etc/dhcp/dhcpd.$in_interface.conf -pf /var/run/dhcp-server/dhcpd.pid $in_interface


echo "[*] Setting iptable ... "
forward=$(cat /proc/sys/net/ipv4/ip_forward)
if [ $forward -eq "0" ]; then
echo " -->[*] Enabling ipv4 forwarding"
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
fi
echo " -->[*] Setting iptables rules"
sudo iptables -F
sudo iptables -t nat -F
sudo iptables -t nat -A POSTROUTING -s ${subnet}.0/24 -o $out_interface -j MASQUERADE
sudo iptables -A FORWARD -s ${subnet}.0/24 -o $out_interface -j ACCEPT
sudo iptables -A FORWARD -d ${subnet}.0/24 -m conntrack --ctstate ESTABLISHED,RELATED -i $out_interface -j ACCEPT

echo "[*] Setting hostapd ... "

ssid=360_FREE_WIFI$RANDOM

echo
echo "**** SSID : $ssid, key: $key. Enjoy! ****"
echo
function clean_up {
echo "[*] Cleaning up ..."
if [ -f /var/run/dhcp-server/dhcpd.pid ]; then
dhcpd_pid=$(cat /var/run/dhcp-server/dhcpd.pid)
sudo kill -9 $dhcpd_pid > /dev/null
# echo $dhcpd_pid
fi
}

trap 'clean_up;echo "Goodbye"' SIGINT SIGTERM SIGQUIT SIGKILL

if [ ! -d $WIFI_HOME ]; then
mkdir $WIFI_HOME
fi

if [ -f $WIFI_HOME/.hostapd.$in_interface.conf ]; then
rm $WIFI_HOME/.hostapd.$in_interface.conf
fi

echo "interface=$in_interface
driver=nl80211
ssid=$ssid
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=$key
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP" | tee $WIFI_HOME/.hostapd.$in_interface.conf > /dev/null

# sudo hostapd $WIFI_HOME/.hostapd.$in_interface.conf -P $WIFI_HOME/.hostapd.$in_interface.pid -B
sudo hostapd $WIFI_HOME/.hostapd.$in_interface.conf > /dev/null



  


2. Re: como instalar um adaptador wifi sem marca?

Mauriciodez
Mauriciodez

(usa Debian)

Enviado em 22/02/2017 - 13:28h

erich8 escreveu:
encontrei esta pagina, nao sei si é do adaptador certo.


Se vc que está com o adaptador nas mãos não sabe, imagine a gente que nem vimos o meliante !!!

1 - Nós não temos bola de cristal e nem a espada de thundera pra ver o equipamento de vc's não, então se vc quer ajuda o mínimo que tem que fazer é postar a foto da parada.

2 - o script a princípio não tem nada de malicioso ao meu ver ... então eu acho q vc deveria executar ele e ver se é o certo ou não .. o máximo que vai acontecer é continuar sem funcionar !!!
_______________________________________________________________
" Nem sempre é amigo aquele que te tira do buraco !!! ( Saddam Hussein )"


3. Re: como instalar um adaptador wifi sem marca?

Clodoaldo Santos
clodoaldops

(usa Linux Mint)

Enviado em 22/02/2017 - 16:34h

-já tentou reiniciar pc com adapatdor wifi-usb já conectado no pc?

-seria muito util a saída do comando: lsusb



4. Re: como instalar um adaptador wifi sem marca?

Perfil removido
removido

(usa Nenhuma)

Enviado em 07/04/2017 - 13:15h

erich8 escreveu:

tenho um adaptador usb sem marca, com a tampa ele parece um potao e tem a seguinte inscriçao: 360 [caractere chines][caractere chines] wifi2
nao sei como instalar, o lsusb trava com este adaptador o drivers adicionais nao reconhece.

encontrei esta pagina, nao sei si é do adaptador certo.
https://github.com/yajin/360-wifi-linux

e tbm nao sei si tem algo malicioso no codigo que eles deixaram para baixar;

#!/bin/bash

function usage() {
echo "[x] Usage: `basename $0` [360-wifi-interface] [public-network-interface] [password(optional)] "
echo " [360-wifi-interface]: the network interface of 360-wifi, wlan0 for example."
echo " [public-network-interface]: the network interface of public network, eth0 for example."
echo " [password(optional)]: password of your new WIFI network (>=8 bytes). "
exit
}


if [ $# -lt 2 ] || [ $# -gt 3 ] ; then
usage
fi

key=$(echo $RANDOM)$(echo $RANDOM)

if [ $# -eq 3 ]; then
key=$3
fi

if [ ${#key} -lt 8 ]; then
echo "[x] The length of password can not be less than 8."
exit
fi


in_interface=$1
out_interface=$2

WIFI_HOME=~/.360wifi

export LANG='en_US.UTF-8'


#[1] Check whether we have 360 wifi inserted

echo "[*] Checking 360-wifi ... "
result=$(lsusb | grep -E "148f:5370|148f:760b")

if [ $? -ne 0 ]; then
echo "[x] Please insert 360-wifi into the USB interface"
exit
fi

#[2] check whether kernel has CONFIG_RT2800USB_RT53XX configuration
#CONFIG_RT2800USB_RT53XX=y
echo "[*] Checking kernel version ... "

kernel_version=$(uname -r)
# echo $kernel_version

result=$(cat /boot/config-$kernel_version | grep -e "CONFIG_RT2800USB_RT53XX=y")

if [ $? -ne 0 ]; then
echo "[x] Sorry, your kernel version is not currently supported"
exit
fi


# [3] install necessary packages
echo "[*] Installing necessary packages ... "
echo " -->[a] hostapd"
sudo apt-get install hostapd > /dev/null

echo " -->[b] isc-dhcp-server"
sudo apt-get install isc-dhcp-server > /dev/null


# [4] set isc-dhcp-server
echo "[*] Setting isc-dhcp-server ... "
if [ -f /etc/dhcp/dhcpd.$in_interface.conf ]; then
sudo rm /etc/dhcp/dhcpd.$in_interface.conf
fi

ip_prefix=`ifconfig ${out_interface} | grep "inet addr" | awk -F: '{print $2}' | awk -F. '{print $1}'`
case ${ip_prefix} in
"10")
ip_prefix="172.16"
;;
"172")
ip_prefix="192.168"
;;
"192")
ip_prefix="10.0"
;;
"")
echo '!are you sure you have connected to internet'
exit
;;
*)
ip_prefix="10.0"
;;
esac
subnet="${ip_prefix}.9"
echo "default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet ${subnet}.0 netmask 255.255.255.0 {
range ${subnet}.100 ${subnet}.200;
option domain-name-servers 8.8.8.8;
option routers ${subnet}.1;
default-lease-time 600;
max-lease-time 7200;
}" | sudo tee /etc/dhcp/dhcpd.$in_interface.conf > /dev/null
sudo ifconfig $in_interface ${subnet}.1 up
sudo dhcpd -q -cf /etc/dhcp/dhcpd.$in_interface.conf -pf /var/run/dhcp-server/dhcpd.pid $in_interface


echo "[*] Setting iptable ... "
forward=$(cat /proc/sys/net/ipv4/ip_forward)
if [ $forward -eq "0" ]; then
echo " -->[*] Enabling ipv4 forwarding"
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
fi
echo " -->[*] Setting iptables rules"
sudo iptables -F
sudo iptables -t nat -F
sudo iptables -t nat -A POSTROUTING -s ${subnet}.0/24 -o $out_interface -j MASQUERADE
sudo iptables -A FORWARD -s ${subnet}.0/24 -o $out_interface -j ACCEPT
sudo iptables -A FORWARD -d ${subnet}.0/24 -m conntrack --ctstate ESTABLISHED,RELATED -i $out_interface -j ACCEPT

echo "[*] Setting hostapd ... "

ssid=360_FREE_WIFI$RANDOM

echo
echo "**** SSID : $ssid, key: $key. Enjoy! ****"
echo
function clean_up {
echo "[*] Cleaning up ..."
if [ -f /var/run/dhcp-server/dhcpd.pid ]; then
dhcpd_pid=$(cat /var/run/dhcp-server/dhcpd.pid)
sudo kill -9 $dhcpd_pid > /dev/null
# echo $dhcpd_pid
fi
}

trap 'clean_up;echo "Goodbye"' SIGINT SIGTERM SIGQUIT SIGKILL

if [ ! -d $WIFI_HOME ]; then
mkdir $WIFI_HOME
fi

if [ -f $WIFI_HOME/.hostapd.$in_interface.conf ]; then
rm $WIFI_HOME/.hostapd.$in_interface.conf
fi

echo "interface=$in_interface
driver=nl80211
ssid=$ssid
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=$key
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP" | tee $WIFI_HOME/.hostapd.$in_interface.conf > /dev/null

# sudo hostapd $WIFI_HOME/.hostapd.$in_interface.conf -P $WIFI_HOME/.hostapd.$in_interface.pid -B
sudo hostapd $WIFI_HOME/.hostapd.$in_interface.conf > /dev/null







Qual a saída dos comandos?

sudo update-usbids

sudo lsusb

sudo lsusb -v

sudo uname -a

sudo dmesg


sudo dmesg | grep -i firmware

sudo dmesg | grep -i error

sudo dmesg | grep -i failed

sudo lsmod

sudo ps aux


sudo rfkill list all







Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts