Пример #1
0
    def sendMessage(self, phone):
        url = self.service["url"]

        payload, dataType = self.parseData(phone)

        headers = {
            "X-Requested-With": "XMLHttpRequest",
            "Connection": "keep-alive",
            "Pragma": "no-cache",
            "Cache-Control": "no-cache",
            "Accept-Encoding": "gzip, deflate, br",
            "User-agent": randomData.random_useragent()
        }

        try:
            customHeaders = self.service["headers"]
        except KeyError:
            pass
        else:
            for key, value in json.loads(customHeaders.replace("\'",
                                                               "\"")).items():
                headers[key] = value

        okay = " Service (" + getDomain(url) + ") >> Message sent!"
        error = " Service (" + getDomain(url) + ") >> Failed to sent message!"

        try:
            if dataType == "json":
                r = requests.post(url,
                                  json=payload,
                                  timeout=self.timeout,
                                  headers=headers,
                                  proxies=self.proxy)
            elif dataType == "data":
                r = requests.post(url,
                                  data=payload,
                                  timeout=self.timeout,
                                  headers=headers,
                                  proxies=self.proxy)
            elif dataType == "url":
                r = requests.post(payload["url"],
                                  timeout=self.timeout,
                                  headers=headers,
                                  proxies=self.proxy)

            if r.status_code == 200:
                print("[SUCCESS]" + okay)
            elif r.status_code == 429:
                print("[TOO MANY REQUESTS]" + error)
            else:
                print("[" + str(r.status_code) + "]" + error)

            return r.status_code
        except (requests.exceptions.ReadTimeout,
                requests.exceptions.ConnectTimeout):
            print("[CONNECTION TIMED OUT]" + error)
        except (requests.exceptions.ConnectionError):
            print("[CONNECTION ERROR]" + error)
Пример #2
0
    def sendMessage(self, phone):
        url = self.service["url"]
        #print("Sending message.. | URL: (" + getDomain(url) + ") >> STATUS:", end = " ")
        payload, dataType = self.parseData(phone)

        # Headers for request
        headers = {
            "X-Requested-With": "XMLHttpRequest",
            "Connection": "keep-alive",
            "Pragma": "no-cache",
            "Cache-Control": "no-cache",
            "Accept-Encoding": "gzip, deflate, br",
            "User-agent": randomData.random_useragent()
            }

        # Add custom headers
        try:
            customHeaders = self.service["headers"]
        except KeyError:
            pass
        else:
            for key, value in json.loads(customHeaders.replace("\'", "\"")).items():
                headers[key] = value

        # Create suffixes
        okay  = "Service (" + getDomain(url) + ") >> Message was sent!"
        error = "Service (" + getDomain(url) + ") >> Message was not sent."

        try:
            # If data type is 'json'
            if dataType == "json":
                r = requests.post(url, json = payload, timeout = self.timeout, headers = headers, proxies = self.proxy)
            # If data type is 'data'
            elif dataType == "data":
                r = requests.post(url, data = payload, timeout = self.timeout, headers = headers, proxies = self.proxy)
            elif dataType == "url":
                r = requests.post(payload["url"], timeout = self.timeout, headers = headers, proxies = self.proxy)

            # Check status
            if r.status_code == 200:
                print("\033[1;32m"+"[+]"+"\033[0m"+ " " + okay)
            elif r.status_code == 429:
                print("\033[1;33m"+"[!]"+"\033[0m"+ " " + error)
            else:
                #print(r.text)
                print("\033[1;33m"+"[!]"+"\033[0m" + " " + error)
            
            return r.status_code

        except (requests.exceptions.ReadTimeout, requests.exceptions.ConnectTimeout):
            print("\033[1;33m"+"[!]"+"\033[0m"+ " " + error)
        except (requests.exceptions.ConnectionError):
            print("\033[1;33m"+"[!]"+"\033[0m"+ " " + error)
Пример #3
0
            + phone[4:7]
            + " "
            + phone[7:9]
            + " "
            + phone[9:11]
        )  # '+7 (915) 350 99 08'


# Headers for request
headers = {
    "X-Requested-With": "XMLHttpRequest",
    "Connection": "keep-alive",
    "Pragma": "no-cache",
    "Cache-Control": "no-cache",
    "Accept-Encoding": "gzip, deflate, br",
    "User-agent": randomData.random_useragent(),
}

# Service class
# parseData, SendSMS
class Service:
    def __init__(self, service):
        self.service = service
        self.proxy = getProxys()
        self.timeout = 10

    # Parse string
    def parseData(self, phone):
        payload = None
        # Check for 'data'
        if "data" in self.service: