Jump to content
mind

ASCT Server script executing toolset (x32/x64)

Recommended Posts

main.jpg

General description

Arma Server Control Tool can be used to execute SQF scripts on server directly, by using standalone server side application. Idea behind this project is to solve the problem that, in many cases it is hard or straight impossible for server administrator to execute certain scripts on server, also it most likely involves joining server with game client. A lot of times server admins are not able to quickly react to some event on server due to absence of a PC with installed arma nearby. With ASCT all you need to do is to login to your server with remote Desktop or TeamViewer, right click on script.sqf and select ASCT Execute.
 
NOTICE! This application REQUIRE root access to server, you MUST be able to connect to server with remote desktop or TeamViewer. If you have only web access this application is NOT usable.
 

Target audience

This tool supposed to be used only on server side. it is made for server admins and developers. Currently this program can be used only on windows platform.

 

 

Installing

1) Copy paste @asct folder to root of your server alongside with other addons
2) Change your server startup parameters by adding -serverMod="@asct;"
3) Copy paste “asct_console†anywhere you like.
At this point you are basically done, you can now use asct.exe as console app. However there are few optional steps to make your life simpler.
 
4) Optional. If you are running several arma servers on single machine, you should set "instanceID" in order to distinguish arma servers. To do that execute following expression on server init 
asct_instanceID = “your_idâ€; 
Select something descriptive as “your_id†but use only a-z,0-9 and _ characters.
5) Optional. When directory for asct.exe selected, run Add_ASCT_to_context_menu.bat, that should be found in same directory. Remember to run it as administrator. This will add “ASCT Execute†option to windows explorer context menu. In case you have several servers on same machine, open Add_ASCT_to_context_menu_instance_yourID.bat file and edit 3rd line. instead of "yourID" type in same instanceID you used in step 4. Save .bat file and execute it as administrator.
6) Optional. For notepad++ users. Copy paste asct.dll from “Notepad++ plugin†folder to “C:\...\Notepad++\plugins\â€
 

Use as console application

There are several ways to use app. They all have some pros and cons, choose one you like more. For sake of clear examples let`s assume you put asct.exe in C:\asct_console\ folder.
As most console apps, this require user to provide parameters. Only one parameter can be used at once.
 
1) Execute script from file
-f <filename>
Example: C:\>asct_console\asct.exe -f "C:\my scripts folder\script.sqf"
This is simplest method, nothing much to say here, app will read whole file and execute it`s contents. It is also possible to pass only filename, in such case file must be in same folder as asct.exe. This method allow file to have both single line comments // and multiline comments /*   */. However, preprocessor directives are NOT allowed (#include, #define, __MACRO__, etc…). SQF files should be encoded as UTF-8.
 
 
2) Execute expression
-e <expression>
Example: C:\>asct_console\asct.exe -e "diag_log \"hello from RPT\";"
This method is very straightforward, thus can be useful for only very simple commands. As you can see it require to escape inner quotes and some other technical characters like %, it does not support any comments and must have whole expression in single line. However, it might be useful if you like to use asct in conjuration with some batch, PowerShell, VBS or whatever else scripting methods you like. 
 
 
3) Execute base64 encoded expression
-b <base64code>
Example: C:\>asct_console\asct.exe -b ZGlhZ19sb2cgImhlbGxvIGZyb20gUlBUIjs=
This one accepts script expression in form of UTF-8 string encoded as base64. What you see in example is basically “literal†representation of bytes of UTF-8 string diag_log "hello from RPT";  This method combine ability to have whole expression in one line, allowing single and multiline comments and accept expression of any complexity. Encode/Decode algorithm borrowed from here http://www.adp-gmbh.ch/cpp/common/base64.html. You can use online services to encode script as base64, google for it.
 
Optionaly, if you have several instances of arma servers, there is also one additional parameter to tell on which server script must be executed. It can be used in conjuration with other parameters.
-id <instanceID>
Example: C:\>asct_console\asct.exe -f "C:\my scripts folder\script.sqf" -id your_ID
You can use this parameter before or after expression parameter. In this way script will be executed on server with given instanceID.
 
NOTE! In windows, applications have limits on length of parameters. At max it is 32768 characters, but command prompt has own limitation of 8191 character. However, there is no limitation for size of script inside SQF file, so first method can be used on very long scripts.

 

 

Use as notepad++ plugin

npp.jpg

If you are using Notepad++, you can install asct plugin for it. It will allow you to execute scripts directly from notepad++. After plugin is installed (see Install. step 4) you must specify full path to asct.exe. To do that, on toolbar press Plugins->ASCT->Settings. There you will see input box, write full path to ASCT and press OK. When you have your script ready, press Plugins->ASCT->Execute to run it. Notepad++ allow to have several documents opened at same time, but only content from currently active document, will be read and executed.
 
if you have several instances of arma servers, you should add their instanceIDs to a list in settings menu, once it is done, you will be able to select target server with "Execute at..." pressed. It is also possible to select certain server as default target by selecting instanceID from list and pressing "make default" button, after that, selected instanceID will be used in Execute funciton. By pressing "make default" button with no selected server, instanceID will be "unset".
 

Use as windows explorer context menu

cont.jpg

You can also execute scripts directly from windows explorer by using right-click context menu. Follow step 5 from installation to get “ASCT Execute†option in context menu. Now navigate to folder with your script.sqf file, right click it and select “ASCT Executeâ€. As with other methods, here you can have direct execution on each of your server instances.

 

