Clicky

20161016

Telemarketeer afkletser

Deze blog post legt uit hoe je een Fritz!Box instelt om telemarketeers en andere vervelende bellers te blokkeren.

We worden vaak gebeld door bedrijven op tijden dat het niet uitkomt met aanbiedingen waar we geen behoefte aan hebben. Deze bedrijven bellen zonder nummerherkenning (zodat je niet kan zien wie er belt) of met een "bedrijfsnummer". Deze nummers beginnen met 085, 087 of 088.

Bij het blokkeren van ongewenste bellers hebben we twee keuzes:
  1. Het gesprek wordt geblokkeerd. De telefoon wordt niet opgenomen;
  2. Er wordt een bericht afgespeeld. Hierin kan je aangeven waarom de telefoon niet opgenomen wordt en hoe men eventueel wel in contact kan komen.
In dit voorbeeld krijgen ongewenste bellers een bericht te horen (keuze 2). We moeten dus twee dingen instellen op de Fritz!Box:
  1. Het bericht die ongewenste bellers te horen krijgen. Dit gaat via de telefoonbeantwoorder van de Fritz!Box;
  2. De ongewenste telefoonnummers

Aanmaak telefoonbeantwoorder en een bericht opnemen

Maak een "antwoord apparaat" aan op Fritz!Box met deze instellingen (Telephony > Answering Machine):


Het antwoordapparaat kan een audiobestand importeren. Maak een opname (bijvoorbeeld met Audacity), sla dat op in een MP3 bestand. Klik op "Change greeting" bij "Greeting Only" en upload je zojuist opgenomen MP3 bestand. Als dat allemaal gelukt is zie je dit scherm:


Instellen van ongewenste nummers

 

Bellers zonder nummerherkenning

Voor bellers zonder nummerherkenning stel je deFritz!Box zo in (Telephony > Call Handling > Call Diversion):

Bedrijfstelefoonummers

De 085, 087 en 088 nummers worden ook op de "Call Diversion" pagina geconfigureerd. Bijvoorbeeld voor nummers die beginnen met 088 stel je zo in (Telephony > Call Handling > Call Diversion):



Als je dus alles heb ingesteld zie je dit scherm (Telephony > Call Handling):


Vanaf nu zullen alle bellers uit deze lijst je bericht te horen krijgen en wordt jij met rust gelaten. 

Tips


Tips voor het bericht wat ongewenste bellers te horen krijgen:
  1. Vertel waarom ze het bericht horen en geef eventuele andere mogelijkheden aan om in contact te komen (bijv.:"bel met nummerherkenning of met een mobiele telefoon" of "stuur een email");
  2. Doe alsof er een echte beller aan de lijn is:"Hallo met Jan.....(paar seconde wachten).. uuuh, wat was je naam en voor welk bedrijf bel je? ....(paar seconde wachten).... OK, hoe kom je aan m'n telefoonnummer?..." enz., enz.
  3. "Al onze medewerkers zijn bezet, een ogenblik alstublieft...(laat muziek horen)...nog een ogenblik geduld aub...(laat muziek horen)..." enz., enz.

Ongewenste bellers met een "gewoon" telefoonummer

Tegen bellers met een "gewoon" telefoonummer (bijv.: 0202159006) is preventief niet zo veel te doen. Je kan individuele nummers blokkeren. Dit is een voorbeeld hoe nummers meteen geblokkeerd worden (Telephony > Call Handling > Call Blocks):



20160828

Print PDF email attachements with hMailserver and Sumatra PDF

There are situations that you send an email with one purpose only and that is to print a PDF attachment.

In this case we have created a hMailserver script that:
- Checks for a specific email address ("pdfprint@youremaildomain.com");
- Checks a specific Subject field ("[pdfprint]");
- Checks for PDF attachment and if there is one, extract and print it.

To print the PDF, you need to have an app that renders PDFs and prints them. We are using Sumatra PDF, which has a command line interface that exactly does the job.

Steps:
  1. Create a new hMailserver user that will be used as a stub to receive the PDF print emails. Enter a long random password and forget it;
  2. Install Sumatra PDF. Take care of the location of the x86 or x64 version;
  3. Modify Eventhandler.vbs of hMailserver with the code below.
Notes:
  • Emails to "pdfprint@youremaildomain.com" will be discarded (not stored). You will see:
    "APPLICATION"    2284    "2016-08-28 08:48:37.699"    "SMTPDeliverer - Message 119900: Message deleted. Action was taken by script subscribing to OnDeliveryStart."
    " in the hMailserver eventlog;
  • You can address multiple printers (e.g. 2-side, b/w, color)) by adding additional Subject field markers and catch those in the script. Read the Samatra PDF documentation how to connect to specific printers;
  • You can add other attachment extensions (e.g. PNG, BMP, JPG, TXT, DOCX etc.) but then you need an app with a command line interface that is able to print the (extracted) file;
