-
Notifications
You must be signed in to change notification settings - Fork 0
/
sendText.py
118 lines (92 loc) · 3.03 KB
/
sendText.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
'''
Meet-SMS - Send SMS easily from MeetSMS
Author: Yunik Maharjan
'''
import requests
import sys
import re
import itertools
import threading
import time
done = False
def main(username, password, message, recipcent): #recipient is list
global done
username = username
message = message
recipcent = recipcent
if len(recipcent) > 10:
print("Sending more than 10 SMS is not supported.")
exit()
numbers = None
ncell = None
wrongNumber = None
for j in recipcent:
j = j.strip()
# Check for Ncell numbers
if re.match(r"^\d{10}$", j):
if(re.match(r'^(980)|(981)|(982)', j)):
ncell = j if ncell is None else ncell + "," + j
elif (re.match(r'^(984)|(985)|(986)', j)):
numbers = j if numbers is None else numbers + "," + j
else:
wrongNumber = j if wrongNumber is None else wrongNumber + "," + j
if numbers is None:
if ncell is not None:
ncell_check(ncell)
if wrongNumber is not None:
wrongnumber_check(wrongNumber)
exit()
if ncell is not None:
ncell_check(ncell)
if wrongNumber is not None:
wrongnumber_check(wrongNumber)
login_url = "http://www.meet.net.np/meet/action/login"
sms_url = "http://www.meet.net.np/meet/mod/sms/actions/send.php"
session_req = requests.session()
data = {
"username": username,
"password": password,
}
try:
messages = {"recipient": numbers,
"message": message,
"SmsLanguage": "English",
"sendbutton": "Send Now"}
except NameError as e:
print("Error! {}\nUse the following options:\n -u for username \n -m for message \n -r for receiver's number".format(e))
exit()
t = threading.Thread(target=animate)
t.start()
resp = session_req.post(login_url, data)
result = session_req.post(sms_url, messages)
html_ = str(result.content)
index_ = re.search("Free SMS Quota", html_)
done = True
if index_:
Quota = html_[index_.start():index_.start() + 46]
print("\rSuccess\n" + Quota)
elif re.search("loginform", html_):
print("\rThe username/password you entered in incorrect")
else:
print("Either you're out of Quota or something went wrong.")
def ncell_check(ncell):
if ncell is not None:
print(
"SMS to {} will not be send because Ncell numbers are not supported".format(ncell))
def wrongnumber_check(wrongNumber):
if wrongNumber is not None:
print(
"SMS to {} will not be send because the numbers are incorrect".format(wrongNumber))
def unit_test(text):
return text
def animate():
global done
for c in itertools.cycle(['|', '/', '-', '\\']):
if done:
break
sys.stdout.write('\rSending ' + c)
sys.stdout.flush()
time.sleep(0.1)
sys.stdout.flush()
def text(message, number):
main("[email protected]", "@ppl3Man", message, number)