Automating Multiple Accounts with Uniuploader

General Discussion Area
Post Reply
Kanegasi

Automating Multiple Accounts with Uniuploader

Post by Kanegasi »

EDIT (10/31/15): Updated to perform a fixed time upload based on task scheduler as well as updating errors in batch script. Removed download links in favor of purely manual setup. Now using basic task creation.

This uses Windows Task Scheduler and a simple Batch file that sits in your main World of Warcraft install folder. It will give Uniuploader the recent CensusPlus SV of two, three, or four accounts to upload.

Notice: you need your Windows System account date/time settings in a certain way for this to work. More info in step 12.

1) Make a text file in your main World of Warcraft directory named wow.

2) Right click the file, open with Notepad. If you have a desired text editor, you may use that.

3) Paste the following code in that file. Change the ACCOUNT1/2/3/4 parts inside the dashed lines to what account folders you have in your World of Warcraft\WTF\Account folder. If you have more than two accounts, remove the two colons :: from the beginning of the lines you need, so three accounts would delete the colons in front of the line that starts with "set $cpp3" and four would delete the ones in the "set $cpp4" line. Save and close.

Code: Select all

cd "%~dp0"
call :logstart > "%~dp0Logs\census.log" 2>&1
exit
:logstart
^======================================== %date% %time% ========================================
setlocal enableDelayedExpansion
::
::------------------------------------------------------------------------------
set $dump="%~dp0WTF\Account\censusdummy\SavedVariables\CensusPlus.lua"
set $cpp1="%~dp0WTF\Account\ACCOUNT1\SavedVariables\CensusPlus.lua"
set $cpp2="%~dp0WTF\Account\ACCOUNT2\SavedVariables\CensusPlus.lua"
::set $cpp3="%~dp0WTF\Account\ACCOUNT3\SavedVariables\CensusPlus.lua"
::set $cpp4="%~dp0WTF\Account\ACCOUNT4\SavedVariables\CensusPlus.lua"
::------------------------------------------------------------------------------
::
for %%T in (%$dump%) do set $dumt=%%~tT
for %%T in (%$cpp1%) do set $cpt1=%%~tT
for %%T in (%$cpp2%) do set $cpt2=%%~tT
if defined $cpp3 (for %%T in (%$cpp3%) do set $cpt3=%%~tT)
if defined $cpp4 (for %%T in (%$cpp4%) do set $cpt4=%%~tT)
call :filecompare %$cpt1% %$cpt2%
set $cp12=!errorlevel!
if defined $cpp3 (
call :filecompare %$cpt1% %$cpt3%
set $cp13=!errorlevel!
call :filecompare %$cpt2% %$cpt3%
set $cp23=!errorlevel!)
if defined $cpp4 (
call :filecompare %$cpt1% %$cpt4%
set $cp14=!errorlevel!
call :filecompare %$cpt2% %$cpt4%
set $cp24=!errorlevel!
call :filecompare %$cpt3% %$cpt4%
set $cp34=!errorlevel!)
if not defined $cpp3 (
if not defined $cpp4 (
if %$cp12% equ 1 (
call :copyfile %$cpt1% %$cpp1%)
if %$cp12% equ 2 (
call :copyfile %$cpt2% %$cpp2%)))
if defined $cpp3 (
if not defined $cpp4 (
if %$cp12% equ 1 (
if %$cp13% equ 1 (
call :copyfile %$cpt1% %$cpp1%))
if %$cp12% equ 2 (
if %$cp23% equ 1 (
call :copyfile %$cpt2% %$cpp2%))
if %$cp13% equ 2 (
if %$cp23% equ 2 (
call :copyfile %$cpt3% %$cpp3%))))
if defined $cpp3 (
if defined $cpp4 (
if %$cp12% equ 1 (
if %$cp13% equ 1 (
if %$cp14% equ 1 (
call :copyfile %$cpt1% %$cpp1%)))
if %$cp12% equ 2 (
if %$cp23% equ 1 (
if %$cp24% equ 1 (
call :copyfile %$cpt2% %$cpp2%)))
if %$cp13% equ 2 (
if %$cp23% equ 2 (
if %$cp34% equ 1 (
call :copyfile %$cpt3% %$cpp3%)))
if %$cp14% equ 2 (
if %$cp24% equ 2 (
if %$cp34% equ 2 (
call :copyfile %$cpt4% %$cpp4%)))))
exit
:copyfile
call :filecompare %1 %2 %$dumt%
if %errorlevel% neq 3 copy %3 %$dump%
exit
:filecompare
set $file1=%1 %2
set $file2=%3 %4
if "%$file1%" equ "%$file2%" exit /b 3
if %$file1:~0,2% gtr %$file2:~0,2% exit /b 1
if %$file1:~0,2% lss %$file2:~0,2% exit /b 2
if %$file1:~3,2% gtr %$file2:~3,2% exit /b 1
if %$file1:~3,2% lss %$file2:~3,2% exit /b 2
if %$file1:~6,2% gtr %$file2:~6,2% exit /b 1
if %$file1:~6,2% lss %$file2:~6,2% exit /b 2
if %$file1:~9,2% gtr %$file2:~9,2% exit /b 1
if %$file1:~9,2% lss %$file2:~9,2% exit /b 2
if %$file1:~12,2% gtr %$file2:~12,2% exit /b 1
if %$file1:~12,2% lss %$file2:~12,2% exit /b 2
if %$file1:~12,2% equ %$file2:~12,2% exit /b 3
What the top part should look like if you have two accounts:

Code: Select all

::------------------------------------------------------------------------------
set $dump="%~dp0WTF\Account\censusdummy\SavedVariables\CensusPlus.lua"
set $cpp1="%~dp0WTF\Account\ACCOUNT1\SavedVariables\CensusPlus.lua"
set $cpp2="%~dp0WTF\Account\ACCOUNT2\SavedVariables\CensusPlus.lua"
::set $cpp3="%~dp0WTF\Account\UNUSED\SavedVariables\CensusPlus.lua"
::set $cpp4="%~dp0WTF\Account\UNUSED\SavedVariables\CensusPlus.lua"
::------------------------------------------------------------------------------
Three accounts:

Code: Select all

::------------------------------------------------------------------------------
set $dump="%~dp0WTF\Account\censusdummy\SavedVariables\CensusPlus.lua"
set $cpp1="%~dp0WTF\Account\ACCOUNT1\SavedVariables\CensusPlus.lua"
set $cpp2="%~dp0WTF\Account\ACCOUNT2\SavedVariables\CensusPlus.lua"
set $cpp3="%~dp0WTF\Account\ACCOUNT3\SavedVariables\CensusPlus.lua"
::set $cpp4="%~dp0WTF\Account\UNUSED\SavedVariables\CensusPlus.lua"
::------------------------------------------------------------------------------
And four accounts:

Code: Select all

::------------------------------------------------------------------------------
set $dump="%~dp0WTF\Account\censusdummy\SavedVariables\CensusPlus.lua"
set $cpp1="%~dp0WTF\Account\ACCOUNT1\SavedVariables\CensusPlus.lua"
set $cpp2="%~dp0WTF\Account\ACCOUNT2\SavedVariables\CensusPlus.lua"
set $cpp3="%~dp0WTF\Account\ACCOUNT3\SavedVariables\CensusPlus.lua"
set $cpp4="%~dp0WTF\Account\ACCOUNT4\SavedVariables\CensusPlus.lua"
::------------------------------------------------------------------------------
As a note, the first five lines of the large main code above are to log the most recent output of this script into a census.log file located in your World of Warcraft Logs folder. The contents of this file get overwritten every time this script runs. This is for debugging purposes, just in case. It is not uploaded anywhere, unless you manually do so. Everything logged in this file can be viewed in plain text in any text editor. If you don't want this log file, remove all five lines above setlocal enableDelayedExpansion. It is very important you leave that setlocal line there.

