[Script] Auto Downloader

Doctor_Arsenic
Posts: 31
Joined: Sat Jan 14, 2017 7:23 pm

[Script] Auto Downloader

Post by Doctor_Arsenic »

Code: Select all

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//			Tribes Auto-Downloader script by Dr.Arsenic
//
//
//	* What it does: If the server you connect to has a client side file that you need to download to play,
//			this script will ask the server where to download the file and open up a window where
//			you can download the file.
//
//
//                     (1-19-2017 Date of Project Start) 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$AutoDownloaderVersion = "0.12 BETA";
$AutoDownloaderPopupTime = 5; // seconds to exit before window change
$AutoPopupHTMLWindows = true;

function onConnectionError(%client, %manager, %errorString)
{

	%serverName = $serverName;
	%url = $serverFileURL;

	$AutoLoaderExportInfo = "Server: "@$serverName@" - "@%errorString;
	$AutoLoaderExportURL = %URL;
	$AutoLoaderExportSpace = "-------------------------------------------------";

	export("AutoLoaderExport*","temp\\ConnectionErrorLog.log",true);


	$AutoLoaderExport = "";
	$AutoLoaderExportURL = "";
	$AutoLoaderExportSpace = "";

   if(%manager == 2048)
   {
   }
   else
   {
      Quickstart();
      $errorString = "Connection to server error:\n" @ %errorString;

	if($AutoPopupHTMLWindows) {
		if(%URL != "-1" && %URL != "") {
			$errorString = "<jc><f1>-= Auto Downloader v<f2>"@$AutoDownloaderVersion@"<f1> =-\n\n"@%serverName@" wants to send you to URL\n(<f2>"@%url@"<f1>)\n\n<f3>Exit this menu to cancel.";
			Schedule("AutoDownloader::HTMLOpen(\""@ %URL @"\");",$AutoDownloaderPopupTime);
		}
	}

      GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
      schedule("Control::setValue(MessageDialogTextFormat, $errorString);", 0);
   }
}

function AutoDownloader::HTMLOpen(%url)
{
	if(isObject(MessageDialogGUI))
	{
		HTMLOpen(%url);
	}
}

Put this in your AutoExec.cs to install. Server hosts define $Server::FileURL in your mod or config.

WHAT IT DOES:
-If you are unable to join a server because of invalid mission file (missing .ted file), bad version, or because of missing model (.dts) files, this script will auto send you to the server's file URL to get the missing files.
-You will be able to view the URL in Tribes, and have the option to stop before the HTML window actually pops up.


DISCLAIMER: I still need to add client crash protection, so use this with trusted servers only.
Last edited by Doctor_Arsenic on Fri Jan 20, 2017 7:49 pm, edited 2 times in total.
I am running 2 promotional campaigns for http://thelandofoz.net/tribes/

You can see how they are doing here:
#1. https://goo.gl/#analytics/goo.gl/uVM7ON/all_time
#2. https://goo.gl/#analytics/goo.gl/c8QSjT/all_time
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: [Script] Auto Downloader

Post by perrinoia »

function onConnectionError displays an error message with a close button (dialog box).

I suggest adding a download link to the dialog box.

I'm not entirely sure how to do that...

Here's my best guess:

First, append $Server::fileURL to the error message so the player knows what they are clicking on:

Code: Select all

	$errorString = sprintf("Connection to server error:\n%1\n\nDownload client-side content:\n%2", %error, $Server::fileURL);
Then, edit instant FearGuiFormattedText "MessageDialogTextFormat" in MessageDialog.gui.cs:

Code: Select all

					consoleCommand = "HTMLOpen($Server::fileURL);";
I think that might work... But I don't know for sure, cause it's text, not a button... Perhaps you'll need to add a button. I don't know.

If it doesn't work, it might be due to the fact that the error message dialog box is scheduled, and $Server::fileURL is deleted during the delay. I dunno.
Image
Doctor_Arsenic
Posts: 31
Joined: Sat Jan 14, 2017 7:23 pm

Re: [Script] Auto Downloader

Post by Doctor_Arsenic »

Im getting hazy on remembering certain functuons. There is a gui popup function, once you push the popup the you can use Control::setValue to a specific message (if i remember correctly)
I am running 2 promotional campaigns for http://thelandofoz.net/tribes/

