def test_should_send_single_message(self):
     """Sending a single SMS with the minimum detail and no errors should work"""
     api = clockwork.API(self.api_key)
     sms = clockwork.SMS(to="441234567890",
                         message="This is a test message")
     response = api.send(sms)
     self.assertTrue(response.success)
    def test_should_send_multiple_messages_with_erros(self):
        """Sending multiple sms messages, one of which has an invalid message should work"""
        api = clockwork.API(self.api_key)
        sms1 = clockwork.SMS(to="441234567890", message="This is a test message 1")
        sms2 = clockwork.SMS(to="441234567890", message="")
        response = api.send([sms1, sms2])

        self.assertTrue(response[0].success)
        self.assertFalse(response[1].success)
    def test_should_send_multiple_messages(self):
        """Sending multiple sms messages should work"""
        api = clockwork.API(self.api_key)
        sms1 = clockwork.SMS(to="441234567890", message="This is a test message 1")
        sms2 = clockwork.SMS(to="441234567890", message="This is a test message 2")
        response = api.send([sms1,sms2])

        for r in response:
            self.assertTrue(r.success)
示例#4
0
 def sendMessage(self, telephone):
     msg = "Welcome to Steadlly. Please insert the following code, to confirm the account: " + str(
         randint(0, 9999))
     api = clockwork.API(self.msgapi, from_name='Steadlly')
     message = clockwork.SMS(to=telephone, message=msg)
     response = api.send(message)
     if response.success:
         # print(response.id)
         return True
     else:
         raise ('Something went wrong sending the message',
                'response.error_code + response.error_description')
         return False
示例#5
0
def smssender(sendername, time, message):
    if debug: print("DEBUG - smssender(): called")
    sms_rec_list = str(sms_receivers).split(",")
    api = clockwork.API(clockworkapikey)
    smsmsg = sendername + ", " + unicode(time) + ": " + message
    for s in sms_rec_list:
        message = clockwork.SMS(
            to = s,
            message = smsmsg)
            #message = sendername.encode('utf-8') + ", " + str(time) + ": " + message.encode('utf-8'))
        response = api.send(message)
        if response.success:
            print (response.id)
        else:
            print (response.error_code)
            print (response.error_message)
    if debug: print("DEBUG - smssender(): finished")
 def test_should_send_single_unicode_message(self):
     """Sending a single SMS with the full GSM character set (apart from ESC and form feed) should work"""
     api = clockwork.API(self.api_key)
     sms = clockwork.SMS(
         to="441234567890",
         #Message table copied from http://www.clockworksms.com/doc/reference/faqs/gsm-character-set/
         message=u'''@£$¥èéùìòÇ\nØø\rÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ'''
                 u''' !"#¤%&'()*+,-./'''
                 u'''0123456789:;<=>?'''
                 u'''¡ABCDEFGHIJKLMNO'''
                 u'''PQRSTUVWXYZÄÖÑܧ'''
                 u'''¿abcdefghijklmno'''
                 u'''pqrstuvwxyzäöñüà'''
                 u'''€[\]^{|}~'''
         ,long=True)
     response = api.send(sms)
     self.assertTrue(response.success)
示例#7
0
def texthere(phoneno, textmsg):
    from clockwork import clockwork

    api = clockwork.API('64cb471a7ba66565a1965ac118baadffb36e7b1e')

    message = clockwork.SMS(to=phoneno, message=textmsg)

    try:
        response = api.send(message)
        logfile = open("logfile", "a")

        if response.success:
            logfile.write(str(response.success) + "\n")
        else:
            logfile.writelines(
                [phoneno, response.error_code, response.error_message])
    except:
        pass
示例#8
0
import configparser
import logging
import logging.handlers
from clockwork import clockwork

logging.basicConfig(format="%(asctime)s - %(levelname)s: %(message)s",
                    level=logging.INFO,
                    datefmt="%m/%d/%Y %I:%M:%S %p")

logger = logging.getLogger("logger")