4) Now choose "Save as...", select "All Files" in the bottom dropdown, and add .bat to the filename. Make sure the file saves in the WoW install folder.

5) Type "taskschd.msc" in the Start menu and hit Enter.

6) Click "Create Basic Task..." on the right.

7) Name it something like "wowcensus", description is optional, then click Next.

8) You can have this trigger in any way you want, just keep in mind that if there's a new file, the upload will happen. Click Next after selecting a trigger then Next again after you're done setting up the trigger. I have it set to daily. Keep in mind that WarcraftRealms has a 15 minute limit between uploads.

9) Make sure "Start a program" is selected and click Next. Click the Browse button and find the .bat file you made above. Click Open then click Next.

10) Check "Open the Properties dialog" box and click Finish.

11) Click "Change User or Group..." then type SYSTEM into the bottom box and click OK then OK again.

12) Batch and Windows CMD is fickle. In order for the batch script to properly work, you actually need your Windows system short times set a certain way. Now, if you have the Task Scheduler set to your user account, which the last step changed, the batch file uses your date settings, but if the Task Scheduler is set to SYSTEM, it uses SYSTEM's date setting.

In your system control panel, find "Region and Language". Set the short date format to "yy/MM/dd" and short time to "HH:mm".
http://i.imgur.com/jSJ8fsZ.png
If you don't want to change your displayed dates and times, then you can set the Task Scheduler to use SYSTEM. Change your display dates/times anyways and do the following to copy them to SYSTEM.
http://i.imgur.com/SEv9QGk.png
http://i.imgur.com/NhC8n8i.png
Then, change your display dates/times back to how you want them.

13) You may have noticed "censusdummy" in the script. The way this automation works is it checks for the most recent CensusPlus.lua file in your two/three account folders and copies it into a bare "account" folder named "censusdummy". Uniuploader works by checking when the CensusPlus.lua file changes, so when the recent file gets copied to "censusdummy", Uniuploader triggers and uploads. Check the following pictures to set this fake folder up:
http://i.imgur.com/DrsXXeK.png
http://i.imgur.com/KUgg5m8.png
http://i.imgur.com/i3E8vSt.png
SavedVariables.lua can be empty or filled with random data, as long as it's there. Uniuploader checks for that file to "verify" a correct account folder. The CensusPlus.lua file can also be empty or random, as long as it's there for you to check it in Uniuploader's right SV window.

If you had Uniuploader running, close and reopen it. You should see a "censusdummy" option in the account dropdown. Select that, the auto-upload option, and make sure CensusPlus.lua is selected in the SV list.

That's it!
Last edited by Kanegasi on Thu Nov 26, 2015 8:49 am, edited 13 times in total.

User avatar
bringoutyourdead
Forums Admin & general flunky
Posts: 1432
Joined: Fri Nov 07, 2008 1:11 pm
Location: Texas, USA

Post by bringoutyourdead »

Please be aware that warcraftrealm.com site owner and CensusPlus addon maintainer have NO relationship or prior knowledge of this automation.
As such we are not responsible for any problems that may occur with usage of this code.

Having said that.. after looking over the changes I CAN NOT RECOMMEND the usage of this systems modification for the following reasons.

As should be obvious this is a Windows only item, not that I expect we have many Mac World of Warcraft users.

Here are a few things I have found with just a quick glance at the message and some of the links.
Most Browser and/or anti-malware will block the downloading of the wow.bat file from the first link.

Steps 4,5 & 6 will fail on most Windows computers.. as this option is enable only on Pro and Enterprise level of Windows.

The supplied XML file for the task schedule runs at far to high a security level and leaves your system with a huge security hole.

While I don't ascribe any bad intent by user Kanegasi, some other malicious programmer could use this security breach to swap out the unsecured wow.bat file with malicious code that could do anything to your system.

Again anything could happen to your system since the task runs at SYSTEM authorization at highest priority... meaning it can run above the levels of your malware blockers.

Kanegasi

Post by Kanegasi »

I appreciate the general disclaimers. I was actually unaware that local security policy editor is not on Windows Home editions. For the .bat file, that seems only natural that some blockers would reject that file. Didn't think of that either.

