nanonote-TLWR11U/data/conf/config.minimal |
| 1 | # |
| 2 | # This file must be copied to .config in the OpenWrt root folder, |
| 3 | # then run: yes "" | make oldconfig > /dev/null |
| 4 | # |
| 5 | |
| 6 | CONFIG_TARGET_ar71xx=y |
| 7 | CONFIG_TARGET_ar71xx_generic=y |
| 8 | CONFIG_TARGET_ar71xx_generic_TLWR703=y |
| 9 | |
| 10 | CONFIG_TARGET_ROOTFS_TARGZ=y |
| 11 | CONFIG_TARGET_ROOTFS_JFFS2=y |
| 12 | CONFIG_TARGET_ROOTFS_SQUASHFS=y |
| 13 | |
| 14 | # CONFIG_BUILD_PATENTED is not set |
| 15 | |
| 16 | CONFIG_DEVEL=y |
| 17 | CONFIG_TOOLCHAINOPTS=y |
| 18 | CONFIG_GDB=y |
| 19 | |
| 20 | # CONFIG_SDK is not set |
| 21 | |
| 22 | # CONFIG_ALL is not set |
| 23 | # Enable this option only you want build ALL PAKCAGE in feeds.conf |
| 24 | # To skip broken module packages while compiling , run "make IGNORE_ERRORS=m" |
| 25 | |
| 26 | CONFIG_PACKAGE_block-mount=y |
| 27 | |
| 28 | CONFIG_PACKAGE_luci=y |
| 29 | CONFIG_PACKAGE_luci-mod-admin-core=y |
| 30 | CONFIG_PACKAGE_luci-mod-admin-full=y |
| 31 | CONFIG_PACKAGE_luci-mod-rpc=y |
| 32 | |
| 33 | CONFIG_PACKAGE_kmod-fs-ext4=y |
| 34 | CONFIG_PACKAGE_kmod-ipv6=m |
| 35 | CONFIG_PACKAGE_kmod-tun=m |
| 36 | |
| 37 | CONFIG_PACKAGE_kmod-usb-core=y |
| 38 | CONFIG_PACKAGE_kmod-usb-serial=m |
| 39 | CONFIG_PACKAGE_kmod-usb-serial-ftdi=m |
| 40 | CONFIG_PACKAGE_kmod-usb-serial-pl2303=m |
| 41 | CONFIG_PACKAGE_kmod-usb-storage=y |
| 42 | CONFIG_PACKAGE_kmod-usb2=y |
| 43 | CONFIG_PACKAGE_kmod-video-core=m |
| 44 | CONFIG_PACKAGE_kmod-video-uvc=m |
| 45 | CONFIG_PACKAGE_kmod-video-videobuf2=m |
| 46 | CONFIG_PACKAGE_kmod-at86rf230=m |
| 47 | CONFIG_PACKAGE_kmod-ieee802154=m |
| 48 | CONFIG_PACKAGE_kmod-mac802154=m |
| 49 | CONFIG_PACKAGE_kmod-spi_atusb=m |
| 50 | |
| 51 | CONFIG_PACKAGE_ip=m |
| 52 | CONFIG_PACKAGE_dirtpan=m |
| 53 | CONFIG_PACKAGE_lowpan-tools=m |
| 54 | CONFIG_PACKAGE_mjpg-streamer=m |
| 55 | CONFIG_PACKAGE_swap-utils=y |
| 56 | CONFIG_PACKAGE_mount-utils=m |
| 57 | CONFIG_PACKAGE_strace=m |
| 58 | CONFIG_PACKAGE_urjtag=m |
| 59 | CONFIG_PACKAGE_xburst-tools=m |
nanonote-TLWR11U/files/etc/config/firewall |
| 1 | |
| 2 | config defaults |
| 3 | option syn_flood '1' |
| 4 | option input 'ACCEPT' |
| 5 | option output 'ACCEPT' |
| 6 | option forward 'REJECT' |
| 7 | |
| 8 | config zone |
| 9 | option name 'lan' |
| 10 | option input 'ACCEPT' |
| 11 | option output 'ACCEPT' |
| 12 | option forward 'REJECT' |
| 13 | option network 'lan USB' |
| 14 | |
| 15 | config zone |
| 16 | option name 'wan' |
| 17 | option input 'REJECT' |
| 18 | option output 'ACCEPT' |
| 19 | option forward 'REJECT' |
| 20 | option masq '1' |
| 21 | option mtu_fix '1' |
| 22 | option network 'wan wwan' |
| 23 | |
| 24 | config forwarding |
| 25 | option src 'lan' |
| 26 | option dest 'wan' |
| 27 | |
| 28 | config rule |
| 29 | option name 'Allow-DHCP-Renew' |
| 30 | option src 'wan' |
| 31 | option proto 'udp' |
| 32 | option dest_port '68' |
| 33 | option target 'ACCEPT' |
| 34 | option family 'ipv4' |
| 35 | |
| 36 | config rule |
| 37 | option name 'Allow-Ping' |
| 38 | option src 'wan' |
| 39 | option proto 'icmp' |
| 40 | option icmp_type 'echo-request' |
| 41 | option family 'ipv4' |
| 42 | option target 'ACCEPT' |
| 43 | |
| 44 | config rule |
| 45 | option name 'Allow-DHCPv6' |
| 46 | option src 'wan' |
| 47 | option proto 'udp' |
| 48 | option src_ip 'fe80::/10' |
| 49 | option src_port '547' |
| 50 | option dest_ip 'fe80::/10' |
| 51 | option dest_port '546' |
| 52 | option family 'ipv6' |
| 53 | option target 'ACCEPT' |
| 54 | |
| 55 | config rule |
| 56 | option name 'Allow-ICMPv6-Input' |
| 57 | option src 'wan' |
| 58 | option proto 'icmp' |
| 59 | list icmp_type 'echo-request' |
| 60 | list icmp_type 'destination-unreachable' |
| 61 | list icmp_type 'packet-too-big' |
| 62 | list icmp_type 'time-exceeded' |
| 63 | list icmp_type 'bad-header' |
| 64 | list icmp_type 'unknown-header-type' |
| 65 | list icmp_type 'router-solicitation' |
| 66 | list icmp_type 'neighbour-solicitation' |
| 67 | option limit '1000/sec' |
| 68 | option family 'ipv6' |
| 69 | option target 'ACCEPT' |
| 70 | |
| 71 | config rule |
| 72 | option name 'Allow-ICMPv6-Forward' |
| 73 | option src 'wan' |
| 74 | option dest '*' |
| 75 | option proto 'icmp' |
| 76 | list icmp_type 'echo-request' |
| 77 | list icmp_type 'destination-unreachable' |
| 78 | list icmp_type 'packet-too-big' |
| 79 | list icmp_type 'time-exceeded' |
| 80 | list icmp_type 'bad-header' |
| 81 | list icmp_type 'unknown-header-type' |
| 82 | option limit '1000/sec' |
| 83 | option family 'ipv6' |
| 84 | option target 'ACCEPT' |
| 85 | |
| 86 | config include |
| 87 | option path '/etc/firewall.user' |
| 88 | |
| 89 | config zone |
| 90 | option name 'newzone' |
| 91 | option input 'ACCEPT' |
| 92 | option forward 'REJECT' |
| 93 | option network ' ' |
| 94 | option output 'ACCEPT' |
| 95 | |
| 96 | config rule |
| 97 | option target 'ACCEPT' |
| 98 | option src 'wan' |
| 99 | option dest_port '22' |
| 100 | option name 'ssh' |
| 101 | option family 'ipv4' |
| 102 | option proto 'tcp udp' |
| 103 | |
| 104 | config rule |
| 105 | option target 'ACCEPT' |
| 106 | option src 'wan' |
| 107 | option dest_port '80' |
| 108 | option name 'web' |
| 109 | option family 'ipv4' |
| 110 | option proto 'tcp udp' |
| 111 | |
| 112 | config redirect |
| 113 | option target 'DNAT' |
| 114 | option src 'wan' |
| 115 | option dest 'lan' |
| 116 | option proto 'tcp udp' |
| 117 | option src_dport '4444' |
| 118 | option dest_ip '192.168.42.100' |
| 119 | option dest_port '4444' |
| 120 | option name 'osc' |
| 121 | |
| 122 | config redirect |
| 123 | option target 'DNAT' |
| 124 | option src 'wan' |
| 125 | option dest 'lan' |
| 126 | option proto 'tcp' |
| 127 | option src_dport '21' |
| 128 | option dest_ip '192.168.42.100' |
| 129 | option dest_port '21' |
| 130 | option name 'ftp' |
| 131 | |
| 132 | config redirect |
| 133 | option target 'DNAT' |
| 134 | option src 'wan' |
| 135 | option dest 'lan' |
| 136 | option proto 'tcp udp' |
| 137 | option src_dport '23' |
| 138 | option dest_ip '192.168.42.100' |
| 139 | option dest_port '23' |
| 140 | option name 'telnet' |
| 141 | |
| 142 | config rule |
| 143 | option target 'ACCEPT' |
| 144 | option src 'wan' |
| 145 | option proto 'tcp udp' |
| 146 | option dest_port '8080' |
| 147 | option name 'mjpg' |
| 148 | |
nanonote-TLWR11U/files/etc/config/uhttpd |
| 1 | # Server configuration |
| 2 | config uhttpd main |
| 3 | |
| 4 | # HTTP listen addresses, multiple allowed |
| 5 | list listen_http 0.0.0.0:80 |
| 6 | # list listen_http [::]:80 |
| 7 | |
| 8 | # HTTPS listen addresses, multiple allowed |
| 9 | list listen_https 0.0.0.0:443 |
| 10 | # list listen_https [::]:443 |
| 11 | |
| 12 | # Server document root |
| 13 | option home /www |
| 14 | |
| 15 | # Reject requests from RFC1918 IP addresses |
| 16 | # directed to the servers public IP(s). |
| 17 | # This is a DNS rebinding countermeasure. |
| 18 | option rfc1918_filter 1 |
| 19 | |
| 20 | # Certificate and private key for HTTPS. |
| 21 | # If no listen_https addresses are given, |
| 22 | # the key options are ignored. |
| 23 | option cert /etc/uhttpd.crt |
| 24 | option key /etc/uhttpd.key |
| 25 | |
| 26 | # CGI url prefix, will be searched in docroot. |
| 27 | # Default is /cgi-bin |
| 28 | option cgi_prefix /cgi-bin |
| 29 | |
| 30 | # List of extension->interpreter mappings. |
| 31 | # Files with an associated interpreter can |
| 32 | # be called outside of the CGI prefix and do |
| 33 | # not need to be executable. |
| 34 | # list interpreter ".php=/usr/bin/php-cgi" |
| 35 | # list interpreter ".cgi=/usr/bin/perl" |
| 36 | |
| 37 | # Lua url prefix and handler script. |
| 38 | # Lua support is disabled if no prefix given. |
| 39 | # option lua_prefix /luci |
| 40 | # option lua_handler /usr/lib/lua/luci/sgi/uhttpd.lua |
| 41 | |
| 42 | # CGI/Lua timeout, if the called script does not |
| 43 | # write data within the given amount of seconds, |
| 44 | # the server will terminate the request with |
| 45 | # 504 Gateway Timeout response. |
| 46 | option script_timeout 60 |
| 47 | |
| 48 | # Network timeout, if the current connection is |
| 49 | # blocked for the specified amount of seconds, |
| 50 | # the server will terminate the associated |
| 51 | # request process. |
| 52 | option network_timeout 30 |
| 53 | |
| 54 | # TCP Keep-Alive, send periodic keep-alive probes |
| 55 | # over established connections to detect dead peers. |
| 56 | # The value is given in seconds to specify the |
| 57 | # interval between subsequent probes. |
| 58 | # Setting this to 0 will disable TCP keep-alive. |
| 59 | option tcp_keepalive 1 |
| 60 | |
| 61 | # Basic auth realm, defaults to local hostname |
| 62 | # option realm OpenWrt |
| 63 | |
| 64 | # Configuration file in busybox httpd format |
| 65 | # option config /etc/httpd.conf |
| 66 | |
| 67 | |
| 68 | # Certificate defaults for px5g key generator |
| 69 | config cert px5g |
| 70 | |
| 71 | # Validity time |
| 72 | option days 730 |
| 73 | |
| 74 | # RSA key size |
| 75 | option bits 1024 |
| 76 | |
| 77 | # Location |
| 78 | option country DE |
| 79 | option state Berlin |
| 80 | option location Berlin |
| 81 | |
| 82 | # Common name |
| 83 | option commonname OpenWrt |
| 84 | |
nanonote-TLWR11U/files/opt/m1-wireless.lua |
| 1 | #!/usr/bin/env lua |
| 2 | |
| 3 | local io = require "io" |
| 4 | local os = require "os" |
| 5 | local table = require "table" |
| 6 | |
| 7 | function trim (s) |
| 8 | return (string.gsub(s, "^%s*(.-)%s*$", "%1")) |
| 9 | end |
| 10 | |
| 11 | function split(delim, text) |
| 12 | local list = {} |
| 13 | if string.len(text) <= 0 then |
| 14 | return list |
| 15 | end |
| 16 | delim = delim or "" |
| 17 | local pos = 1 |
| 18 | -- if delim matches empty string then it would give an endless loop |
| 19 | if string.find("", delim, 1) and delim ~= "" then |
| 20 | error("delim matches empty string!") |
| 21 | end |
| 22 | local first, last |
| 23 | while 1 do |
| 24 | if delim ~= "" then |
| 25 | first, last = string.find(text, delim, pos) |
| 26 | else |
| 27 | first, last = string.find(text, "%s+", pos) |
| 28 | if first == 1 then |
| 29 | pos = last+1 |
| 30 | first, last = string.find(text, "%s+", pos) |
| 31 | end |
| 32 | end |
| 33 | if first then -- found? |
| 34 | table.insert(list, string.sub(text, pos, first-1)) |
| 35 | pos = last+1 |
| 36 | else |
| 37 | table.insert(list, string.sub(text, pos)) |
| 38 | break |
| 39 | end |
| 40 | end |
| 41 | return list |
| 42 | end |
| 43 | |
| 44 | function exec(command) |
| 45 | local pp = io.popen(command) |
| 46 | local data = pp:read("*a") |
| 47 | pp:close() |
| 48 | |
| 49 | return data |
| 50 | end |
| 51 | |
| 52 | function iwscan(iface) |
| 53 | local siface = iface or "" |
| 54 | local cnt = exec("iwlist "..siface.." scan 2>/dev/null") |
| 55 | local iws = {} |
| 56 | |
| 57 | cnt = trim(cnt) |
| 58 | for i, l in pairs(split("\n Cell", cnt)) do |
| 59 | local ESSID = l:match("ESSID:\"(.-)\"") |
| 60 | if ESSID then |
| 61 | local Q = l:match("Quality[:=](.-)[ ]") |
| 62 | local A = l:match("Authentication Suites.- : (.-)\n") |
| 63 | local P = l:match("Pairwise Ciphers.- : (.-)\n") |
| 64 | |
| 65 | local enc |
| 66 | if not l:find("Encryption key:on") then |
| 67 | enc = "none" |
| 68 | else |
| 69 | local wpa = l:find("WPA Version 1") |
| 70 | local rsn = l:find("WPA2 Version 1") |
| 71 | if wpa and rsn then enc = "psk+psk2" |
| 72 | elseif rsn then enc = "psk2" |
| 73 | elseif wpa then enc = "psk" |
| 74 | else enc = "wep" end |
| 75 | end |
| 76 | |
| 77 | local a = Q:match("(%d-)/") |
| 78 | local b = Q:match("/(%d-)$") |
| 79 | Q = math.floor(tonumber(a)/tonumber(b)*100) |
| 80 | |
| 81 | local r = Q .. "%," .. ESSID .. "," .. enc |
| 82 | |
| 83 | table.insert(iws, r) |
| 84 | end |
| 85 | end |
| 86 | |
| 87 | return iws |
| 88 | end |
| 89 | |
| 90 | local t = iwscan("wlan0") |
| 91 | if t == {} then |
| 92 | print(); |
| 93 | else |
| 94 | for k,v in pairs(t) do print(v) end |
| 95 | end |
| 96 | |
nanonote-TLWR11U/files/opt/m1-wireless.sh |
| 1 | #!/bin/sh |
| 2 | |
| 3 | if [ "$1" == "set" ] && [ "$#" == "4" ]; then |
| 4 | uci delete network.wwan |
| 5 | uci set network.wwan=interface |
| 6 | uci set network.wwan.proto=dhcp |
| 7 | |
| 8 | uci delete wireless.@wifi-iface[0] |
| 9 | uci set wireless.@wifi-device[0].disabled=0 |
| 10 | uci add wireless wifi-iface > /dev/null 2>&1 |
| 11 | uci set wireless.@wifi-iface[0].device='radio0' |
| 12 | uci set wireless.@wifi-iface[0].network='wwan' |
| 13 | uci set wireless.@wifi-iface[0].mode='sta' |
| 14 | |
| 15 | #none for an open network, |
| 16 | #wep for WEP, |
| 17 | #psk for WPA-PSK, or |
| 18 | #psk2 |
| 19 | |
| 20 | uci set wireless.@wifi-iface[0].ssid=$2 |
| 21 | uci set wireless.@wifi-iface[0].key=$3 |
| 22 | uci set wireless.@wifi-iface[0].encryption=$4 |
| 23 | |
| 24 | uci commit network |
| 25 | uci commit wireless |
| 26 | ifup wwan |
| 27 | sleep 2 |
| 28 | |
| 29 | exit 0 |
| 30 | fi |
| 31 | |
| 32 | |
| 33 | if [ "$1" == "get" ]; then |
| 34 | ifconfig -a | grep wlan0 > /dev/null 2>&1 |
| 35 | |
| 36 | if [ "$?" != "0" ]; then |
| 37 | iw phy phy0 interface add wlan0 type station |
| 38 | ifconfig wlan0 up |
| 39 | sleep 1 |
| 40 | fi |
| 41 | |
| 42 | /opt/m1-wireless.lua |
| 43 | |
| 44 | exit 0 |
| 45 | fi |
| 46 | |
| 47 | if [ "$1" == "status" ]; then |
| 48 | sleep 1 |
| 49 | IP=`ifconfig wlan0 2>/dev/null | grep "inet addr" | \ |
| 50 | sed -e 's/^ *//g' | cut -d":" -f2 | cut -d" " -f1` |
| 51 | if [ "$?" != 0 ] || [ "${IP}" == "" ]; then |
| 52 | echo "Disconnected" |
| 53 | echo "0.0.0.0" |
| 54 | exit 1 |
| 55 | fi |
| 56 | |
| 57 | ESSID=`iwconfig wlan0 2>/dev/null | grep ESSID | cut -d":" -f 2 | sed -e 's/\"//g'` |
| 58 | |
| 59 | echo "${ESSID}" |
| 60 | echo "${IP}" |
| 61 | |
| 62 | exit 0 |
| 63 | fi |
| 64 | |
| 65 | echo "Usage: $0 [get/set/status] PARAMS..." |
| 66 | exit 1 |