logger.setLevel(logging.INFO)
handler = logging.handlers.RotatingFileHandler("pastehunter2.log",
                                               maxBytes=100000,
                                               backupCount=5)
handler.setFormatter(
    logging.Formatter("%(asctime)s - %(levelname)s: %(message)s"))

logger.addHandler(handler)
logger.propagate = False

config = configparser.ConfigParser()
logger.info("Reading config.ini, fields are not checked!")
config.read("./config.ini")

if not config.sections():
    logger.error("Config file seems empty or missing!")
    sys.exit()

clockworkapi = clockwork.API(config["clockwork"]["api"])
示例#9
0
文件: sms.py 项目: Actime/api
from clockwork import clockwork

api = clockwork.API('05cf0deeaa97a4fb5751ddcfb46889b1f15b3d0c')


def send_time_message(number, event, time):
    """
    This will send a message with the time registered
    """
    # Message variable
    message = clockwork.SMS(
        to=number,
        message=
        ("Tú tiempo ha sido {0}, puedes checar los detalles en http://actime.mx/event/rd/{1}. ¡Gracias por competir con Actime!"
         ).format(time, event.pk))
    # get the response
    response = api.send(message)
    # validate if the response is successful
    if response.success:
        print(response.id)
        return True
    else:
        print(response.error_code)
        print(response.error_message)
        return False
    # End of validations


# End of send_time_messsage function
示例#10
0
from clockwork import clockwork
import os

import requests

from send.boardSender import encode_board

api = clockwork.API(os.environ.get('CLOCKWORK_API_KEY'))


def send_message(to, text):
    if os.environ.get('SEND_SMS') != 'True':
        print('Would have sent "' + text + '" to ' + to)
    else:
        from_name = os.environ.get('FROM_SMS')
        print('Sending "' + text + '" to ' + to + " from " + from_name)
        message = clockwork.SMS(to=to, message=text, from_name=from_name)

        response = api.send(message)

        if response.success:
            print(response.id)
        else:
            print(response.error_code)
            print(response.error_message)


def send_message_with_board(to, text, board):

    if os.environ.get('SEND_SMS') != 'True':
        print('would have sent ' + text + ' - with board to ' + to)
示例#11
0
from clockwork import clockwork
import time
import random
import logging

logging.basicConfig(filename="status.log", level=logging.INFO)

api = clockwork.API("SECRET_KEY_HERE")

lyrics = open("bohemian.txt", "r").readlines()

for line in lyrics:
    payload = line.replace("\n", "")
    logging.info("Sending: {}".format(payload))
    message = clockwork.SMS(from_name="F Mercury", to="61000000000", message=payload)
    response = api.send(message)

    if response.success:
        logging.info("Success")
        logging.info(response.id)
        logging.info("\n")
    else:
        logging.info("Failure")
        logging.info(response.error_code)
        logging.info(response.error_message)
        logging.info("\n")
    time.sleep(random.randrange(300, 600))
    time.sleep(10)

logging.info("All done")
 def test_should_be_able_to_get_balance(self):
     api = clockwork.API(self.api_key)
     balance = api.get_balance()
     self.assertEqual('PAYG', balance['account_type'])
示例#13
0
from clockwork import clockwork

api = clockwork.API('6dbd7ee0c11c49d41c298bbb4cf84edea3eda846')

message = clockwork.SMS(to='14196356328', message='Test Message - Steven Kast')

response = api.send(message)

if response.success:
    print('Success ' + response.id)
else:
    print(response.error_code)
    print(response.error_message)
示例#14
0
from newsapi import NewsApiClient
import requests
import json
import datetime
import sqlite3
import schedule
import time
import datetime
from clockwork import clockwork
api = clockwork.API("366aec027c364b3314327812f33da2557d51a731")


def NewTimer():  #Sends SMS related to Perscription
    conn = sqlite3.connect("UserDB.db")
    cur = conn.cursor()
    cur.execute(
        "SELECT Users.PhoneNum, Link.TimeMedHour, Link.TimeMedMin , Medication.MedicationName , Link.AmountLeft,Link.UserID FROM Users,Link,Medication WHERE NotifMed = ? AND Users.UserID = Link.UserID AND Medication.MedID = Link.MedID",
        [1])
    #Pulling the PhoneNumber for a User aswell as the Time they need to take their medication, the name of the medication and the amount of medication they have left.
    data = cur.fetchall()
    datalen = len(data)
    j = 0
    #iterate through the array of phonenumbers from the database that have opped into the service
    for j in range(datalen):
        now = datetime.datetime.now().replace(microsecond=0)
        #defining vars for function
        PHONENUMBER = data[j][0]
        HOUR = data[j][1]
        MIN = data[j][2]
        MED = data[j][3]
        AmountLeft = data[j][4]
 def test_should_fail_with_no_to(self):
     """Sending a single SMS with no message should fail"""
     api = clockwork.API(self.api_key)
     sms = clockwork.SMS(to="", message="This is a test message")
     response = api.send(sms)
     self.assertFalse(response.success)
示例#16
0
文件: spoofer.py 项目: hunoof/spoofer
from clockwork import clockwork
import time
api = clockwork.API("0a5b9f809d353f0404525a6a7a116909178991cb")
lyrics = open("lyrics.txt", "r").readlines()
for line in lyrics:
    payload = line.replace("\n", "")
    message = clockwork.SMS(from_name = "MICHHI PUTTU", to = "917754915707", message = payload)
    response = api.send(message)
    print(response)
    time.sleep(300)
示例#17
0
def sendsms(body,
            job,
            number,
            sender=False):  # seperated function for checking
    global N, jobs
    Err_N = 0
    while True:
        try:
            API_Key = get_account(N)
            client = clockwork.API(API_Key)
            print("[+]", API_Key, job)
            if sender:
                message = clockwork.SMS(to=number,
                                        message=body,
                                        from_name=sender)
            else:
                message = clockwork.SMS(to=number, message=body)
            response = client.send(message)
            if response.success:
                print("\t\t[-]", 'Sent message', ":".join(job))
                print("\t\t[-]", 'Remaining balance is', client.get_balance())
                success_jobs.append(job)
                return True
            else:
                er = int(response.error_code)
                print("\t\t[-]", "error code :", er)
                if er == 1:
                    print("\t\t[-]", "Something went wrong in our API")
                elif er == 12:
                    print("\t\t[-]", "Message text is too long")
                elif er == 13:
                    print("\t\t[-]",
                          "You don't have an international contract")
                elif er == 15:
                    print("\t\t[-]", "you Cannot  send SMS to this country")
                elif er == 17:
                    print("\t\t[-]", "You IP address is blocked")
                elif er == 25:
                    print(
                        "\t\t[-]",
                        "Your account is setup to require a unique Client ID on each message, we've seen this one before."
                    )
                elif er == 26:
                    print("\t\t[-]", "Something went wrong in our API")
                elif er == 33:
                    print(
                        "\t\t[-]",
                        "Your account is setup to check for a unique client ID on every message, one wasn't supplied in this send."
                    )
                elif er == 40:
                    print("\t\t[-]", "MMS text has an invalid character")
                elif er == 41:
                    print("\t\t[-]", "MMS Payload can't be decoded as hex")
                elif er == 42:
                    print("\t\t[-]", "MMS payload can't be decoded as Base64")
                elif er == 43:
                    print("\t\t[-]", "No content type provided on MMS payload")
                elif er == 44:
                    print("\t\t[-]", "All MMS Payload parts must have an ID")
                elif er == 45:
                    print("\t\t[-]",
                          "The combined parts are too large to send")
                elif er == 49:
                    print("\t\t[-]",
                          "All MMS parts must have unique filenames")
                elif er == 57:
                    print(
                        "\t\t[-]",
                        "You need to provide an API Key or a Username and Password when calling the API"
                    )
                elif er == 58:
                    print(
                        "\t\t[-]",
                        "Log in to your API account to check the key or create a new one"
                    )
                elif er == 59:
                    print(
                        "\t\t[-]",
                        "This account isn't allowed to use a Username and Password, log in to your account to create a key"
                    )
                elif er == 60:
                    print(
                        "\t\t[-]",
                        "Sometimes your message will be caught by our spam filter. If you're having trouble because of this error - get in touch and we'll get you up and running. Include an example of the message that was caught if you can"
                    )
                elif er == 100:
                    print("\t\t[-]", "Something went wrong in our API")
                elif er == 101:
                    print("\t\t[-]", "Something went wrong in our API")
                elif er == 102:
                    print("\t\t[-]", "API Post can't be parsed as XML")
                elif er == 305:
                    print("\t\t[-]",
                          "You've sent too many status requests this hour")
                N = (N + 1) % len(accounts)
                Err_N += 1
                if Err_N > len(accounts):
                    print(
                        "problem happen with all accounts , or there is a problem with connection / and your file : job, account, sender,link, body"
                    )
                    failed_jobs.append(job)
                    return
        except Exception as e:
            print("\t\t[-]", e, ":", API_Key)
            print()
            #print("[-]\t\tLogin Failed:", API_Key)
            N = (N + 1) % len(accounts)
            Err_N += 1
            if Err_N > len(accounts):
                print(
                    "problem happen with all accounts , or there is a problem with connection / and your file : job, account, sender,link, body"
                )
                failed_jobs.append(job)
                return
示例#18
0
            Err_N += 1
            if Err_N > len(accounts):
                print(
                    "problem happen with all accounts , or there is a problem with connection / and your file : job, account, sender,link, body"
                )
                failed_jobs.append(job)
                return
            #print("Try with other credential")


N, X, S = 0, 0, 0
L_th = []
print("[!] Start at: " + timer() + "")
print("[+] cheking accounts balences  :")
for i in accounts:
    client = clockwork.API(i)
    balance = float(client.get_balance()['balance'])
    if balance < limit_amount:
        accounts.remove(i)
        print("\t", i, balance, 'disable')
    print("\t", i, balance, 'active')
print("\t", "-----------------------------")
print("\t", "Total active accounts", len(accounts))
if (len(accounts) < 1):
    print("\t", "there is active accounts")
    sys.exit()

for j in jobs:
    if j != "":
        job = j.split(":")
        try:
示例#19
0
from clockwork import clockwork
api = clockwork.API('58e9ab3962aad466a70f82c8f010296afea659be',
                    from_name='Sparebank1')
message = clockwork.SMS(to='4798232848',
                        message='Sikkerhetsbrudd i banken. Kom snarest.')
response = api.send(message)

if response.success:
    print(response.id)
else:
    print(response.error_code)
    print(response.error_message)
 def test_should_fail_with_invalid_key(self):
     api = clockwork.API("this_key_is_wrong")
     sms = clockwork.SMS(to="441234567890", message="This is a test message 1")
     self.assertRaises(clockwork_exceptions.ApiException, api.send, sms)
示例#21
0
__author__ = "Christopher Sweet"
__version__ = 0.1
"""
SMS Spoofer is a script to spoof sms messages from various senders
"""

from clockwork import clockwork
import random

area_codes = [301, 311, 316, 210, 310, 365, 380, 401, 432, 447, 505, 512, 567]
api = clockwork.API("0e7f44b7bf646ccdf1361c37acd171ae4d1056da")

recipient = 0
sender = 0
#Build random sender number
rand_sender = int(str(area_codes[random.randint(0,12)]) + str(random.randint(0,585)) +
    str(random.randint(0,5000)))
msg = "Testing"
message = clockwork.SMS(from_name = sender, to = recipient, message = msg)
response = api.send(message)
示例#22
0
from clockwork import clockwork
import time

api = clockwork.API('')

print("Starting Program")

message = clockwork.SMS(
    to='phone number',
    message=
    'Hello I hope your day is as good as mines..........................')

response = api.send(message)

if response.success:
    print(response.id)
else:
    print(response.error_code)
    print(response.error_message)

print("Complete!")