You can see how they are doing here:
#1. https://goo.gl/#analytics/goo.gl/uVM7ON/all_time
#2. https://goo.gl/#analytics/goo.gl/c8QSjT/all_time
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: [Script] Auto Downloader

Post by perrinoia »

Yes. It's in your script.

Code: Select all

      GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
      $errorString = "Connection to server error:\n" @ %errorString;
      schedule("Control::setValue(MessageDialogTextFormat, $errorString);", 0);

I'm not sure why that's scheduled for 0 seconds... I wonder if this will work, instead:

Code: Select all

      GuiPushDialog(MainWindow, "gui\\MessageDialog.gui");
      Control::setValue(MessageDialogTextFormat, sprintf("Connection to server error:\n%1\n\nDownload client-side files:\n%2", %errorString, $Server::fileURL));
Image
Doctor_Arsenic
Posts: 31
Joined: Sat Jan 14, 2017 7:23 pm

Re: [Script] Auto Downloader

Post by Doctor_Arsenic »

It schedules to prevent a crash, net kick has to be done the same way. Ill hop on and update some more today
I am running 2 promotional campaigns for http://thelandofoz.net/tribes/

You can see how they are doing here:
#1. https://goo.gl/#analytics/goo.gl/uVM7ON/all_time
#2. https://goo.gl/#analytics/goo.gl/c8QSjT/all_time
User avatar
S_hift
Posts: 1963
Joined: Fri Dec 23, 2011 1:42 pm

Re: [Script] Auto Downloader

Post by S_hift »

Fuckin aye you did it man! I'm guessing this works similar to the meat spin exploit lol but in a good way this time.

I'm gonna start working on maps using opencall 3 terrains and maybe even make my own terrains and ted lighting maps. Omg this is amazing bro
Image <--Click here to subscribe to S_hift's youtube
Click here for full access to all my tribes downloads
Doctor_Arsenic
Posts: 31
Joined: Sat Jan 14, 2017 7:23 pm

Re: [Script] Auto Downloader

Post by Doctor_Arsenic »

As per your request, and yeah it uses the function HTMLOpen. I will work with you to make sure it is compatible with the clientside stuff you make, and hopefully add a decent level of universality to the script as well (which I don't think will be very difficult anyway)
I am running 2 promotional campaigns for http://thelandofoz.net/tribes/

You can see how they are doing here:
#1. https://goo.gl/#analytics/goo.gl/uVM7ON/all_time
#2. https://goo.gl/#analytics/goo.gl/c8QSjT/all_time
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: [Script] Auto Downloader

Post by perrinoia »

The problem is, this script is client side, and obviously exploitable by server hosts.

So, first, clients have to know to download this script, before this script can assist them in downloading map files.

It would probably be a good idea to make this script only work with trusted servers.

Or, you can simply use the same exploit you abused before, but for good instead of evil.
Image
Doctor_Arsenic
Posts: 31
Joined: Sat Jan 14, 2017 7:23 pm

Re: [Script] Auto Downloader

Post by Doctor_Arsenic »

Just updated the script. It now allows you to view the URL, and gives you the option to exit out before being sent to the site.


And yes added protection from exploits will come next, I would more worry about them trying to client crash you with a <image.bmp> than them sending you to a bad website. I just made it so that you can see the URL and opt out if you want before it sends you there.

So the only exploit that I see off the top of my head would be client crashes (and that just means I need to install a couple string checks to get rid of "exploity" text being sent to your popup window via $Server::FileURL)
I am running 2 promotional campaigns for http://thelandofoz.net/tribes/

You can see how they are doing here:
#1. https://goo.gl/#analytics/goo.gl/uVM7ON/all_time
#2. https://goo.gl/#analytics/goo.gl/c8QSjT/all_time
perrinoia
Site Admin
Posts: 3732
Joined: Sun Jul 01, 2012 7:18 pm

Re: [Script] Auto Downloader

Post by perrinoia »

That's easy.
Character Encoding Chart
Classification Included characters
Non-ASCII characters Includes the entire “top half” of the ISO-Latin set 80-FF hex (128-255 decimal.)
Reserved characters ; / ? : @ = & (does not include blank space)
Unsafe characters Includes the blank/empty space and " < > # % { } | \ ^ ~ [ ] `
2 more rows
(Please) Stop Using Unsafe Characters in URLs | Perishable Press
https://perishablepress.com/stop-using- ... s-in-urls/
Image
Post Reply