Security & Battleye

This application does not use any “cheating†methods to do it`s job, no memory reading/writing, no dll injections or anything else like this. All it does is using callExtension command to communicate with asct_ext.dll from which receive and call compile expressions.  This application is not meant to be used on client, thus it will be immediately blocked by battleye which is totally intended behavior. On server side, on the other hand, battleye have much less limitations (if any) and allow use any extensions. If you like to use application on client for development/testing feel free to do so with disabled battleye.Similarly, asct.pbo is not signed as it should NEVER be required mod, nor used on clients in actual game. In current implementation, there should be no way for cheaters to exploit application in any way, unless they have root access to server.

 

Web interface

Allowing to have asct available in browser on remote PC is something that I am very interested in doing. I realize many server owners have no root access, only some sort of web control panel with limited functionality. It would be amazing to allow use of asct for them as well. However, such a thing would require A LOT of safety considerations, it is direct control of server execution from internet after all. Does not seems to be very SAFE idea. Nonetheless I will consider implementing this as experiment. If you feel like helping me out with ssl and web development, send me a PM.

 

Current version and goals

Current version of application is 0.9.0.1. Next version will have bug fixing that hopefully will be found in the course on few next weeks. Once all bugs sorted out there will be final version 1.0. There probably will be no new functionality available in final version.

 

License

This application is released under GNU GENERAL PUBLIC LICENSE version 3.
If you redistribute this application, please mention author and give link to this forum page.
 
Changelog
 

 

Version 0.9.0.0
- initial release
 
Verison 0.9.0.1
- Added support for multiply servers
- Added segment/line execution in notepad++
- Additional logging
 
 

Download

Latest version 0.9.0.1 Google drive (both x32 and x64)

 

Older versions:

0.9.0.0 - Google drive

 

Feel like this tool was usefull for you? You can show your appreciation with small donation, thank you!

  • Like 9

Share this post


Link to post
Share on other sites

Pretty nifty tool man! I will definitely will give this a shot.

Questions tho, we run a couple of different instances of Arma on our server. How do you specify what instance you want it to execute on or is single instance-only as of right now?

Share this post


Link to post
Share on other sites

Pretty nifty tool man! I will definitely will give this a shot.

Questions tho, we run a couple of different instances of Arma on our server. How do you specify what instance you want it to execute on or is single instance-only as of right now?

Thats a brilliant quastion, thank you. I actually have an idea how to make it possible to send code to a specific instance of arma.

 

For now though, you are right, one instance only.

  • Like 1

Share this post


Link to post
Share on other sites

Nice tool!

 

Will the source code be available later on?

 

Really wanna learn from it

 

Anyways thanks for sharing it!

Share this post


Link to post
Share on other sites

Great tool!

 

Thanks for making and sharing.

 

/KC

Share this post


Link to post
Share on other sites

@KeyCat, you are welcome!  ;)

 

New version (0.9.0.1) added. Now there is support for multiply arma servers. See updated instructions in first post. Download link to newer version added.

  • Like 1

Share this post


Link to post
Share on other sites

I have another tiny update for you guys. it is for notepad++ plugin only, so I figure out i will silently "replace" version`s 0.9.0.1 "asct.dll". So 0.9.0.1 is latest version, download link updated. So this update allow executing only portion of text from currently opened file. As with "Execute" command, "Execute segment" will use default instanceID.

 

If you have some text selected, you can then press Plugins->ASCT->Execute segment.seg.jpg

 

And if you have nothing selected, the whole line where your caret currently is, will be executedline.jpg

  • Like 1

Share this post


Link to post
Share on other sites

Really nice tool, thanks for sharing.

After installation you can also add the Notepad++ plugin functions to the right click context menu like so:

 

Settings > Edit Popup ContextMenu

Add this XML somewhere:

<Item id="0"/>
<Item PluginEntryName="ASCT" PluginCommandItemName="Execute"/>
<Item PluginEntryName="ASCT" PluginCommandItemName="Execute at..."/>
<Item PluginEntryName="ASCT" PluginCommandItemName="Execute segment"/>
<Item id="0"/>

e.g

wlRLIcy.png

 

Then restart Notepad++ and you're done

4VJDMZL.png

  • Like 2

Share this post


Link to post
Share on other sites

How are you getting on with updating the dll to 64-bit?

It would be a real shame for us to lose this terrific addon, as it is used for quite a lot of things ranging from mission control to player management.

 

Thanks for the effort!

Best regards,

Mokka

Share this post


Link to post
Share on other sites

Sorry for delay... 

Here you go, x64 update. Only one file added "asct_ext_x64.dll" everything else (plugin, exe, bats...) stay same.

See download section for x64 version.

Share this post


Link to post
Share on other sites

How am I only finding out about this now? Why wasn't I told? :)

 

This looks funky. I'm going to be giving this a go later on.

Share this post


Link to post
Share on other sites
2 hours ago, Tankbuster said:

How am I only finding out about this now? Why wasn't I told? :)

 

This looks funky. I'm going to be giving this a go later on.

Hehe, dunno mate, dunno. Let me know if you like the tool.

  • Like 1

Share this post


Link to post
Share on other sites

Well, it works! All I've done is install it and push some commands from notepad++, but I can definitely see the potential,

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×