As for the high level in the task file, I assumed that since most file/folder manipulation issues with programs, including WoW, is fixed by running as Administrator, setting that highest option would preclude any issues. Doing a little searching, I decided to change that privilege option. The link in my post above is changed and the old file is deleted. The <runlevel> option is the xml side of the "run with highest privileges" checkbox in the General tab you see before clicking "Actions" in step 9. Also, the <userid> above that, "S-1-5-18", is the userid for a local system task, which means this task will run as "SYSTEM" when you see it in the task manager. This page shows a list of all available userids to use. If anyone else wants to check out both files, including the xml file, simply open them in Notepad or any other text editor.

I actually created parts of this automation last year to update the old Undermine Journal AH data and it has evolved for me to also keep a ton of chat/combat logs and archive all my screenshots. Since I have three accounts, two I regularly use, I figured it would be great if I could automate uploading all the data I gather, and decided to share it for anyone interested. The wow.bat file I actually have is larger than what I'm sharing here.

Oh, bringoutyourdead, did you get my PM about the data I uploaded July 1st?

User avatar
bringoutyourdead
Forums Admin & general flunky
Posts: 1432
Joined: Fri Nov 07, 2008 1:11 pm
Location: Texas, USA

Post by bringoutyourdead »

As I professionally come from the Systems Administration and Security side of IT, I tend to look at the security aspects of things before I look at the functionality of the item.

The SYSTEM account is still a very bad idea... see
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
and linked pages.

What you really want is the least privileges that will allow your task to function correctly.
The more you limit the rights the less likely a bad actor can abuse your processes.

also just to see what you have as accounts on your system (this is valid for anyone running windows XP and above)
open a cmd.exe window and type the following:

wmic useraccount get name,sid

as you will see even though you are on a stand-alone machine, your SID will be configured as a Microsoft Domain.
User accounts start as S-1-5-21 and have a series of numbers indicating the domain followed by the user account ID.
Prebuild accounts like Adminstrator and Guest will start (typically) at 500
Real user accounts will start (typically) at 1000


and re PM .. yes I did.. since Rollie did not setup the database as a transactional system, trying to revert the bad data is a manual pain in the ___.
Since the amount of data is so small, I intend to just ignore the faux pas... just try to not have that oops again.
[It is not like these things haven't happened before.. and sadly I expect them to happen in the future from others]

Kanegasi

Post by Kanegasi »

I've always wondered how I could just make it run on user. Thank you for that cmd. For some reason, I thought that you needed those extra numbers to import a task as user. It appears that just dropping S-1-5-21 in there automatically sets the logged in user when the task imports. I should've tried that last year, but didn't think nothing of just setting system. I changed that as well and swapped file links.

Also, for the uploaded info, thanks for understanding.

EDIT: Typical faulty memory. I just remembered why I set the task to run on system. It hides the cmd window that pops up if the task runs with user privileges.

User avatar
bringoutyourdead
Forums Admin & general flunky
Posts: 1432
Joined: Fri Nov 07, 2008 1:11 pm
Location: Texas, USA

Post by bringoutyourdead »


Kanegasi

Post by Kanegasi »

Oh, I'm aware of that. My Undermine Journal automation chained a vbs file, a ps1 file, and a bat file just to download, unzip, and install with no windows. I just prefer only a bat file for wow log archival, screenshot archival, cache deletion, and now census automation. For the sake of security though, I realize that throwing in a vbs script to call the bat file in this thread topic to keep the task level low is a good idea for anyone who wants to do this.

Also, I wouldn't have got very far in any of this if it weren't for serverfault, superuser, stackexchange, stackoverflow, or any of those sites.

Kanegasi

Post by Kanegasi »

I got around to updating this, keeping in mind bringoutyourdead's comments.

* no more downloaded files, completely manual setup
* instead of uploading when WoW closes, it uploads when the user sets it, such as daily. (no local policy editing)
* fixed a bug in the batch script when using three or four accounts

Post Reply