Tips:
  • You can set a rule to forward your emails that have the PDF print Subject marker ("[pdfprint]"). The email will stay in your email box while the PDF attachments are printed anyway
  • Now you can use even your tablet (Android, iPad) or Smartphone (BB, WP8, WP10, Android, iPhone) to print PDF right from your email app;
  • You can have much more checks like attachment size and filename , sender's email domain, etc. Let your fantasy flow!
---8<-------------------------
   Sub OnDeliveryStart(oMessage)
 
        dim wsh, fso, i
        dim AttachmentName, AttachmentType, tempAttachementName, tempFolder, objAttachement
        set wsh=CreateObject("wscript.shell")
        set fso=CreateObject("scripting.filesystemobject")


        tempFolder=fso.GetSpecialFolder(2)
  
        if oMessage.Attachments.Count > 0 then

            For i = 0 To oMessage.Attachments.Count-1

                set objAttachement = oMessage.Attachments(i)

                AttachmentName=tempFolder & "\" & objAttachement.Filename
                objAttachement.SaveAs(AttachmentName)
              
                AttachmentType=fso.GetExtensionName(AttachmentName)
                Select Case lcase(AttachmentType)
                Case "pdf"
                    Call WriteLogfile("Processing PDF attachment: " & AttachmentName)
                  
                    if lcase(oMessage.To)    =    "pdfprint@yourdomain.com"         and _
                        Instr(lcase(oMessage.Subject),"[pdfprint]") > 0      then                       
                        Call WriteLogFile("Printing PDF file for: " & oMessage.From & ", PDF file:'" & AttachmentName)
                        s="""C:\Program Files\SumatraPDF\SumatraPDF.exe"" -print-to-default " & chr(34) & AttachmentName & chr(34) & " -silent -exit-when-done"
                        wsh.run s,0,true
                        Call WriteLogfile("PDF print message processed.")                      
                    end if
                    fso.DeleteFile AttachmentName ,true
                End Select  
            next  
        end if

result.value=1   
End Sub
---8<-------------------------
   

20160801

Embedded binaries in VBscript

As I wrote before, VBscript is boo, boo and should be banned from the earth.

However, you can still do a lot of productive work with it. E.g. answer a long standing question: can I embed binary code, in this example an icon file, in my VBscript?

Yes you can! This is the method:

Step 1: Create a Base64 file from the icon file with the Windows build-in CERTUTIL command:

C:\> CERTUTIL -encode icon.ico icon.b64

The result will be a Base64 encoded "certificate" file. The "certificate" headers are used by CERTUTIL to recognize the start and end of the Base64 code.

Step 2: Append the Base64 code to your VBscript. Each line must be REMmed out to let the script run correctly. In this case the VBscript standard `' ` is used. So the code would look something like this:

' -----BEGIN CERTIFICATE-----
' AAABAAYAEBAAAAAACABoBQAAZgAAACAgAAAAAAgAqAgAAM4FAAAwMAAAAAAIAKgO
' AAB2DgAAEBAAAAAAIABoBAAAHh0AACAgAAAAACAAqBAAAIYhAAAwMAAAAAAgAKgl
' AAAuMgAAKAAAABAAAAAgAAAAAQAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAOLv

' ..
' ..
' AAAAHwAA/AAAAAA/AAD+AAAAAH8AAP+AAAAA/wAA/8AAAAP/AAD/4AAAB/8AAP/4
' AAAf/wAA//4AAH//AAD//8AD//8AAA==
' -----END CERTIFICATE-----


Step 3: Now we have to add some code to extract and decode the Base64 data from the VBscript:

    dim fso : set fso=CreateObject("scripting.FileSystemObject")
    dim wsh : set wsh=CreateObject("wscript.shell")
   
    '--- Extract ICO file in the %TEMP% folder...
    iconFile=fso.GetSpecialFolder(2) & "\icon"
    set f=fso.OpenTextFile(WScript.ScriptFullName)
    s=replace(f.ReadAll,"' ","")
    f.close
    set f=fso.OpenTextFile(iconFile & ".tmp",2,TRUE)
    f.writeline(s)
    f.close
    wsh.run "certutil -decode " & iconFile & ".tmp" & " " & iconFile & ".ico",0,true


This code will read the VBscript, strips the REM code, writes the result in the TEMP folder and uses CERTUTIL to decode the Base64 data in the icon (binary) file in the TEMP folder:

C:\>dir %temp%\icon.ico
 Volume in drive C has no label.
 Volume Serial Number is 7AC3-9DD3

 Directory of C:\Users\thisuser\AppData\Local\Temp

08/01/2016  06:40 AM            22,486 icon.ico
               2 File(s)        
22,486 bytes
               0 Dir(s)  25,406,103,552 bytes free


Now you can piggyback any binary inside your VBscript. Enjoy! 





20160425

'Mail to me' for Outlook clients


The next VBscript sends a file from the command line or dragged to the shortcut of this script to your Outlook email account:

if wscript.arguments.count<>1 then wscript.quit

AttachmentName=wscript.arguments.item(0)

set fso=CreateObject("scripting.filesystemobject")
if not fso.FileExists(AttachmentName) then wscript.quit

Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
objMail.To = "{here the email address to send to@email.nn}"
objMail.Subject = "Received attachement"
objMail.Body = "Attached file: """ & fso.GetFileName(AttachmentName) & """"
objMail.Attachments.Add(AttachmentName)
objMail.Send  
if Err=0 then MsgBox "Successfully sent: "& vbCrLF & "- """ &
fso.GetFileName(AttachmentName) & """"

See also this post.

20160418

Holy sh*t!

From the Intel (McAfee) Privacy Notice of True Key software (some kind of password manager):
 
 Source

Maybe NOT a good idea to use...






20160417

One-click send attachement to email

Yeah, yeah, VBscript is boo, boo and should be banned from the earth. However you can create and use handy scripts without 2 or more academic titles that you need for PowerShell programming or Visual Studio. Also this script does not require any .NET library or Visual Studio runtime installed. It should run from Windows 98 to Windows 10 (W7, W8.1 and W10 were tested).

Sometimes you need to send a file to your own email account. E.g. for the file to be used on another computer, Operating System of even Smartphone. Of course you can start your email program, create a new email to yourself, attach the file and send it. Easier would it be if you just can drag-and-drop the file on an application shortcut or use the Explorer context menu for that.

This post describes a script that using the Collaboration Data Object (CDO) and Gmail to send an attachment to your own email address. I suggest you create a new "VeryComplexNeverUsedBeforeHardToGuess@gmail.com" account for this purpose.

First the script. Edit the lines with your Gmail name, password and your own email address:


    Option Explicit
    dim arg,fso, i, s, objEmail, Subject


    set arg=WScript.Arguments
    set fso=CreateObject("scripting.filesystemobject")

    const GoogleAccount    = "{here your Gmail email name}@gmail.com"
    const GooglePassword   = "{here your Gmail email password}"
    const eMailTo          = "{here you own email address"

'--- Prepare email object variables...

    Set objEmail = CreateObject("CDO.Message")
 objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername")      = GoogleAccount

    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword")      = GooglePassword
    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")        = "smtp.gmail.com"
    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl")        = 1
    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")  = 1
    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")         = 2
    objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")    = 465

'--- Add attachement(s)...
    s=vbCrLf
    for i=0 to arg.count-1
        objEmail.AddAttachment arg.item(i)
        s=s & "- " & fso.GetFileName(arg.item(i)) & vbCrLf
    next

'--- Alternative subject field?  
    Subject=InputBox("Enter subject","Alternative Subject","Attachement received " & s)
    if s="" then wscript.quit
      
'--- Populate other email fields...
    objEmail.From         = GoogleAccount
    objEmail.To           = eMailTo
    objEmail.Subject      = Subject
    objEmail.TextBody     = "Attached you find the next attachements: " & s
    objEmail.Configuration.Fields.Update

'---- Send the email...
    objEmail.Send
    if Err=0 then
        MsgBox "Successful sent attachment(s): " & s
    else
        MsgBox "Something went wrong sending attachment(s): " & s
    end if


You can use the script in different ways:
  1.     From the command line (nah...)
  2.     Drag-and-Drop a file to the shortcut of the script (nice)
  3.     With the Explorer context menu (best!)


Command line (assuming the script's name is SendAttachment-google.vbs and is in the c:\scripts folder):

    C:\> wscript c:\scripts\SendAttachment-google.vbs {path to whatever file you want to send}


Application shortcut:
Create a shortcut on the desktop to the  SendAttachment-google.vbs script. Maybe change the icon picture for better reading. Now just drag-and-drop the file you want to email to the icon.




Explorer context menu:
Create a registry file like this:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Send to email]
[HKEY_CLASSES_ROOT\*\shell\Send to email\command]
@="wscript c:\\scripts\\SendAttachement-google.vbs \"%1\""

Apply this file to the registry. Now you can right-click the file you want to email and select "Send to email":




A success/failure message is shown when done:



Notes:
  •     There is almost no error checking in the script. Most common errors are:
    •  Wrong/typo in email address or password;
    • Sending a not-allowed file type through Gmail;
    • Wrong path of the script vs. configured path in shortcut or registry.
  •     The Gmail password is in clear text. To mitigate that you can encrypt the script to a VBE file with this method. Remember to change the references from VBS to VBE.
  •     Of course you can configure your own SMTP server. When using port 25 change also objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") to 0.
  • You do not need some "Cloud Service" and client that is a available for a shorter or longer period or not available at all for your purpose.
  • You can send a maximum of 2000 emails per day, so spammers, go home!
    
    
    
    
    
    

20160131

Don't use special characters in a password (for your security...)


The SAI Computing Conference 2016 has a registration page where presenters can register. BTW, one of the tracks is "Security". Registering for the conference will display this error when you try to enter a password with 'special' characters:



"For security reasons..." it is not allowed to use special characters (...). I am not sure if this limitation is recommended by security specialists or even this guy.

Real Time Web Analytics