Scroll

Link encryption by batch

Link encryption by batch

Follow
Summary This article is a description of a Webprod feature
Applies to askiaweb
Written for developers ; security administrators ; field managers
Keywords URL ; short ; pretty ; prettify ; webprod ; 5.3.5 ; PowserShell; ps1; link ; encryption ;batch; feature ; highlight

Starting 5.3.5, you have the ability to send survey links with the URL encryption / prettyfying (see the article here) . Until now, the encryption can only be done manually, and, was only reserved for StartSurvey link type. That's why we have created a script which allow you to encrypt survey links by batch, based on CSV file. With this script, you can encrypt many URLs at once.

 

What do you need:

  • Webprod version 5.3.5 and above.
  • ISAPI filter activated
  • ps1 (Script powershell)

 

1/ first step is to customise the ps1 attached.

Open it in notepad and modify the line 20 ($server) and replace the 'localhost' by your production server URL (ex: 'web.askia.com')

 

 

2/ prepare your csv file.

The csv file must at least contains a 'Url' column, with the full link (including parameters) you want to encrypt:

 

3/  run the script from a powershell prompt. You can use these 3 parameters.

  • -CsvFileInput: name and path of the input CSV file (mandatory)
  • -CsvFileOutput: name and path of the output file (optional: If this is missing, we’ll use the input CSV with -OUTPUT appended)
  • -UrlField: name of the field which contains the URL into the csv file (if you're using another name than 'Url' -the default one- into your csv file).

So, in this example, the file is named: file9.csv, and the header for the URL field is 'Url'. The command line will be formatted like this (please note the "." in front of the command line):

 

."D:\UrlEncryption\EncryptWebProdLinksCsv.ps1" -CsvFileInput "D:\UrlEncryption\file9.csv"

And you will get this into your output file:

A standard DoExternalPanel link with extra parameters:

http://10.0.0.67/WebProd/cgi-bin/askiaext.dll?Action=DoExternalPanel&SurveyName=fullurl&Broker=askia&BrokerPanelId=4&tT=ad

Will be encrypted like this:

http://10.0.0.67/WebProd/~jgAqch8-_cm6F4j1VIJMvSW8l_cYjUaX

 

The output CSV also escapes all text fields with quotes. That’s done by Powershell because that’s correct CSV.

 

Important thing to know:

You can get an error while encrypting a link if the link to encrypt has a length greater than 260 characters. It's because the Http.sys service is coded with default maximum of 260 characters per Url segment. The solution here is to add a regkey on the Webprod server. Key to add:               

                Path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\HTTP\Parameters

                Value: UrlSegmentMaxLength

                Type: Reg_DWORD

                Data: Desired amount. (Max Value is 32766)

Restarting the PC is required after having added this key.

Have more questions? Submit a request

Comments

  • Avatar
    Nishant1 Shah

    In which all scenarios would this be useful?