-
Notifications
You must be signed in to change notification settings - Fork 1
/
arswarm.expect
executable file
·35 lines (32 loc) · 997 Bytes
/
arswarm.expect
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/expect
##########################################################################################################################
#
#
# arswarm.expect: An Expect script that reconfigure an ar drone 2 using telnet from a bash script called wifi.sh
#
#
# Example of wifi.sh:
# killall udhcpd;
# ifconfig ath0 down;
# iwconfig ath0 mode managed essid DRONES;
# ifconfig ath0 192.168.1.3 netmask 255.255.255.0 up;
# route add default gw 192.168.1.1;
# exit
#
# Author: Gildas Morvan
# mail:[email protected]
# homepage:http://www.lgi2a.univ-artois.fr/~morvan/
#
#
##########################################################################################################################
set timeout 5
set configfile [open wifi.sh]
set configtext [read -nonewline $configfile]
close $configfile
spawn telnet 192.168.1.1
expect -re "#"
send "echo $configtext > /data/wifi.sh\n"
expect -re "#"
send "chmod a+x /data/wifi.sh\n"
expect -re "#"
send "/data/./wifi.sh\n"