📜 ⬆️ ⬇️

Openfire + Miranda NG. One-click remote help and a couple of features.



This article is a remake of a few old notes on how to simplify regular user support tasks using Miranda. In the article you will not find the 1001st how to install Openfire on linux with pass-through authentication, but it will be described what it does:

?replace(?dbsetting(%subject%,?cinfo(%subject%,protocol),MirVer),Miranda NG Jabber 0.95.5.17337 x86 [,,],) 

And how, using this garbage, get remote access to the user desktop, for example, using the same VNC or radmin, simply by clicking on the desired icon directly in the conversation window with the user.

Baseline: Debian 7, Openfire 4.1.3, Miranda NG 0.95.5.
')
The goal in the example will be the automatic launch of Remote Assistance (msra) with the connection to the desired user directly from the Miranda interface. At once I will make a reservation that if necessary you will have to enter all the credentials for access additionally, i.e. these tricks have no effect on safety.

So, Openfire is already configured on debian, and Miranda NG is out of the box with a “domain login” and without registry tweaks clinging to the server without entering credentials. It is also indicated to use the name of the computer as a resource. We are required to take stock Miranda and finish in it a kind of "admin" functionality. For simplicity, I will call assemblies: admin and user. I draw your attention to the fact that any other will suit as a user. The main thing is that somewhere in the MirVer field there is a “resource” field, and the computer name is the resource, but more on that below. Remote Assistance should already work. I repeat, Miranda in our case is just a convenient interface-add-in.

It looks something like this:


First of all, download the current (at the time of writing 0.95.5) Miranda NG stable , as well as the necessary plugins : Actman and Variables. This is the minimum required, but in my build I will show a few others, with whom life becomes more fun. We put the plugins in the Plugins folder, restart Miranda, and now point by point.

1) The main window for working with custom actions inside Miranda is - Settings → Services → Actions → Actions . With the top green plus we create a new script (F2 for renaming), and with the bottom we add the Action “Run” to it (select in the upper right).

Actions Window


2) To run Remote Assistance, you must run msra / offerra computer_name . Actually "Run" contains 2 fields - the path and arguments. The first is the standard way.

 %SystemRoot%\system32\msra.exe 

and in the second, you need to specify that we immediately want to connect to the specified station, passing as the last argument the parked name of the camp from the MirVer field of a specific user. In the current Miranda NG, "MirVer" takes on meaning.

 Miranda NG Jabber 0.95.5.17337 x86 [] 

And we agreed that the name of the computer acts as a resource. Hereinafter, the resource will be WS01 as an example. Note that the second field must be marked as a script (button S, see screen above), otherwise the magic of variables will not work.

3) You can get to the Help “Variable Assistance” either from Settings - Services → Variables → blue V button , or the same V icon by pressing the S / T buttons directly from the Actions dialog.

In the contact properties, the MirVer value looks like Miranda NG Jabber 0.95.5.17337 x86 [WS01] . The point is to find the entries " Miranda NG Jabber 0.95.5.17337 x86 [ " and " ] ", replace them with an empty string and get only WS01 on the output. The code for the command line parameter and name lookup is:

 /offerra ?replace(?dbsetting(%subject%,?cinfo(%subject%,protocol),MirVer),Miranda NG Jabber 0.95.5.17337 x86 [,,],) 

Note that by pressing the S | T buttons, you will be taken to the “text editor”, in which line breaks are allowed, and the result will still be written in one line. Just do not forget about the spaces where necessary and where not needed.

Text editor


? replace (x, y, z, ...) is the replacement of all occurrences of Y in X by Z, multiple arguments Y and Z are possible.

It's all clear. We are looking for in MirVer a couple of the necessary above entries and change to “empty”. But how to get MirVer the right contact? Help us:

? dbsettings (x, y, z, w) - get the setting Z of the plug-in Y of contact X or return W if z does not exist (w is not necessary).

Yeah, already better, but not clearer. This is where the special subject% subject% comes to the rescue, a description of which you will find on the second tab of the Help for Variables window. So, choosing a contact, the% subject% token takes the value of this contact. Conventionally, we communicate with the user, and in% of the subject% is information about this particular contact. Where to get X for? Dbsettings () figured out.

Now you need to know the values ​​of the jabber plug-in for Y (after all, we are talking about jabber) from the selected contact:

? cinfo (x, y) is the information property Y of contact X. Once again, we take the% subject% and look for the protocol property, which will contain information about the currently used protocol, in the property values ​​of which you can find the required MirVer field. Got Y.

Well, the value Z indicates that we want to see just MirVer. W is not needed.
Everything, got the value of Miranda NG Jabber 0.95.5.17337 x86 [WS01] , naturally the name of the camp within each square bracket will be different for each contact.

And then we replace the found waste with? Replace the “Miranda NG Jabber 0.95.5.17337 x86 [by ' empty ' and '] change the' empty 'to, i.e. remove excess. The output is a clean WS01 , which will be substituted in msra / offerra WS01 .

4) The penultimate step is to go to Settings → Services → Actions → Use actions and mark where we want to see the remote assistant button. In my case, this is the button bar in the message window when directly communicating with the user and right click on the contact in the roster.

Use of action


5) It remains to fasten the beautiful, because in a bunch of custom buttons to find the remote assistant will be easier if he has his usual badge. Settings → Icons → Actions → Registered actions → Import icons . Specify the file containing the desired icon, and simply drag it to the desired action. It is really convenient.
Own icon for action


UPD from: MagicEx and Abyss777 Allows you to work with any MirVer, provided that the resource is in square brackets
long from @MagicEx
  strchr (! dbsetting (% subject%,? cinfo (% subject%, protocol), jid), @), 1))? substr (! dbsetting (% subject%,? cinfo (% subject%, protocol), MirVer) ,? add (? strchr (! dbsetting (% subject%,? cinfo (% subject%, protocol), MirVer), [), 1),? sub (? strchr (! dbsetting (% subject%,? cinfo (% subject%, protocol), MirVer),]), 1)) 


short on regexp by @ Abyss777
 ?regexp_substr( \[(.*)\],!dbsetting(%subject%,!cinfo(%subject%,protocol),MirVer),1) 


With this remote assistant everything is, check how it works. You can practice with a couple of other utilities:

Remote Desktop

 %SystemRoot%\system32\mstsc.exe /v:?replace(?dbsetting(%subject%,?cinfo(%subject%,protocol),MirVer),Miranda NG Jabber 0.95.5.17337 x86 [,,],) 

Snap-in computer management

 mmc.exe compmgmt.msc /computer=?replace(?dbsetting(%subject%,?cinfo(%subject%,protocol),MirVer),Miranda NG Jabber 0.95.5.17337 x86 [,,],) 

UltraVNC

 C:\Program Files (x86)\uvnc bvba\UltraVnc\vncviewer.exe ?replace(!dbsetting(%subject%,?cinfo(%subject%,protocol),MirVer),Miranda NG Jabber 0.95.5.17337 x86 [,,],) 

Do not forget that third-party software like UltraVNC must be installed in the system.



Everything seems to be cool. But what if the client is sitting on a different subnet, and indeed has its own DNS suffix? The question of accessing the required subnet will be left at the mercy of the gateway, but the suffix is ​​harder, because there is nothing in the name of the resource about DNS, and it will not be possible to reach the user in another city using the name, the whole FQDN is needed. Fortunately, Miranda with Actman and Variables plugins is so cool that there is a solution. Now in a few words I will tell you how, and for convenience of perception I formatted the code:

 ?puts(comp,?replace(?dbsetting(%subject%,?cinfo(%subject%,protocol),MirVer),Miranda NG Jabber 0.95.5.17337 x86 [,,],)) ?if(?stricmp(?dbsetting(%subject%,CList,Group),), ?puts(grp,.jup.com), ?if(?stricmp(?dbsetting(%subject%,CList,Group),), ?puts(grp,.mars.com), ?if(?stricmp(?dbsetting(%subject%,CList,Group),), ?puts(grp,.venus.com), ?puts(grp,.earth.com) ) ) ) ?insert(?get(comp),?get(grp),?len(?get(comp))) 

The general meaning here is that depending on the group of the roster in which the user is located, add the appropriate DNS suffix. The example uses three groups: Jupiter (.jup.com), Mars (.mars.com), Venus (.venus.com), and Earth (.earth.com), if the user does not belong to any of the specified groups .

1) The first line is used to search for the computer name, we passed this with only one difference, what now with the help ? Puts () write the computer name in the comp variable

? puts (x, y)
? puts (x, y) - saves Y as a variable with the name X

 ?puts(comp,?replace(?dbsetting(%subject%,?cinfo(%subject%,protocol),MirVer),Miranda NG Jabber 0.95.5.17337 x86 [,,],)) 

2) using nested operators ? If () looking for matching groups, suddenly the user in one of them

? if (x, y, z)
? if (x, y, z) - shows Y, if X is TRUE, otherwise shows Z
.
Through ? Stricmp () we check if our friend is from Jupiter and, if so, with the help of a friend? Puts () we assign the value ".jup.com" to the variable " grp "

? stricmp (x, y)
? stricmp (x, y) - true if X = Y, case insensitive

 ?stricmp(?dbsetting(%subject%,CList,Group),),?puts(grp,.jup.com) 

If not from Jupiter, then the next comparison block is executed and, by analogy, another one. As a result, if the user is not found on the three target planets, then by default we assume that he is from Earth and assign the variable grp to the value .earth.com .

3) The final statement ? Insert () through ? Get () `s glues the computer name with the domain name, in the end we get the desired FQDN

? insert (x, y, z)? get (x)
? insert (x, y, z) - inserts the string Y at the position Z in the row X
? get (x) is the variable defined by put named X

 ?insert(?get(comp),?get(grp),?len(?get(comp))) 

? insert () is a hack for outputting the resulting value, since no echo and others are provided.

Naturally, the number of nested statements may be different, depending on your need.

As you can see, with the help of Variables and Actions in Miranda, you can do all sorts of cool things, and the functionality is not limited to the execution of applications with arguments. The rest of the features if desired, you consider yourself. It is easiest to find the necessary protocol values ​​and other things through the DbEditorPP database editor plugin . Actually through this plugin, I opened the necessary property for? Cinfo (x, y), and indeed this tool will still be useful more than once.



I spread the finished user assembly with my own settings and additional plug-ins, with which working in Miranda becomes more convenient. I draw your attention to the fact that only plugins, emoticons and a couple of little things are added to the stock Miranda NG, the rest is tweaked through Settings. The emphasis was on minimal changes of pure Miranda. The user assembly is zakastomizirovana stronger, because it is required to enable or disable a bunch of everything that the user will not do later, and the competent employee in the admin assembly will figure it out himself.

UPD: Admin assembly upon request in the comments. Differences from user:
1) Three plugins added: ActMan, Variables, DbEditorPP
2) Remote Assistance Added
3) Renamed profile directory and launcher removed

I deliberately do not give a link to the admin assembly, because I have it greatly changed from the original and it will be a chore to clean everything. It will be correct to add a couple of plug-ins to the user version and copy a couple of lines from the examples. But if necessary, tell me, lay out.



At the end of the promised couple of features


Miranda, due to the nature of the architecture, has difficulty updating when used in a corporate environment. PluginUpdater is engaged in updating, which simply does not have enough rights to write something to ProgramFiles, where Miranda is installed. The option when the user has write permissions to the installation directory is not considered. As a result, we have a scheme in which Miranda NG itself unfolds in% ProgramFiles%, and the user profile lies in the orthodox right% ApplicationData%. As already said, the feature is that the settings, although they are in the user profile, are strongly tied to the kernel and plug-in versions, in the end, if you just roll a new build over, that is, a non-illusionary chance that everything will break. Option two: do not update anything at all or update, but recreate the user profile Miranda. Both options are bad. In one case, security suffers; in the second, the user loses history, which also fails. And if everything is clear with the first one, I’ll dwell on the update in detail.

I refused the regular installer of Miranda, which is Inno Setup, in favor of a custom script to copy my own build. I will explain why. All mandatory software is deployed using WSUS via LUP ( WPP ), but in the case of Miranda, sometimes, especially at the testing stage, it is necessary to update the test group of users frequently, and the profile with the settings will in any case remain old, i.e. You need to finish it also. In short, I decided to do it easier. The deployment script looks at the version of Miranda on the server, and if it is larger than the one installed on the system, then stupidly bangs it and writes a new one. Ini-file with the version is here MirandaNGCorpMod \ Profiles \ jabber \ profile_settings.ini. Next, the custom launcher, with which Miranda is launched, looks into the installation directory and, if the version is newer than in the user profile, the profile bangs and launches Miranda. Miranda herself using the setting-cln.ini, with the missing profile, creates a new one with the necessary settings. In general, all settings that are different from the default are rendered to settings.ini, and in Mirandaboot.ini this is stated. Next, the launcher waits another couple of seconds and writes a new version to the profile directory (just in case, the plus is 12 attempts in increments of 5 seconds).

The deployment script should be located next to the Miranda directory, the launcher should be in the directory next to miranda32.exe

The script copy user assembly at AutoIT:
 NoTrayIcon ;read current miranda version in ProgramFiles. If error - 0000 $MirCurVer = IniRead(@ProgramFilesDir & '\MirandaNGCorpMod\Profiles\jabber\profile_settings.ini','MirandaNGCorpMod','version','0000') ;read new miranda version in ScriptDir. If error - 0001 $MirNewVer = IniRead(@ScriptDir & '\MirandaNGCorpMod\Profiles\jabber\profile_settings.ini','MirandaNGCorpMod','version','0001') If $MirNewVer > $MirCurVer Then DirRemove(@ProgramFilesDir & '\MirandaNGCorpMod',1) Sleep(300) DirCopy(@ScriptDir & '\MirandaNGCorpMod',@ProgramFilesDir & '\MirandaNGCorpMod') FileCreateShortcut(@ProgramFilesDir & '\MirandaNGCorpMod\miranda_launch.exe',@DesktopCommonDir & '\MirandaNGCorpMod.lnk') FileCreateShortcut(@ProgramFilesDir & '\MirandaNGCorpMod\miranda_launch.exe',@StartupCommonDir & '\MirandaNGCorpMod.lnk') EndIf 


Launcher code:
 #NoTrayIcon $sMirandaOptions = '' ;check for command line options for Miranda32.exe If $cmdline[0] > 0 Then For $i = 1 To $cmdline[0] Step 1 $sMirandaOptions = $sMirandaOptions & ' ' & $cmdline[$i] Next EndIf ;read current miranda version. If error - 0000 $MirCurVer = IniRead(@AppDataDir & '\MirandaNGCorpMod\jabber\profile_settings.ini','MirandaNGCorpMod','version','0000') ;read new miranda version. If error - 0001 $MirNewVer = IniRead(@ProgramFilesDir & '\MirandaNGCorpMod\Profiles\jabber\profile_settings.ini','MirandaNGCorpMod','version','0001') ;if exists version in AppData less than ProgramFiles version, remove MirandaNG profile If $MirNewVer > $MirCurVer Then DirRemove(@AppDataDir & '\MirandaNGCorpMod',1) Sleep(300) EndIf ;run miranda with command line parameters Run(@ScriptDir & '\miranda32.exe ' & $sMirandaOptions) Sleep(2000) ;whaiting for miranda creates default profile "jabber.dat". 12 retries, 5 seconds per step For $i = 1 To 12 Step 1 If FileExists(@AppDataDir & '\MirandaNGCorpMod\jabber\jabber.dat') Then ;copy current "profile_settings.ini" to new profile FileCopy(@ProgramFilesDir & '\MirandaNGCorpMod\Profiles\jabber\profile_settings.ini',@AppDataDir & '\MirandaNGCorpMod\jabber\profile_settings.ini') Exit EndIf Sleep(5000) Next 


If you need the collected versions, tell me, lay out.

In assemblies, you need to enable auto-connection at start Settings → Status → Initial Status → Status Profiles → in the Status window, select “Online” and change the LoginServer parameter to your jabber server. This can be done through Miranda settings or by editing the setting-cln.ini file. Well, before the heap, you can change or remove the splash screen at the start altogether.



On this Miranda, it seems, that’s all, but I can’t help but turn on the hint how to fasten users' photos from ActiveDitectoty :

all matches are random


I will make a reservation, the version of the scheme is not lower than Win2008R2.

1) Include a replica in the GC for the attribute thumbnailPhoto (optional, but worth it)
windowsitpro.com/active-directory/q-how-can-i-add-pictures-my-users-active-directory-ad
It is possible to add via the same link via PS, but it is inconvenient, drive on PS, we go further:

2) Download and install software for uploading photos in AD www.codetwo.com/freeware/active-doryoryphotos Free, you can install anywhere, but run with domain admin rights.

3) In the OpenFire console, twist the parameters:
ldap.override.avatar true

and edit the parameter in vCard to be like this:

 <PHOTO> <TYPE>image/jpeg</TYPE> <BINVAL>{thumbnailPhoto}</BINVAL> </PHOTO> 

4) Restarting OpenFire and MirandaNG sees avatars out of the box, but the user should at least once connect to jabber.

Well, now for sure. I hope the article will be useful, and welcome to the comments.

Source: https://habr.com/ru/post/325860/


All Articles