-
Notifications
You must be signed in to change notification settings - Fork 1
/
xzone
executable file
·1380 lines (982 loc) · 42.2 KB
/
xzone
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#
#
# #############################################################
# # #
# # XZone 0.9 - Scytheri0n #
# # #
# # A simple command line utility to create a HomePass #
# # network on OS X. #
# # #
# #############################################################
#
# Changelog:
#
# 0.9 - * XZone now uses the 'networksetup' utility to create and initialize an
# auxiliary network interface that Internet Sharing shares from.
# * 'networksetup' also does all the magic for us in terms of disabling
# and enabling Internet Sharing now so that we don't interrupt the Ethernet
# connection.
# * Also uses the nifty AirPort utility included in the 802.11 Framework
# from Apple; makes sure we do not join a network in order for the MAC
# to be spoofed properly.
# * Currently, although XZone service is set up automatically by the
# script, we still have to set it as the default sharing interface in
# the IS preferences.
# * The XZone service is enabled at start and disabled on exit to enable
# and disable IS appropriately.
# * Updated the SSIDs to v18432
# * Separated out the previous changes and to do list to separate documents
#
########################################################################################
# Variables
########################################################################################
MAC="4e:53:50:4f:4f:" # The initial 5 octets of the MAC
endHex=00 # The 6th octet for the MAC
count=0 # Count value for loops
finalMAC="" # The final MAC address that will be spoofed
sleepTime=120 # How long the script must pause for
includeNW=0 # Nintendo World MACs included or not
launchFlag="" # Allows flags to be set at launch
useCustomMACs=0 # User MACs included or not
useNZMACs=0 # Nintendo Zone MACs included or not
userMAC="" # The custom MAC address to be used
osxvers=$(sw_vers -productVersion) # The OS X version number
version="0.9" # XZone version number
wifiservice=$(/usr/sbin/networksetup -listallnetworkservices | grep -Ei '(wi-fi|airport)')
wifi=$(networksetup -listallhardwareports | awk "/${wifiservice}/,/Ethernet/"' getline { print $2 }')
ethernet=$(networksetup -listallhardwareports | awk "/Ethernet/,/Ethernet/"' getline { print $2 }')
originalMAC=$(networksetup -getmacaddress Wi-Fi | awk '{print $3}') # The original MAC address of the system
isInitialSetup=0 # Whether the script is running for the first time
gotssid=""
re='^[0-9]+$'
########################################################################################
# SSIDs
#
# The following SSIDs have been extracted from
# http://yls8.mtheall.com/ninupdates/3ds_nzonehotspots.php?version=v15360
# and converted to hex in order to spoof the SSID using Internet Sharing.
# I did not extract these SSIDs from the 3DS firmware and take no credit
# for that; all credit is directed to whomever did the extraction (let me
# know if it was you and I will credit you appropriately!)
#
# SSIDs are divided in to AP Name clusters with the SSID on the right and
# the corresponding hex value on the left.
#
# NOTE: These will be moved to a separate .plist file in a later build
#
########################################################################################
# AT&T WiFi Services
ssid[1]="61747477696669" # attwifi
ssid[2]="4d63446f6e616c647320467265652057694669" # McDonalds Free WiFi
# McDonald's Germany
ssid[3]="4e5a404d634431" # NZ@McD1
ssid[4]="4e5a404d634432" # NZ@McD2
# Wifine
ssid[5]="776966696e65" # wifine
# FreeSpot
ssid[6]="4652454553504f54" # FREESPOT
# NOA Internal
ssid[7]="6e6f6173703031" # noasp1
ssid[8]="6e6f6173703032" # noasp2
# Boingo Wireless
ssid[9]="426f696e676f20486f7473706f74" # Boingo Hotspot
ssid[10]="626f696e676f20686f7473706f74" # boingo hotspot
ssid[11]="41544c2d57692d4669" # ATL-Wi-Fi
ssid[12]="546f726f6e746f2050656172736f6e2057692d4669" # Toronto Pearson Wi-Fi
ssid[13]="4157472d57694669" # AWG-WiFi
ssid[14]="434c544e4554" # CLTNET
ssid[15]="494e445f5055424c49435f57694669" # IND_PUBLIC_WiFi
ssid[16]="4c41582d57694669" # LAX-WiFi
ssid[17]="4d49412d57694669" # MIA-WiFi
ssid[18]="5244555f57694669" # RDU_WiFi
ssid[19]="53616e2e446965676f2e416972706f72742e467265652e57494649" # San.Diego.Airport.Free.WIFI
ssid[20]="666c7973616372616d656e746f" # flysacramento
# Bell Mobility
ssid[21]="686f7473706f745f42656c6c" # hotspot_Bell
ssid[22]="42454c4c57494649404d43444f4e414c4453" # BELLWIFI@MCDONALDS
ssid[23]="426f756c6576617264205361696e742d4c617572656e742057494649" # Boulevard Saint-Laurent WIFI
# Nintendo
ssid[24]="4e696e74656e646f53706f745061737331" # NintendoSpotPass1
ssid[25]="4e696e74656e646f53706f745061737332" # NintendoSpotPass2
# McDonald's Italy
ssid[26]="4e696e74656e646f5f5a6f6e6531" # Nintendo_Zone1
# KPN
ssid[29]="4b504e" # KPN
# Meteor
ssid[30]="4d4554454f52" # METEOR
ssid[31]="4d43444f4e414c4453" # MCDONALDS
ssid[32]="434153494e4f5f62795f4d4554454f52" # CASINO_by_METEOR
# FreeHotspot.com
ssid[38]="667265652d686f7473706f742e636f6d" # free-hotspot.com
ssid[39]="686f7473706f742d677261747569742e636f6d" # hotspot-gratuit.com
ssid[40]="4175746f6772696c6c5f467265655f57694669" # Autogrill_Free_WiFi
ssid[41]="4175746f6772696c6c20467265652057694669" # Autogrill Free WiFi
ssid[42]="517569636b2057694669" # Quick WiFi
ssid[43]="517569636b2057692d4669" # Quick Wi-Fi
ssid[44]="517569636b5f57694669" # Quick_WiFi
# O2 Wi-Fi
ssid[45]="4f322057696669" # O2 Wifi
# Gowex Paris
ssid[46]="474f57455820465245452057694669" # GOWEX FREE WiFi
########################################################################################
# Function Declarations
########################################################################################
# This function performs the actual spoofing of the MAC address
function spoofMAC {
echo "Disabling sharing interface..."
networksetup -setnetworkserviceenabled XZone off
echo "Interface disabled. Sharing halted."
sleep 5
echo "Disassociating from any Wi-Fi networks..."
/usr/local/xzone/airport -z
echo "Done!"
sleep 5
echo "Spoofing MAC!"
ifconfig $wifi lladdr $finalMAC # Set the MAC address to the value of 'finalMAC'
echo "MAC spoofed to "$(ifconfig ${wifi} lladdr | grep ether | awk '{print $2}')
sleep 1
echo "Re-enabling sharing interface..."
networksetup -setnetworkserviceenabled XZone on
echo "Enabled!"
sleep 5 # Sleep for 5 seconds to allow IS to reconfigure itself and get the proper cycle time
sleep $sleepTime # Sleep for the requested duration
}
function setHex {
while [ $endHex -lt 256 ]; do # While count value is less than 256, we have a valid hex value (as an integer)
hex=$(printf "%02x" $endHex) # Converts the 6th MAC octet to hex
endHex=$((endHex + 1)) # Increment the 6th MAC octet
finalMAC=$MAC$hex # Concat the 6th octet to the first 5
/usr/libexec/PlistBuddy -c "Set :StartOctet $endHex" ~/Library/Preferences/com.scytheri0n.xzone.plist
spoofMAC # Run the spoofing function
done
# If count value is 255, we have exhausted all valid octet values and need to restart.
endHex=0 # Reset the 6th MAC octet
/usr/libexec/PlistBuddy -c "Set :StartOctet $endHex" ~/Library/Preferences/com.scytheri0n.xzone.plist
additionalMACs # Check if we need to run additional MAC spoofing
echo "Starting again!"
scriptStart # Run the script again
}
# This function checks what additional MACs we need to spoof and calls the corresponding function
function additionalMACs {
if [ $includeNW == 1 -o "$includeNW" == "true" ]; then # If we need to spoof Nintendo World
spoofNintendo
fi
if [ $useCustomMACs == 1 -o "$useCustomMACs" == "true" ]; then # If we need to spoof Custom MACs
spoofCustomMACs
fi
if [ $useNZMACs == 1 -o "useNZMACs" == "true" ]; then # If we need to spoof real Nintendo Zones
spoofNintendoZones
fi
}
function includeNintendo {
printf "\nWould you like to include the Nintendo World MACs in the cycle? Y or N\n"
read -n1 nintendoMACS # Find out if user wants to include Nintendo World MACs in the cycle
case $nintendoMACS in
y*)
printf "\nIncluding Nintendo World MACs.\n"
includeNW=1
/usr/libexec/PlistBuddy -c "Set :IncludeNintendoWorld TRUE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
Y*)
printf "\nIncluding Nintendo World MACs.\n"
includeNW=1
/usr/libexec/PlistBuddy -c "Set :IncludeNintendoWorld TRUE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
n*)
printf "\nOmitting Nintendo World MACs.\n"
includeNW=0
/usr/libexec/PlistBuddy -c "Set :IncludeNintendoWorld FALSE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
N*)
printf "\nOmitting Nintendo World MACs.\n"
includeNW=0
/usr/libexec/PlistBuddy -c "Set :IncludeNintendoWorld FALSE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
*)
printf "\nPlease type either Y or N.\n"
includeNintendo
;;
esac
}
function includeCustomMACs {
printf "\nWould you like to include the GBATemp User MACs in the cycle? Y or N\n"
read -n1 userinput # Find out if user wants to include Custom MACs in the cycle
case $userinput in
y*)
printf "\nIncluding GBATemp User MACs.\n"
useCustomMACs=1
/usr/libexec/PlistBuddy -c "Set :UseCustomMACs TRUE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
Y*)
printf "\nIncluding GBATemp User MACs.\n"
useCustomMACs=1
/usr/libexec/PlistBuddy -c "Set :UseCustomMACs TRUE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
n*)
printf "\nOmitting GBATemp User MACs.\n"
useCustomMACs=0
/usr/libexec/PlistBuddy -c "Set :UseCustomMACs FALSE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
N*)
printf "\nOmitting GBATemp User MACs.\n"
useCustomMACs=0
/usr/libexec/PlistBuddy -c "Set :UseCustomMACs FALSE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
*)
printf "\nPlease type either Y or N.\n"
includeCustomMACs
;;
esac
}
function includeNZMACs {
printf "\nWould you like to include real Nintendo Zone MACs in the cycle? Y or N\n"
read -n1 userinput # Find out if user wants to include real Nintendo Zone MACs in the cycle
case $userinput in
y*)
printf "\nIncluding Nintendo Zone MACs.\n"
useNZMACs=1
/usr/libexec/PlistBuddy -c "Set :UseNZMACs TRUE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
Y*)
printf "\nIncluding Nintendo Zone MACs.\n"
useNZMACs=1
/usr/libexec/PlistBuddy -c "Set :UseNZMACs TRUE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
n*)
printf "\nOmitting Nintendo Zone MACs.\n"
useNZMACs=0
/usr/libexec/PlistBuddy -c "Set :UseNZMACs FALSE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
N*)
printf "\nOmitting Nintendo Zone MACs.\n"
useNZMACs=0
/usr/libexec/PlistBuddy -c "Set :UseNZMACs FALSE" ~/Library/Preferences/com.scytheri0n.xzone.plist
;;
*)
printf "\nPlease type either Y or N.\n"
includeNZMACs
;;
esac
}
# This function sets the MACs to spoof for Nintendo World
function spoofNintendo {
echo "Spoofing Nintendo World MACs."
# Let XZone know on resume where we are
/usr/libexec/PlistBuddy -c "Set :SpoofingNW TRUE" ~/Library/Preferences/com.scytheri0n.xzone.plist
echo "We need to make sure we are broadcasting using the 'attwifi' SSID."
# Back up the edited preferences so we can jump back to the chosen SSID when NW MACs have been exhausted
cp /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist
# Set the .plist SSID so we are spoofing the correct one
/usr/libexec/PlistBuddy -c "Set :InternetSharing:SSID attwifi" /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
echo "SSID set to 'attwifi'."
# We need to pull the index value from our .plist in case we are resuming
count=$(/usr/libexec/PlistBuddy -c "Print :Index" ~/Library/Preferences/com.scytheri0n.xzone.plist)
# This should probably be cleaned up and converted to an array
while [ $count -lt 6 ]; do
case $count in
0)
count=$((count + 1))
# Set the count index so we can hop back to the follwing MAC on resume
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC="00:25:9C:52:1C:6A"
spoofMAC
;;
1)
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC="00:0D:67:15:2D:82"
spoofMAC
;;
2)
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC="00:0D:67:15:D7:21"
spoofMAC
;;
3)
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC="00:0D:67:15:D5:44"
spoofMAC
;;
4)
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC="00:0D:67:15:D2:59"
spoofMAC
;;
5)
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC="00:0D:67:15:D6:FD"
spoofMAC
;;
*)
# If the count index is out of range for this something has gone wrong
echo "We seem to have encountered an error. Script will now terminate."
return 1
scriptAbort
;;
esac
done
echo "Reverting SSID."
# Remove the edited .plist and copy the XZone configuration back to restore custom SSID
rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
mv ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
echo "SSID reverted."
# Let XZone know we are done spoofing and don't need to resume
/usr/libexec/PlistBuddy -c "Set :SpoofingNW FALSE" ~/Library/Preferences/com.scytheri0n.xzone.plist
# Zero the .plist index so we dont repeat this MAC
/usr/libexec/PlistBuddy -c "Set :Index 0" ~/Library/Preferences/com.scytheri0n.xzone.plist
}
# This function does sets the custom MACs to spoof
function spoofCustomMACs {
echo "Spoofing GBATemp user MACs so we can share the love!"
# Let XZone know on resume where we are
/usr/libexec/PlistBuddy -c "Set :SpoofingCustom TRUE" ~/Library/Preferences/com.scytheri0n.xzone.plist
# We need to pull the index value from our .plist in case we are resuming
count=$(/usr/libexec/PlistBuddy -c "Print :Index" ~/Library/Preferences/com.scytheri0n.xzone.plist)
while [ count != -1 ]; do
# Grab the appropriate MAC from our array
userMAC=$(/usr/libexec/PlistBuddy -c "Print :UserMACs:$count" ~/Library/Application\ Support/XZone/zonedata.plist 2>/dev/null)
# If we have a valid MAC address (or at least the correct length)
if [ ${#userMAC} == 17 ]; then
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC=$userMAC
spoofMAC
else
break 2
fi
done
echo "We have spoofed all available GBATemp user MACs. The love has been shared."
/usr/libexec/PlistBuddy -c "Set :SpoofingCustom FALSE" ~/Library/Preferences/com.scytheri0n.xzone.plist
/usr/libexec/PlistBuddy -c "Set :Index 0" ~/Library/Preferences/com.scytheri0n.xzone.plist
}
# This function does sets the Nintendo Zone MACs and SSIDs to spoof
function spoofNintendoZones {
echo "Spoofing real Nintendo Zone MACs."
/usr/libexec/PlistBuddy -c "Set :SpoofingNZ TRUE" ~/Library/Preferences/com.scytheri0n.xzone.plist
cp /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist
# Call to function that spoofs 'attwifi' NZs
spoofATT
echo "We've cycled through all available (known) Nintendo Zones."
echo "Reverting SSID."
rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
mv ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
echo "SSID reverted."
/usr/libexec/PlistBuddy -c "Set :SpoofingNZ FALSE" ~/Library/Preferences/com.scytheri0n.xzone.plist
/usr/libexec/PlistBuddy -c "Set :Index 0" ~/Library/Preferences/com.scytheri0n.xzone.plist
}
function spoofATT {
cp /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist
echo "We need to make sure we are broadcasting using the correct SSID."
/usr/libexec/PlistBuddy -c "Set :InternetSharing:SSID attwifi" /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
/usr/libexec/PlistBuddy -c "Set :Zone ATT" ~/Library/Preferences/com.scytheri0n.xzone.plist
echo "SSID set to 'attwifi'"
count=$(/usr/libexec/PlistBuddy -c "Print :Index" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
while [ count != -1 ]; do
userMAC=$(/usr/libexec/PlistBuddy -c "Print :NintendoZones:attwifi:$count" ~/Library/Application\ Support/XZone/zonedata.plist 2>/dev/null)
if [ ${#userMAC} == 17 ]; then
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC=$userMAC
spoofMAC
else
break 2
fi
done
/usr/libexec/PlistBuddy -c "Set :Index 0" ~/Library/Preferences/com.scytheri0n.xzone.plist
rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
mv ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
spoofKPN
}
function spoofKPN {
cp /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist
count=$(/usr/libexec/PlistBuddy -c "Print :Index" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
echo "Cycling to 'KPN' SSID."
/usr/libexec/PlistBuddy -c "Set :InternetSharing:SSID KPN" /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
/usr/libexec/PlistBuddy -c "Set :Zone KPN" ~/Library/Preferences/com.scytheri0n.xzone.plist
echo "SSID set to 'KPN'"
while [ count != -1 ]; do
userMAC=$(/usr/libexec/PlistBuddy -c "Print :NintendoZones:KPN:$count" ~/Library/Application\ Support/XZone/zonedata.plist 2>/dev/null)
if [ ${#userMAC} == 17 ]; then
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC=$userMAC
spoofMAC
else
break 2
fi
done
/usr/libexec/PlistBuddy -c "Set :Index 0" ~/Library/Preferences/com.scytheri0n.xzone.plist
rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
mv ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
spoofBELL
}
function spoofBELL {
cp /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist
count=$(/usr/libexec/PlistBuddy -c "Print :Index" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
echo "Cycling to 'BELLWIFI@MCDONALDS' SSID."
/usr/libexec/PlistBuddy -c "Set :InternetSharing:SSID BELLWIFI@MCDONALDS" /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
/usr/libexec/PlistBuddy -c "Set :Zone Bell" ~/Library/Preferences/com.scytheri0n.xzone.plist
echo "SSID set to 'BELLWIFI@MCDONALDS'"
while [ count != -1 ]; do
userMAC=$(/usr/libexec/PlistBuddy -c "Print :NintendoZones:BELLWIFI@MCDONALDS:$count" ~/Library/Application\ Support/XZone/zonedata.plist 2>/dev/null)
if [ ${#userMAC} == 17 ]; then
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC=$userMAC
spoofMAC
else
break 2
fi
done
/usr/libexec/PlistBuddy -c "Set :Index 0" ~/Library/Preferences/com.scytheri0n.xzone.plist
rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
mv ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
spoofMCD
}
function spoofMCD {
cp /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist
count=$(/usr/libexec/PlistBuddy -c "Print :Index" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
echo "Cycling to 'NZ@McD1' SSID."
/usr/libexec/PlistBuddy -c "Set :InternetSharing:SSID NZ@McD1" /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
/usr/libexec/PlistBuddy -c "Set :Zone McD" ~/Library/Preferences/com.scytheri0n.xzone.plist
echo "SSID set to 'NZ@McD1'"
while [ count != -1 ]; do
userMAC=$(/usr/libexec/PlistBuddy -c "Print :NintendoZones:NZ@McD1:$count" ~/Library/Application\ Support/XZone/zonedata.plist 2>/dev/null)
if [ ${#userMAC} == 17 ]; then
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC=$userMAC
spoofMAC
else
break 2
fi
done
/usr/libexec/PlistBuddy -c "Set :Index 0" ~/Library/Preferences/com.scytheri0n.xzone.plist
rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
mv ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
spoofHG
}
function spoofHG {
cp /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist
count=$(/usr/libexec/PlistBuddy -c "Print :Index" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
echo "Cycling to 'hotspot-gratuit.com' SSID."
/usr/libexec/PlistBuddy -c "Set :InternetSharing:SSID hotspot-gratuit.com" /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
/usr/libexec/PlistBuddy -c "Set :Zone HotspotGratuit" ~/Library/Preferences/com.scytheri0n.xzone.plist
echo "SSID set to 'hotspot-gratuit.com'"
while [ count != -1 ]; do
userMAC=$(/usr/libexec/PlistBuddy -c "Print :NintendoZones:hotspot-gratuit.com:$count" ~/Library/Application\ Support/XZone/zonedata.plist 2>/dev/null)
if [ ${#userMAC} == 17 ]; then
count=$((count + 1))
/usr/libexec/PlistBuddy -c "Set :Index $count" ~/Library/Preferences/com.scytheri0n.xzone.plist
finalMAC=$userMAC
spoofMAC
else
break 2
fi
done
/usr/libexec/PlistBuddy -c "Set :Index 0" ~/Library/Preferences/com.scytheri0n.xzone.plist
rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
mv ~/Library/Application\ Support/XZone/com.apple.airport.preferences.edited.plist /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
}
function scriptStart {
sharingEnabled=$(networksetup -getnetworkserviceenabled XZone)
if [ "sharingEnabled" == "Disabled" ]; then
networksetup -setnetworkserviceenabled XZone on
fi
setHex
}
function setCycle {
printf "Please enter the time (in minutes) you wish the script\nto cycle through addresses: "
read input
while [ -z $input ]; do
echo "Please enter a value"
read input
done
if ! [[ $input =~ $re ]] ; then # Evaluate against regex for number
echo "You did not enter a valid number. Please try again."
else
inputTime=$input
gotInput=1
fi
if [ $inputTime -gt 1 ]; then # Ensure cycle value is > 2
sleepTime=$((inputTime * 60))
echo "Script will cycle addresses every" $inputTime "minutes ("$sleepTime "seconds)."
else if [ $inputTime == 0 ]; then
sleepTime=86400
echo "Cycling disabled."
else
sleepTime=120
printf "Cycle value too low. Using default cycle of 2 minutes.\n\n"
fi
fi
/usr/libexec/PlistBuddy -c "Set :CycleFrequency $sleepTime" ~/Library/Preferences/com.scytheri0n.xzone.plist
}
function setStartOctet {
printf "\nIf you would like to start at a specific MAC, enter the final\n2-digit hex value (octet) here. (This is useful if you have terminated\nthe script and wish to pick up where you left off) Otherwise, just hit return.\n"
read -n2 startPoint # Get starting point from user
if [ -z $startPoint ]; then
endHex=00
printf "Starting at "$MAC$endHex"\n"
gotInput=1
else
case $startPoint in
( *[!0-9A-Fa-f]* )
printf "\n\nNot a valid hex value"
;;
( * )
case ${#startPoint} in
( 2 )
endHex=$((0x${startPoint}))
printf "\n\nStarting at "$MAC$startPoint"\n"
gotInput=1
;;
( * )
echo "Please make sure the value is two digits exactly."
;;
esac
;;
esac
fi
/usr/libexec/PlistBuddy -c "Set :StartOctet $endHex" ~/Library/Preferences/com.scytheri0n.xzone.plist
}
function setSSID {
printf "\nWhich SSID would you like to use?\n1. attwifi 2. NZ@McD1 3. (More ...)\n"
read -n1 getSSID
while [ -z $getSSID ]; do
echo "Please enter a value"
read -n1 getSSID
done
case $getSSID in
( 1 )
gotssid=${ssid[1]} # attwifi SSID
;;
( 2 )
gotssid=${ssid[3]} # NZ@McD1 SSID
;;
( 3 )
setExtendedSSID # Call the extended SSID function
;;
( * )
printf "\n\nPlease type either 1, 2, or 3\n"
;;
esac
ssidName=$(echo "$gotssid" | xxd -r -p)
/usr/libexec/PlistBuddy -c "Set :InternetSharing:SSID $ssidName" /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
/usr/libexec/PlistBuddy -c "Set :InternetSharing:SecurityType Open" /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
/usr/libexec/PlistBuddy -c "Set :SSID $ssidName" ~/Library/Preferences/com.scytheri0n.xzone.plist
printf "\nSSID set to "$ssidName"\n"
}
function setExtendedSSID {
# Allow selecting from all SSIDs
printf "\n\nThe following is a list of all possible SSIDs that can\nbe used as StreetPass Relays:\n\n"
printf "1. attwifi 2. McDonalds Free WiFi 3. NZ@McD1 \n\n4. NZ@McD2 5. wifine 6. FREESPOT \n\n7. noasp1 8. noasp2 9. Boingo Hotspot \n\n10. boingo hotspot 11. ATL-Wi-Fi 12. Toronto Pearson Wi-Fi \n\n13. AWG-WiFi 14. CLTNET 15. IND_PUBLIC_WiFi \n\n16. LAX-WiFi 17. MIA-WiFi 18. RDU_WiFi \n\n19. San.Diego.Airport.Free.WIFI 20. flysacramento \n\n21. hotspot_Bell 22. BELLWIFI@MCDONALDS 23. Boulevard Saint-Laurent WIFI \n\n"
read -p "Press any key to continue... " -n1 -s
printf "\n\n24. NintendoSpotPass1 25. NintendoSpotPass2 26. Nintendo_Zone1 \n\n29. KPN 30. METEOR 31. MCDONALDS \n\n32. CASINO_by_METEOR 38. free-hotspot.com 39. hotspot-gratuit.com \n\n40. Autogrill_Free_WiFi 41. Autogrill Free WiFi 42. Quick WiFi \n\n43. Quick Wi-Fi 44. Quick_WiFi 45. O2 Wifi \n\n46. GOWEX FREE WiFi \n\nPlease type the number of the SSID you wish to use: "
read -n2 getSSID
while [ -z $getSSID ]; do
echo "Please enter a value"
read -n2 getSSID
done
if [[ $getSSID =~ $re ]]; then
if [ $getSSID -gt 46 ]; then
printf "\n\nYou have made an invalid selection. Please try again.\n"
else
gotssid=${ssid[$getSSID]}
gotInput=1
fi
else
printf "\nPlease enter a value from the above list.\n"
fi
}
function scriptEnd {
printf "\n\nStopping Internet Sharing ...\n"
networksetup -setnetworkserviceenabled XZone off
printf "\n\nReverting Internet Sharing configuration ...\n"
sudo rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
sudo cp ~/Library/Application\ Support/XZone/com.apple.airport.preferences.plist /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
echo "Internet Sharing configuration reverted."
echo "Reverting MAC address ..."
ifconfig $wifi lladdr ${originalMAC}
echo "MAC address reverted."
printf "\n\nThanks for using XZone!\n\n"
return 0
}
function scriptAbort {
exec 1>&3 2>&4
printf "\n\nAborting script. Please wait while we clean up!"
scriptEnd
exit $?
}
function scriptQuit {
exec 1>&3 2>&4
printf "XZone now quitting. Please wait while we clean up!"
scriptEnd
exit $?
}
function checkPrefs {
includeNW=$(/usr/libexec/PlistBuddy -c "Print :IncludeNintendoWorld" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
sleepTime=$(/usr/libexec/PlistBuddy -c "Print :CycleFrequency" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
endHex=$(/usr/libexec/PlistBuddy -c "Print:StartOctet" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
SSID=$(/usr/libexec/PlistBuddy -c "Print :SSID" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
/usr/libexec/PlistBuddy -c "Set :InternetSharing:SSID $SSID" /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
useCustomMACs=$(/usr/libexec/PlistBuddy -c "Print :UseCustomMACs" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
useNZMACs=$(/usr/libexec/PlistBuddy -c "Print :UseNZMACs" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
}
function checkResume {
resumeCustom=$(/usr/libexec/PlistBuddy -c "Print :SpoofingCustom" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
resumeZones=$(/usr/libexec/PlistBuddy -c "Print :SpoofingNZ" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
resumeWorld=$(/usr/libexec/PlistBuddy -c "Print :SpoofingNW" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
resumeFrom=$(/usr/libexec/PlistBuddy -c "Print :Zone" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
if [ "$resumeWorld" == "true" ]; then
additionalMACs
fi
if [ "$resumeCustom" == "true" ]; then
includeNW=0
additionalMACs
includeNW=$(/usr/libexec/PlistBuddy -c "Print :IncludeNintendoWorld" ~/Library/Preferences/com.scytheri0n.xzone.plist 2>/dev/null)
fi
if [ "$resumeZones" == "true" ]; then
case $resumeFrom in
( ATT )
spoffATT
;;
( KPN )
spoofKPN
;;
( Bell )
spoofBELL
;;
( McD )
spoofMCD
;;
( HotspotGratuit )
spoofHG
;;
( * )
echo "We have encountered an error! Now terminating!"
exit 3
;;
esac
fi
}
function usage {
printf "\nUsage: xzone -[c][h][r][s][v]\nOptions:\n -c Change Options. Allows you to change individual options before the script runs.\n -h Help. Displays this help message.\n -r Reset. Resets saved preferences.\n -s Silent. Runs the program silently.\n -v Verbose. Logs output to stdout. This is the default\n option if no options are passed.\n\n"
exit $?
}
function changeOpts {
echo "Which option would you like to change?"
echo "1. Include Nintendo World 2. Change Cycle Frequency"
echo "3. Change Starting Octet 4. Change SSID"
echo "5. Include GBATemp User MACs 6. Include real Nintendo Zones"
echo ""
optionSet=0
while [ $optionSet != 1 ]; do
read -n1 getOption
echo ""
if [ -z $getOption ]; then
echo "Ahem. You didn't select anything."
else
case $getOption in
1)
includeNintendo
optionSet=1
;;
2)
setCycle
optionSet=1
;;
3)
setStartOctet
optionSet=1
;;
4)
setSSID
optionSet=1
;;
5)
includeCustomMACs