Send SMS through bibob with Powershell

I thought I had posted this script more than a year ago, but apparently I have not. It is quite similar to the script, I posted recently sending SMS messages through unwire, this just allows bibob customers to send messages through bibobs online gateway.

One thing to notice is that you are required to convert your password in an MD5 hash, before you send it. Here is a function to convert your plain passwords into an MD5 hash (Adapted from a script by Dennis Damen)

[ps]
Function New-MD5Hash {
param(
[Parameter(Position=0, Mandatory=$true)]
[System.String]
$inputString
)
$cryptoServiceProvider = [System.Security.Cryptography.MD5CryptoServiceProvider];
$hashAlgorithm = new-object $cryptoServiceProvider
$hashByteArray = $hashAlgorithm.ComputeHash($([Char[]]$inputString));
foreach ($byte in $hashByteArray) { if ($byte -lt 16) {$result += “0{0:X}” -f $byte } else { $result += “{0:X}” -f $byte }}
write-host $result
}
[/ps]
Example of usage:

Here is the bibob send sms script.
[ps]
<#
.SYNOPSIS
Send SMS through Bibob (Danish mobile phone company)

.DESCRIPTION
Send SMS Text messages through bibob SMS Gateway services

.PARAMETER Content
The text that the message should contain (Strings above 160 Chars will be split) [Mandatory]

.PARAMETER Recipient
The recipient phonenumber (8 digits) [Mandatory]

.EXAMPLE
PS C:\>Send-SMS -Content "Hello handsome" -Recipient 42424242

.INPUTS
System.String,System.Int32

.OUTPUTS
Sends SMS text message

.NOTES

.LINK
about_functions_advanced

.LINK
about_comment_based_help

#>

function Send-SMS {
[CmdletBinding()]
param(
[Parameter(Position=0, Mandatory=$true)]
[System.String]
$Content= "Hello Handsome",
[Parameter(Position=1)]
[System.Int32]
$Recipient=42424242
)
begin {
If ($Recipient -notmatch ‘^(\d{8})$’ )
{Write-Host "Error in Phone Number"
break
}
$Username = "42424242" # The same as your login to bibob.dk (You cannot spoof you sender number, so it is used as sender as well)
$MD5Password = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

}

process {
$objHTTP = New-Object -ComObject MSXML2.XMLHTTP
$SoapServer = "https://www.bibob.dk/SmsSender.asmx"

$XMLString = @"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<SendMessage xmlns="http://www.bibob.dk/">
<cellphone>$Username</cellphone>
<password>$MD5Password</password>
<smsTo>
<string>$recipient</string>
</smsTo>
<smscontents>$content</smscontents>
<fromNumber>$username</fromNumber>
</SendMessage>
</soap:Body>
</soap:Envelope>
"@

$objHTTP.open(‘POST’, $SoapServer, $False)

$objHTTP.setRequestHeader(‘Man’, ‘POST’ + ‘ ‘ + $SoapServer + ‘ HTTP/1.1′)
$objHTTP.setRequestHeader(‘Host’, ‘www.bibob.dk’)
$objHTTP.setRequestHeader(‘Content-Type’, ‘text/xml; charset=utf-8′)
$objHTTP.setRequestHeader(‘Content-Length’, $($XMLString.Length))
$objHTTP.setRequestHeader(‘SOAPAction’, ‘http://www.bibob.dk/SendMessage’)

$objHTTP.send($XMLString)
}
}

[/ps]

Read More

TomTom 930T and Bibob

I just got my new TomTom 930T GPS, I unpacked it and connected it to my phone via Bluetooth, it asked me if I wanted to connect to “internet” and of course I had to try it, it asked me which country I was in, then which phone I had, my Nokia E65 was in the list, then which telco I used… But to my luck mine was not in the list, I know my carrier Bibob uses Sonofon network, so I decided to try choosing that from the menu.. but with no result, then I tried to configure it manually… Still not working.. Then I remebered I wrote a post a while back about getting the phone to work as a modem, back then I figured out that I had to change the connection string to make it work..

I found my old post, typed in the connection string on the TomTom lo and behold… It connected right away… So if you want to connect you TomTom device to you mobile with a Bibob subscription, you will have to put in the following connection string : at+CGDCONT=1,”IP”,”Internet.bibob.dk”

Read More

BiBoB GPRS Internet

Efter jeg er flyttet har jeg ikke fået bestilt internet  i god nok tid :(

 Hvad skal man da bruge al den tid til… Så tænkte jeg, at jeg ville bruge min nye Nokia mobil til at gå på nettet på (E65). Jeg forbinder den til computeren via Bluetooth, og får installeret modem driveren uden de store problemer…Her efter begynder det at gå skævt.. Jeg finder ud af at jeg skal ringe op til *99#, jeg laver så en opkaldsforbindelse uden brugernavn og kodeord, som så ringer op til *99#.. Det går også fint, den forbinder til “netværket” og prøver at registrere computeren derpå.. Det ender med en fejlmeddelelse PPP: 734 fejl… Jeg prøver flere gange uden held.

Idag har jeg så haft snakket med Bibob support, tænkte det kunne jo være, at man skulle ringe op til et andet nummer, eller måske skulle bruge et brugernavn/kodeord… Men dette var ikke tilfældet, og fik at vide af den flinke dame, at hvis det virkede på telefonen burde det også virke på computeren… Efter lang tids prøven frem og tilbage, fandt jeg selv ud af det..

Når man installerer opkaldsforbindelsen henter den noget information fra telefonen om adgangspunktet, dette gemmes som en modem initialiseringsstreng. (Egenskaber for modem, Avanceret, yderligere initialiseringskommandoer)

Her stod der  CGDCONT=,””,”Internet.bibob.dk”

Dette virker ikke, og resultererede i en “PPP:734; ppp-netværksprotokollen blev afsluttet” fejl.

Jeg rettede ovenstående initialiseringsstreng til

at+CGDCONT=1,”IP”,”Internet.bibob.dk”

derefter har jeg ikke haft nogle problemer med at forbinde til nettet. (Ud over telefon regningen)

Read More