Recently I faced a problem of sending sms to a number that was not completely known: I had three missing digits. Like you know somebody can leave his number in such way: +380986*581**. I found that Skype provides developer tools for building a bot, but failed to implement anything probably because it was too late at night. So results in google showed that there is another library that can attach to running process of skype - Skype4Py. Simple script came up after couple of minutes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# -*- coding: utf-8 -*-
import time
import Skype4Py
import click


def main():
skype = Skype4Py.Skype()
skype.Attach()
number_template = '+3809865{}81{}{}'
for i in range(0, 1000):
i1 = i // 100
i2 = i // 10 % 10
i3 = i % 10
phone = number_template.format(i1, i2, i3)
click.secho('Sending {} sms to {}...'.format(i, phone), fg='blue')
text = 'Wanna say something {} time...'.format(i)

sms = skype.SendSms(phone, Body=text)
time.sleep(0.5)

click.secho('Finished', fg='green')


if __name__ == '__main__':
main()

We need this additional timeout between sending messages, so Skype will have enough time to process message queue that is growing very fast. Also you can accomplish this brute forcing of all possible numbers by using product method from itertools.

1
2
3
4
from itertools import product

for i1, i2, i3 in product(range(10), range(10), range(10)):
print(i1, i2, i3)

Note

On MacOS X because of 32-bit issue you may encounter segmentation fault error. To avoid this just append this to a command while launching script

1
$ arch -i386 python sms_sender.py

The saddest thing is that you have to use Python 2.7 and 3 is not supported.

skype logo

And as not all of your numbers will be valid ones that are currently maintained by a provider you might get dozens of messages about failed delivery. For 1K numbers I had something about 150 effective numbers. And of course you will be charged for sending those messages! I believe there is also an ability to check programmatically whether message delivery failed, but it was not a point for me at that moment. And as always - you are able to create some cool stuff, so do not hesitate to use your brain.

console logs

Resources