rahuldottech

Tech, coding, security and other random stuff...

UPDATRR

What is this?

UPDATRR is a simple script that I created while developing a renderfarm using my school's computers. It lets you deploy commands to multiple computers/devices at the same time.

How does it work?

It's simple:

  • You upload your commands to a server
  • The computers check for new commands
  • They fetch the commands and run them
  • That's it!

 

What does it require?

  1. Windows XP* or later
  2. An internet connection
  3. BusyBox or Wget executables (more on this later)
    *(It is strongly recommended that you update to Windows 7 at the very minimum, XP is very insecure)

How do I set it up?

1. Set your server up
You just need a place on the internet where you can upload two files: info.txt and commands.cmd.

  1. info.txt: This file contains only two lines of text. The first contains the version number of the current revision of commands.cmd. This must be a positive decimal number. The second line contains the URL to commands.cmd. Note that the last command MUST be exit, without the /b switch. The following is an example:
1.6  
http://rahul.tech/x/getfile.php?file=commands.cmd`

2. `commands.cmd`: This file contains all the commands which are to be run. Example:

@echo off
REM configure hotspot
netsh wlan set hostednetwork mode=allow ssid=rahuldottech key=password123 keyUsage=persistent
REM start hotstop
netsh wlan start hostednetwork
REM wait for a minute
timeout /t 60>nul
REM stop hotspot
netsh wlan stop hostednetwork
REM exit
exit

2. Set up UPDATRR

  1. Download one of the following packages:
  2. Edit the URL to info.txt in updatrr.cmd
    • If you're using the BusyBox package, it's on the 21st line
    • If you're using the Wget package, it's on the 16th line
set infourl=http://rahul.tech/x/getfile.php?file=info

3. Schedule UPDATRR

  • Schedule UPDATRR to run using with Task Scheduler
    1. Press Win+R
    2. Type control schedtasks and press Enter
    3. Go to Action > Create Basic Task... in the menu
    4. Follow the instructions to schedule UPDATRR to run at regular intervals
  • Run on startup
    1. You can also make UPDATRR run on startup by placing a shortcut to it in the startup folder.
    2. Open Windows Explorer and navigate to C:\ProgramData\Microsoft\Windows\Start Menu\Programs and place a shortcut to UPDATRR here if you want it to run on startup for all users.
    3. Place the shortcut in C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs if you only want it to run on startup for the current user.

Now what?

It's simple! Now everytime that you want to deploy a set of commands to the computers, save them in commands.cmd on your server, and increment the version number in the first line of info.txt by at least one decimal point.
When the computers download info.txt, and see that the command version has increased, they will download the new set of commands and run them.


 

Advanced Stuff & Tips

Using FTP

Simply save the URL to info.txt with the ftp:// prefix instead of http:// or https://:

set infourl=ftp://rahul.tech/x/getfile.php?file=info

Encoding Usernames and Passwords in your URLs

Use the appropriate syntax in your URLs:

set infourl=ftp://rahul:mypassword@rahul.tech/.updatrr

Running Different Commands in Different Versions of Windows

@echo off
for /f "tokens=2 delims=:" %%a in ('systeminfo ^| find "OS Name"') do set OS_Name=%%a
for /f "tokens=* delims= " %%a in ("%OS_Name%") do set OS_Name=%%a
for /f "tokens=3 delims= " %%a in ("%OS_Name%") do set OS_Name=%%a
if "%os_name%"=="XP" set version=XP
if "%os_name%"=="7" set version=7
call r%version%

:rXP
echo running Windows XP
REM more commands for XP go here ...

goto :end

:r7
echo running Windows 7
REM more commands for 7 go here...

:end
exit

Atom

▬▬ι═══════ﺤ -═══════ι▬▬