├── README.md ├── .gitattributes ├── .gitignore ├── LICENSE └── Hotspot.cmd /README.md: -------------------------------------------------------------------------------- 1 | # Microsoft Hotspot Manager 2 | 3 | This is a small batch file that enables you to run your own hotspot with default windows tools. Currently tested and working on Windows 10. 4 | 5 | ### Functions 6 | - Activate Hotspot 7 | - Deactivate Hotspot 8 | - List connected devices 9 | 10 | #### Contributions 11 | > This git is actively managed. Feel free to create pull requests. 12 | - JamesCullum -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear in the root of a volume 35 | .DocumentRevisions-V100 36 | .fseventsd 37 | .Spotlight-V100 38 | .TemporaryItems 39 | .Trashes 40 | .VolumeIcon.icns 41 | 42 | # Directories potentially created on remote AFP share 43 | .AppleDB 44 | .AppleDesktop 45 | Network Trash Folder 46 | Temporary Items 47 | .apdisk 48 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Hotspot.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | :start 4 | cls 5 | echo Choose an action below by entering its number. 6 | echo [1] Setup or Modify 7 | echo [2] Activate Hotspot 8 | echo [3] Deactivate Hotspot 9 | echo [4] List connected devices 10 | set /p choice= 11 | if %choice%==1 goto setup 12 | if %choice%==2 goto activate 13 | if %choice%==3 goto deactivate 14 | if %choice%==4 goto manage 15 | echo Unknown action, please just enter the number. 16 | pause 17 | goto start 18 | 19 | :setup 20 | netsh wlan stop hostednetwork >NUL 21 | echo Enter the SSID of the hotspot 22 | set /p set_ssid= 23 | echo Enter the password for accessing the hotspot (8 characters minimum) 24 | set /p set_pass= 25 | echo Create a [t]emporary or [p]ermanent hotspot? 26 | echo Temporary hotspots vanish after a restart 27 | echo Enter the marked letter of your prefered option 28 | set /p set_permanent= 29 | netsh wlan set hostednetwork mode=allow ssid="%set_ssid%" key="%set_pass%" 30 | netsh wlan start hostednetwork 31 | netsh wlan show hostednetwork setting=security 32 | if "%set_permanent%"=="p" ( 33 | echo netsh wlan start hostednetwork > "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\permanent_hotspot.cmd" 34 | echo Hotspot set to permanent mode 35 | ) 36 | if "%set_permanent%"=="t" ( 37 | del /f /q "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup\permanent_hotspot.cmd" >NUL 38 | echo Hotspot set to temporary mode 39 | ) 40 | echo ------------------ 41 | echo If this is your first setup you need to open up the adapter settings in the Network and Sharing Center 42 | echo Select your working internet connection, right click on it, go to Properties 43 | echo Switch to the tab called Sharing, tick to share the connection and select your created hotspot 44 | echo ------------------ 45 | pause 46 | goto start 47 | 48 | :activate 49 | netsh wlan start hostednetwork 50 | pause 51 | goto start 52 | 53 | :deactivate 54 | netsh wlan stop hostednetwork 55 | pause 56 | goto start 57 | 58 | :manage 59 | @echo off 60 | set hasClients=0 61 | arp -a | findstr /r "192\.168\.[0-9]*\.[2-9][^0-9] 192\.168\.[0-9]*\.[0-9][0-9][^0-9] 192\.168\.[0-9]*\.[0-1][0-9][0-9]" >test.tmp 62 | arp -a | findstr /r "192\.168\.[0-9]*\.2[0-46-9][0-9] 192\.168\.[0-9]*\.25[0-4]" >>test.tmp 63 | for /F "tokens=1,2,3" %%i in (test.tmp) do call :process %%i %%j %%k 64 | del test.tmp 65 | echo Connected Clients 66 | echo ------------------ 67 | if %hasClients%==0 echo No device is currently connected to your hotspot 68 | if %hasClients%==1 ( 69 | type result.tmp 70 | del result.tmp 71 | ) 72 | echo ------------------ 73 | pause 74 | goto start 75 | 76 | :process 77 | set VAR1=%1 78 | ping -a %VAR1% -n 1 | findstr Pinging > loop1.tmp 79 | for /F "tokens=1,2,3" %%i in (loop1.tmp) do call :process2 %%i %%j %%k 80 | del loop1.tmp 81 | goto :EOF 82 | 83 | :process2 84 | SET VAR2=%2 85 | SET VAR3=%3 86 | set hasClients=1 87 | echo %VAR2% %VAR3% >>result.tmp 88 | goto :EOF 89 | 90 | :EOF 91 | 92 | 93 | --------------------------------------------------------------------------------