Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- #########
- # Copyright (c) <year> <copyright holders>
- #
- # Permission is hereby granted, free of charge, to any person obtaining a copy
- # of this software and associated documentation files (the "Software"), to deal
- # in the Software without restriction, including without limitation the rights
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- # copies of the Software, and to permit persons to whom the Software is
- # furnished to do so, subject to the following conditions:
- #
- # The above copyright notice and this permission notice shall be included in all
- # copies or substantial portions of the Software.
- #
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- # SOFTWARE.
- ########
- conf_path="/etc/NetworkManager/system-connections"
- conf_name="NUwave"
- if [ -z "$1" ]; then
- conf_name="$1"
- fi
- if [ $(whoami) != "root" ]; then
- echo 'error: must be root'
- exit 1
- fi
- ifaces=$(ifconfig | grep -vE '^ ' | grep -E '[a-z0-9]' | awk '{ print $1 }' | sed ':a;N;$!ba;s/\n/ /g')
- read -p 'MyNEU username: ' wifi_user
- read -p 'MyNEU password: ' wifi_pass
- read -p "interface [$ifaces]: " wifi_if
- uuid=$(cat /proc/sys/kernel/random/uuid)
- mac=$(ifconfig | grep $wifi_if | awk '{ print $5 }')
- if [ -z "$mac" ]; then
- echo 'error: no MAC found for interface' $wifi_if
- exit 1
- fi
- conf="[connection]
- id=NUwave
- uuid=$uuid
- type=wifi
- permissions=
- secondaries=
- [wifi]
- hidden=true
- mac-address=$mac
- mac-address-blacklist=
- mac-address-randomization=0
- mode=infrastructure
- seen-bssids=
- ssid=NUwave
- [wifi-security]
- auth-alg=open
- group=
- key-mgmt=wpa-eap
- pairwise=
- proto=
- [802-1x]
- altsubject-matches=
- eap=peap;
- identity=$wifi_user
- password=$wifi_pass
- phase2-altsubject-matches=
- phase2-auth=mschapv2
- [ipv4]
- dns-search=
- method=auto
- [ipv6]
- addr-gen-mode=stable-privacy
- dns-search=
- method=auto"
- nuwave_file="$conf_path"/"$conf_name"
- echo "$conf" > $nuwave_file
- chown root:root $nuwave_file
- chmod 600 $nuwave_file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement