Page 1 of 1

Extracting list of handled mail domains from Mailwasher

Posted: Fri Oct 17, 2014 3:47 pm
by CorporateBackup
I'm wondering if there is any way from the command line to get a list of domains MailWasher Pro is currently handling? Either an actual command, or looking in a config file, or anything of that nature.

Essentially, I'm after the same information which is displayed in the Mailwasher web portal when clicking "Settings" and then "Domains", ie http://localhost:4044/Domains.srv
WGET is of course a possibility, but there's the issue of having to log on through the interface first.

Ideally, I'm looking to pull the list into a Perl script and compare it against a master list.

Re: Extracting list of handled mail domains from Mailwasher

Posted: Fri Oct 17, 2014 4:58 pm
by rusticdog
Hi Steve

No idea myself, but will ask the guys.

Re: Extracting list of handled mail domains from Mailwasher

Posted: Fri Oct 17, 2014 5:42 pm
by nick.bolton
Hi Steve

Does this help?

See version history for version 2.8.1.0 at http://www.firetrust.com/en/products/ma ... on-history

set in mwes.conf/windows registry (HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Firetrust Limited\mwes) by default this is set to zero.
use_remote_action=1

examples.
get/post

Login
-----

Use either servlet to login
http://localhost:4044/SystemConfig.srv? ... id=admin&p...
http://localhost:4044/Domains.srv?remot ... min&passwo...
{"remoteActionResponse":"success"}

Note. When successfully logged in will use session id

configure table request/response
--------------------------------

http://localhost:4044/SystemConfig.srv? ... a_hostname
{"remoteActionResponse":"get", "mta_hostname":"mail.firetrust.com"}

http://localhost:4044/SystemConfig.srv? ... ta_hostnam...
{"remoteActionResponse":"success"}

Domain table request/response
-----------------------------

http://localhost:4044/Domains.srv?remot ... rust.co.nz
{"remoteActionResponse":"success"}

query no wild card(*) required.
http://localhost:4044/Domains.srv?remot ... =firetrust
{"remoteActionResponse":"success", "domains":["firetrust.com", "firetrust.co.nz"]}

http://localhost:4044/Domains.srv?remot ... iretrust.c...
{"remoteActionResponse":"success"}

A user made this based on the remote actions we enabled.

https://github.com/xallen/plesk-mwes-connector

Re: Extracting list of handled mail domains from Mailwasher

Posted: Fri Oct 17, 2014 9:53 pm
by CorporateBackup
Potentially, although I'll admit I have zero experience in the use of servlets. Putting the URL into IE gives the expected {"remoteActionResponse":"success"} if I use http://localhost:4044/Domains.srv?remot ... HEPASSWORD, and then the information I want if I follow it up with http://localhost:4044/Domains.srv?remoteAction=query, but I was hoping to be able to do this with WGET or something similar.

Currently, attemping to plug Domains.srv?remoteAction-login&etcetc into wget gives me:
'userid' is not recognized as an internal or external command, operable program or batch file.
'password' is not recognized as an internal or external command, operable program or batch file.

It'd be nice if the domains were in a flat file, or even in the registry - I know how to pull them out of there! I guess I could install a sniffer and see what the page is that gets sent when MWES is logged into via the web console, and then see if I could replicate that in wget, but I'm holding out hope that there's an easier way.

Re: Extracting list of handled mail domains from Mailwasher

Posted: Fri Oct 17, 2014 11:36 pm
by nick.bolton
Ok, let me ask the programmers but I won't get an answer until Monday

Re: Extracting list of handled mail domains from Mailwasher

Posted: Mon Oct 20, 2014 2:12 pm
by nick.bolton
Can you try this instead. Go to http://www.sqliteexpert.com/download.html and download the Professional Trial version (it's fully featured for 30 days)

Then load the database in from c:\Program Files\MailWasher Enterprise Server\data\mwes.db

Go to the domains table


To export data from a grid to a text file, follow the next steps:

1. Select Export to text file from the grid pop-up menu.

2. The 'Export text file' dialogs pops up. This allows you to choose the destination file name and the delimiter. The following delimiters are supported: comma, semicolon and tab.

3. Choose the destination file and the delimiter.

4. Click the 'Start' button to start the export process.

Re: Extracting list of handled mail domains from Mailwasher

Posted: Mon Oct 20, 2014 10:34 pm
by CorporateBackup
That's fair enough, but I'll need to be able to extract the list quite often, and beyond the 30-day trial limit of the third-party program.

I'm having a modicum of success extracting the list of domains from the raw db file in Powershell - I'm up to about 80%. A command-line SQL tool would be useful here; I'll see if I can scrape one up.

Re: Extracting list of handled mail domains from Mailwasher

Posted: Tue Oct 21, 2014 8:33 pm
by CorporateBackup
(Update for Googlebait: sqlite3 seems to do the trick quite well. Use "SELECT * FROM domains" to spit out the list of domains in the mwes.db file.)

Re: Extracting list of handled mail domains from Mailwasher

Posted: Tue Oct 21, 2014 8:42 pm
by nick.bolton
Good to hear, yes a simple select query should do it.

Re: Extracting list of handled mail domains from Mailwasher

Posted: Thu Nov 06, 2014 3:32 pm
by CorporateBackup
For future reference and forum searches, the following line in a CMD shell in the same directory as the sqlite3.exe file appears to do the job:

Code: Select all

for /F "delims=^| tokens=2 usebackq" %a in (`sqlite3.exe "c:\Program Files\MailWasher Enterprise Server\data\mwes.db" "select * from domains;"`) do @echo %a
To run it silently from any directory, and have the output sorted, use the following syntax:

Code: Select all

@(for /F "delims=^| tokens=2 usebackq" %a in (`\full_path_to_exe_file\sqlite3.exe "c:\Program Files\MailWasher Enterprise Server\data\mwes.db" "select * from domains;"`) do @echo %a)|sort