forked from unique1o1/Meet-SMS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeetsms.py
executable file
·63 lines (52 loc) · 1.86 KB
/
meetsms.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
#! /usr/bin/env python3
import requests
import sys
import re
import getpass
for i in range(1, 7, 2):
try:
if(sys.argv[i] == "-u"):
username = sys.argv[i + 1]
elif (sys.argv[i] == "-m"):
message = sys.argv[i + 1]
elif (sys.argv[i] == "-r"):
recipcent = sys.argv[i + 1].split(",")
numbers = None
for j in recipcent:
j = j.strip()
if re.match(r"^\d{10}$", j):
numbers = j if numbers is None else numbers + "," + j
else:
raise ValueError("The number you entered is mistake")
exit()
except IndexError as e:
print("not enough arguments \n Use the following options:\n -u for username \n -m for message \n -r for receiver's number".format(e))
exit()
password = getpass.getpass("Enter your password: ")
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()
print("Sending SMS...")
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_)
if index_:
Quota = html_[index_.start():index_.start() + 46]
print("Success.\n" + Quota)
elif re.search("loginform", html_):
print("The username/password you entered in incorrect")
else:
print("Either your out of Quota or something went wrong.")