Advertisement
Guest User

Untitled

a guest
Aug 13th, 2012
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 12.86 KB | None | 0 0
  1. import httplib, urllib
  2. import mechanize
  3. import cookielib
  4. from mtTkinter import *
  5. import tkSimpleDialog as tks
  6. from threading import Thread
  7. from time import sleep
  8. import sys
  9. import os
  10. import subprocess
  11. import psutil
  12.  
  13. class Thread(Thread):
  14.     def __init__(self, command, call_back):
  15.         self._command = command
  16.         self._call_back = call_back
  17.         super(Thread, self).__init__()
  18.        
  19.     def run(self):
  20.         self._command()
  21.         self._call_back()
  22.  
  23. def textSpam(p_number, p_from, p_subject, p_carrier, p_message, p_textnumber):
  24.  
  25.     p_carrierdict = {'VerizonPCS':'203','GrayLink/Porta-Phone':'90','MCIPage':'106','MCIPhone':'105','Orange(UnitedKingdom)':'6','Tele2Latvia':'187','Comviq':'73','P&TLuxembourg':'141','TIM':'193','WesternWireless':'212','BellSouth':'50','ComviqGSM(Sweden)':'10','CookPaging':'74','O2':'131','WebLinkWireless':'210','KyivstarGSM(Ukraine)':'25','T-Mobile/Voicestream':'182','SatelindoGSM':'165','MiWorld':'113','SBCAmeritechPaging':'167','Mobitel(Tanzania)':'19','Netcom':'128','Motient':'123','PlusGSM':'151','SunriseMobile':'179','HoustonCellular':'93','TelenorMobil(Norway)':'12','Oskar':'140','SmartTelecom':'172','Orange-NL/Dutchtone':'139','CellularOneEastCoast':'57','MobistarBelgium':'119','PageNetCanada':'146','ProPage':'157','SprintPCS':'176','CarolinaMobileCommunications':'56','VerizonPagers':'202','VodafoneUK':'209','PondicherryBPLMobile':'152','D1DeTeMobil(Germany)':'15','MobitelTanzania':'120','Satellink':'166','MaharashtraBPLMobile':'102','Optimus(Portugal)':'21','Primtel':'156','BPLmobile':'55','OptusMobile':'136','AT&TPCS':'41','T-MobileGermany':'184','TMN(Portugal)':'22','SkytelPagers':'170','Mobilecomm':'115','MumbaiBPLMobile':'125','D2MannesmannMobilefunk(Germany)':'16','BlueSkyFrog':'52','BellAtlantic':'45','PageMart':'143','BluegrassCellular':'53','Comcast':'71','CellularOneWest':'61','Digi-Page/PageKansas':'77','Safaricom':'164','SCS-900':'168','Kyivstar':'99','NBTel':'127','CenturyTel':'64','EMT':'83','CricketWireless':'215','TeleDanmarkMobil(Denmark)':'7','ChennaiRPGCellular':'65','VirginMobile':'205','SouthwesternBell':'174','Orange':'137','CorrWirelessCommunications':'75','Sonofon(Denmark)':'8','OnlineBeep':'135','Boost':'54','Escotel':'84','TeliaMobitel(Sweden)':'9','BellSouth(Blackberry)':'49','ACSWireless':'31','RogersCanada':'163','CingularWireless':'69','BeeLineGSM':'44','Wyndtell':'213','TelecomItaliaMobile(Italy)':'3','GoaBPLMobil':'88','3RiverWireless':'30','AlphaNow':'34','Eurotel(CzechRepublic)':'28','NPIWireless':'129','SunCom':'178','SurewestCommunicaitons':'180','ChennaiSkycell/Airtel':'66','PacificBell':'142','AirtouchPagers':'33','Alltel':'35','CellularOnePCS':'59','Dobson-AlexWireless/Dobson-CellularOne':'79','GalaxyCorporation':'86','PersonalCommunication':'149','OrangeMumbai':'138','Movistar':'124','CellularOneSouthWest':'58','Telecel(Portugal)':'20','TamilNaduBPLMobile':'186','Qualcomm':'159','Si.Mobil(Slovenia)':'26','GCSPaging':'87','LauttamusCommunication':'100','MumbaiOrange':'126','Microcell':'111','Celcom(Malaysia)':'18','LMT(Latvia)':'23','Pioneer/EnidCellular':'150','Powertel':'153','DTT-Mobile':'80','Telus':'192','Qwest':'160','VodafoneJapan':'207','UttarPradeshEscotel':'201','MTS(Russia)':'1','VodafoneSpain':'208','PageMartAdvanced/2way':'144','VodafoneItaly':'206','Uraltel':'198','DelhiAritel':'76','MorrisWireless':'122','GoldenTelecom':'89','E-Plus(Germany)':'17','BellMobility':'48','Fido':'85','MidwestWireless':'112','Meteor':'107','Cellis&LibanCell(Lebanon)':'29','Vessotel':'204','KolkataAirtel':'98','TelefonicaMovistar':'188','AmeritechPaging':'37','Europolitan(Sweden)':'11','AdvantageCommunications':'32','AT&TPocketnetPCS':'42','Beepwear':'43','T-MobileUK':'185','Teletouch':'190','CarolinaWest':'223','USCellular':'199','ArchPagers(PageNet)':'40','TSRWireless':'195','DobsonCellularSystems':'78','Mobitel(Slovenia)':'27','RAMPage':'161','CentralVermontCommunications':'63','TeliaDenmark':'191','Metrocall2-way':'109','KeralaEscotel':'97','STPaging':'177','PlusGSM(Poland)':'14','Nextel':'214','LMT':'101','InfopageSystems':'94','PCSOne':'148','Cingular':'68','Swisscom':'181','Telenor':'189','CincinnatiBell':'67','Dutchtone/Orange-NL':'81','Max.Mobil(Austria)':'5','Triton':'194','AmeritechClearpath':'38','SFRFrance':'169','CellularSouth':'62','OneConnectAustria':'134','ManitobaTelecomSystems':'104','USWest':'200','GTE':'91','VodafoneOmnitel(Italy)':'4','MetroPCS':'110','PublicServiceCellular':'158','NetcomGSM(Norway)':'13','CellularOne':'60','RogersAT&TWireless':'162','MobilecomPA':'114','Omnipoint':'133','Metrocall':'108','CommunicationSpecialists':'72','Clearnet':'70','MobtelSrbija':'121','PageOneNorthWest':'147','PriceCommunications':'154','UMC':'196','UMCGSM(Ukraine)':'24','SimpleFreedom':'171','Ntelos':'130','Unicel':'197','T-MobileAustria':'183','BellMobility(Canada)':'47','InlandCellularTelephone':'95','Mobilfone':'117','Mobileone':'116','O2(M-mail)':'132','SouthernLINC':'173','AlltelPCS':'36','PGSM(Hungary)':'2','Primco':'155','BellCanada':'46','EdgeWireless':'82','BellSouthMobility':'51','GujaratCelforce':'92','MaharashtraIdeaCellular':'103','AndhraPradeshAirtel':'39','PageMartCanada':'145','JSMTele-Page':'96','Sprint':'175','MobilityBermuda':'118','WestCentralWireless':'211'}
  26.     p_textnumber = int(p_textnumber)
  27.     p_carrier = p_carrier.replace(' ','')
  28.     p_carrier_actual = str(p_carrierdict[str(p_carrier)])
  29.     numleft.set(str(p_textnumber))
  30.  
  31.     for i in range(0,p_textnumber):
  32.  
  33.         sleep(.5)
  34.        
  35.         root.update_idletasks()
  36.        
  37.         # Browser
  38.         br = mechanize.Browser()
  39.  
  40.         # Cookie Jar
  41.         cj = cookielib.LWPCookieJar()
  42.         br.set_cookiejar(cj)
  43.  
  44.         # Browser options
  45.         #br.set_handle_equiv(True)
  46.         #br.set_handle_gzip(True)
  47.         #br.set_handle_redirect(True)
  48.         #br.set_handle_referer(True)
  49.         #br.set_handle_robots(False)
  50.  
  51.         # Follows refresh 0 but not hangs on refresh > 0
  52.         br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1)
  53.  
  54.         # User-Agent (this is cheating, ok?)
  55.         br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
  56.  
  57.         # Open some site, let's pick a random one, the first that pops in mind:
  58.         r = br.open('http://onlinetextmessage.com')
  59.         html = r.read()
  60.  
  61.         br.select_form(nr=0)
  62.  
  63.         br.form['number'] = p_number
  64.         br.form['from'] = p_from
  65.         br.form['subject'] = p_subject
  66.         br.form['carrier'] = [p_carrier_actual]
  67.         br.form['message'] = p_message
  68.  
  69.         br.submit()
  70.         br.close()
  71.  
  72.         p_textnumber = p_textnumber - 1
  73.  
  74.         numleft.set(str(p_textnumber))
  75.  
  76. def callback():
  77.     tk_quits.configure(state = NORMAL)
  78.     tk_send.configure(state = NORMAL)
  79.     tk_stop.configure(state = DISABLED)
  80.  
  81. def on_send(a,b,c,d,e,f):
  82.     tk_send.configure(state = DISABLED)
  83.     tk_quits.configure(state = DISABLED)
  84.     tk_stop.configure(state = NORMAL)
  85.     thd = Thread(lambda: textSpam(a,b,c,d,e,f), callback)
  86.     thd.daemon = True
  87.     thd.start()
  88.  
  89. def on_stop():
  90.     procs = str(os.getpid())
  91.     PROCNAME = 'text.exe'
  92.     for proc in psutil.process_iter():
  93.         if proc.name == PROCNAME:
  94.             text = str(proc)[19:]
  95.             head, sep, tail = text.partition(',')
  96.             if str(head) != procs:
  97.                 subprocess.call(['taskkill', '/PID', str(head), '/F'])
  98.                 numleft.set('0')
  99.                 callback()
  100.  
  101. def on_destroy():
  102.     on_stop()
  103.     root.destroy()
  104.  
  105. root = Tk()
  106.  
  107. numleft = StringVar()
  108. numleft.set('0')
  109.  
  110. root.title('Text Message')
  111.  
  112. root.protocol('WM_DELETE_WINDOW', on_destroy)
  113.  
  114. tk_number = Label(root, text='Phone Number: ')
  115. tk_number.pack()
  116.  
  117. tk_numberbox = Entry(root, width='10')
  118. tk_numberbox.pack()
  119.  
  120. tk_from = Label(root, text='From (Email): ')
  121. tk_from.pack()
  122.  
  123. tk_frombox = Entry(root, width='20')
  124. tk_frombox.pack()
  125.  
  126. tk_subject = Label(root, text='Subject: ')
  127. tk_subject.pack()
  128.  
  129. tk_subjectbox = Entry(root, width='20')
  130. tk_subjectbox.pack()
  131.  
  132. tk_message = Label(root, text='Message: ')
  133. tk_message.pack()
  134.  
  135. tk_messagebox = Entry(root, width='30')
  136. tk_messagebox.pack()
  137.  
  138. tk_textnumber = Label(root, text='Number of Texts: ')
  139. tk_textnumber.pack()
  140.  
  141. tk_textnumberbox = Entry(root, width='10')
  142. tk_textnumberbox.pack()
  143.  
  144. carriers = ['Verizon PCS', 'Nextel', 'Alltel PCS', 'Cingular Wireless', 'SunCom', 'T-Mobile / Voicestream', 'Sprint PCS', 'AT&T PCS', 'MTS (Russia)', 'PGSM (Hungary)', 'Telecom Italia Mobile (Italy)', 'Vodafone Omnitel (Italy)', 'Max.Mobil (Austria)', 'Orange (United Kingdom)', 'Tele Danmark Mobil (Denmark)', 'Sonofon (Denmark)', 'Telia Mobitel (Sweden)', 'Comviq GSM (Sweden)', 'Europolitan (Sweden)', 'Telenor Mobil (Norway)', 'Netcom GSM (Norway)', 'Plus GSM (Poland)', 'D1 De TeMobil (Germany)', 'D2 Mannesmann Mobilefunk (Germany)', 'E-Plus (Germany)', 'Celcom (Malaysia)', 'Mobitel (Tanzania)', 'Telecel (Portugal)', 'Optimus (Portugal)', 'TMN (Portugal)', 'LMT (Latvia)', 'UMC GSM (Ukraine)', 'Kyivstar GSM (Ukraine)', 'Si.Mobil (Slovenia)', 'Mobitel (Slovenia)', 'Eurotel (Czech Republic)', 'Cellis & LibanCell (Lebanon)', '3 River Wireless', 'ACS Wireless', 'Advantage Communications', 'Airtouch Pagers', 'AlphaNow', 'Alltel', 'Ameritech Paging', 'Ameritech Clearpath', 'Andhra Pradesh Airtel', 'Arch Pagers (PageNet)', 'AT&T Pocketnet PCS', 'Beepwear', 'BeeLine GSM', 'Bell Atlantic', 'Bell Canada', 'Bell Mobility (Canada)', 'Bell Mobility', 'Bell South (Blackberry)', 'Bell South', 'Bell South Mobility', 'Blue Sky Frog', 'Bluegrass Cellular', 'Boost', 'BPL mobile', 'Carolina Mobile Communications', 'Carolina West', 'Cellular One East Coast', 'Cellular One South West', 'Cellular One PCS', 'Cellular One', 'Cellular One West', 'Cellular South', 'Central Vermont Communications', 'CenturyTel', 'Chennai RPG Cellular', 'Chennai Skycell / Airtel', 'Cincinnati Bell', 'Cingular', 'Clearnet', 'Comcast', 'Communication Specialists', 'Comviq', 'Cook Paging', 'Corr Wireless Communications', 'Cricket Wireless', 'Delhi Aritel', 'Digi-Page / Page Kansas', 'Dobson Cellular Systems', 'Dobson-Alex Wireless / Dobson-Cellular One', 'DT T-Mobile', 'Dutchtone / Orange-NL', 'Edge Wireless', 'EMT', 'Escotel', 'Fido', 'Galaxy Corporation', 'GCS Paging', 'Goa BPLMobil', 'Golden Telecom', 'GrayLink / Porta-Phone', 'GTE', 'Gujarat Celforce', 'Houston Cellular', 'Infopage Systems', 'Inland Cellular Telephone', 'JSM Tele-Page', 'Kerala Escotel', 'Kolkata Airtel', 'Kyivstar', 'Lauttamus Communication', 'LMT', 'Maharashtra BPL Mobile', 'Maharashtra Idea Cellular', 'Manitoba Telecom Systems', 'MCI Phone', 'MCI Page', 'Meteor', 'Metrocall', 'Metrocall 2-way', 'Metro PCS', 'Microcell', 'Midwest Wireless', 'MiWorld', 'Mobilecom PA', 'Mobilecomm', 'Mobileone', 'Mobilfone', 'Mobility Bermuda', 'Mobistar Belgium', 'Mobitel Tanzania', 'Mobtel Srbija', 'Morris Wireless', 'Motient', 'Movistar', 'Mumbai BPL Mobile', 'Mumbai Orange', 'NBTel', 'Netcom', 'NPI Wireless', 'Ntelos', 'O2', 'O2 (M-mail)', 'Omnipoint', 'One Connect Austria', 'OnlineBeep', 'Optus Mobile', 'Orange', 'Orange Mumbai', 'Orange - NL / Dutchtone', 'Oskar', 'P&T Luxembourg', 'Pacific Bell', 'PageMart', 'PageMart Advanced /2way', 'PageMart Canada', 'PageNet Canada', 'PageOne NorthWest', 'PCS One', 'Personal Communication', 'Pioneer / Enid Cellular', 'PlusGSM', 'Pondicherry BPL Mobile', 'Powertel', 'Price Communications', 'Primco', 'Primtel', 'ProPage', 'Public Service Cellular', 'Qualcomm', 'Qwest', 'RAM Page', 'Rogers AT&T Wireless', 'Rogers Canada', 'Safaricom', 'Satelindo GSM', 'Satellink', 'SBC Ameritech Paging', 'SCS-900', 'SFR France', 'Skytel Pagers', 'Simple Freedom', 'Smart Telecom', 'Southern LINC', 'Southwestern Bell', 'Sprint', 'ST Paging', 'Sunrise Mobile', 'Surewest Communicaitons', 'Swisscom', 'T-Mobile Austria', 'T-Mobile Germany', 'T-Mobile UK', 'Tamil Nadu BPL Mobile', 'Tele2 Latvia', 'Telefonica Movistar', 'Telenor', 'Teletouch', 'Telia Denmark', 'Telus', 'TIM', 'Triton', 'TSR Wireless', 'UMC', 'Unicel', 'Uraltel', 'US Cellular', 'US West', 'Uttar Pradesh Escotel', 'Verizon Pagers', 'Vessotel', 'Virgin Mobile', 'Vodafone Italy', 'Vodafone Japan', 'Vodafone Spain', 'Vodafone UK', 'WebLink Wireless', 'West Central Wireless', 'Western Wireless', 'Wyndtell']
  145.  
  146. dropdown_v = StringVar(root)
  147. dropdown_v.set(carriers[0])
  148.  
  149. dropdown = apply(OptionMenu, (root,dropdown_v) + tuple(carriers))
  150. dropdown.pack()
  151.  
  152. tk_textnumberleft = Label(root, text='Number of Texts Left: ')
  153. tk_textnumberleft.pack()
  154.  
  155. tk_textnumberleft_a = Label(root, textvariable = numleft)
  156. tk_textnumberleft_a.pack()
  157.  
  158. tk_send = Button(root, text='Send', command=lambda: on_send( tk_numberbox.get(), tk_frombox.get(), tk_subjectbox.get(), dropdown_v.get(), tk_messagebox.get(), tk_textnumberbox.get() ))
  159. tk_send.pack(pady=8)
  160.  
  161. tk_stop = Button(root, text='Stop', command=on_stop, state = DISABLED)
  162. tk_stop.pack(pady=8)
  163.  
  164. tk_quits = Button(root, text='Quit', command=on_destroy, state = NORMAL)
  165. tk_quits.pack(pady=8)
  166.  
  167. mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement