RICKROLLED!!

Rickroll WiFi is an awesome script which rickrolls whoever is searching for a WiFi network by changing the SSID of a hotspot to the lyrics of Never Gonna Give You Up.

mac-screenshot

windows-screenshot

An online friend of mine came up with this idea originally. I thought it was a great prank, but I don't currently have an Arduino... So Rickroll WiFi for Windows was born.

Here's the source code (licensed under the MIT License):

@echo off 
title Rickroll WiFi for Windows
echo Rickroll WiFi for Windows
echo by http://rahul2001.com/
:Main
FOR /F "tokens=*" %%G IN (rickme.txt) DO (
netsh wlan set hostednetwork ssid="%%G" key=rahul_is_so_cool! >nul
netsh wlan start hostednetwork >nul
echo CURRENT SSID: %%G
timeout /t 1 >nul
netsh wlan stop hostednetwork >nul
)
echo REPEAT!
goto :Main

Save it as a batch file, and run it with administrator privileges. Be sure to change the password, and save all your data in rickme.txt. It will change the SSID every second with the subsequent line from the text file.

Here's what it looks like on Windows: Windows-Screenshot Here's what the rickme.txt file should look like:

NEVER GONNA GIVE YOU UP
NEVER GONNA LET YOU DOWN
NEVER GONNA MAKE YOU CRY
NEVER GONNA SAY GOODBYE

It literally took me 5 minutes to write this :P
It is still pretty crude though, and I'll update the code when I manage to make it a bit smoother.

The only disadvantage is that the SSID of a WiFi network cannot be longer than 32 characters, so all the lyrics don't work.
Unfortunately, the SSID doesn't change smoothly on Windows, but it still looks pretty cool :)

More information about how this works can be found here.

Here's a handy script to check the installation of Java:

REM get javaw.exe from the registry entry
for /f tokens^=2^ delims^=^" %%i in ('reg query HKEY_CLASSES_ROOT\jarfile\shell\open\command /ve') do set JAVAW_PATH=%%i

REM if reg entry is not found, java is not installed
if "%JAVAW_PATH%"=="" ( goto java_error ) else ( goto java_installed )

If java doesn't exist, java_error is called. If it exists, java_installed is called

UPDATE: 3rd June 2016 - Fixed typo