Пример #1
0
    def launchurl(self):
        global session, service, oneurl

        with open("config.ini", "r+") as f:
            f.seek(0)
            d = f.readlines()
            #print(d)
            for i in d:
                if "url=" + oneurl + '\n' not in i:
                    f.write(i)
            f.write("url=" + self.textEntryVar.get() + "\n")
            f.truncate()

        try:
            url = str(self.textEntryVar.get())
            ip = IPv4Address(url)  # let's create an IP address object
            # now create a session
            session = AirmoreSession(ip)
            # if your port is not 2333
            # session = AirmoreSession(ip, 2334)  # assuming it is 2334

            was_accepted = session.request_authorization()

            if was_accepted == True:
                self.nstatus['text'] = "Connected to Phone!"
                self.nstatus['fg'] = "blue"
                service = MessagingService(session)

        except Exception as e:
            self.nstatus['text'] = "IP Address Error!"
            self.nstatus['fg'] = "red"
 def send_insurance(self, ip_addr, cellPhone, name, message):
     ipAddress = ip_addr
     ip = IPv4Address(ipAddress)
     session = AirmoreSession(ip, 2333)
     service = MessagingService(session)
     sendMessage = "{}님 안녕하세요. {}".format(name, message)
     service.send_message(cellPhone, sendMessage)
Пример #3
0
    def __init__(self):
        self.loc = (FILENAME)
        self.ip = IPv4Address(IP_ADDRESS)
        self.session = AirmoreSession(self.ip)

        self.was_accepted = self.session.request_authorization()
        if (self.was_accepted):
            print("Connection Established")
        else:
            print("Connection Error! please verify ip address")
            exit()
            
        self.service = MessagingService(self.session)

        #Open Excel
        self.rb = xlrd.open_workbook(self.loc)
        self.sheet = self.rb.sheet_by_index(0)
        self.wb = copy(self.rb)
        self.w_sheet = self.wb.get_sheet(0)

        self.createGuestListDict()
        self.sendInvitationList()
        self.checkRecieve()

        self.createArrivedGuestsDict()
        self.sendThankYou()
Пример #4
0
    def send_sms_message(self, number, message):
        # now create a session
        logging.info("Trying connecting AirMore on Android Device (" +
                     self.get_srv_info() + ")")
        session = AirmoreSession(self.amipaddr, self.amport)

        if not session.is_server_running:
            logging.error("AirMore is not Running on Android Device (" +
                          self.get_srv_info() + ")")
            sys.exit(1)

        logging.info("AirMore is Running on Android Device (" +
                     self.get_srv_info() + ")")

        was_accepted = session.request_authorization()
        if not was_accepted:
            logging.error("AirMore is rejecting session on Android Device (" +
                          self.get_srv_info() + ")")
            sys.exit(2)

        logging.error("AirMore is accpeting this session on Android Device (" +
                      self.get_srv_info() + ")")

        service = MessagingService(session)
        logging.info("Sending to " + number + " message: " + message)
        service.send_message(number, message)
        logging.info("Message sent to " + number)
Пример #5
0
    def __init__(self, ip, port):
        try:
            self.__session = AirmoreSession(IPv4Address(ip), port)
            self.__service = MessagingService(self.__session)

            accepted = self.__session.request_authorization()

            if not accepted:
                raise Exception(f'Autorizzazione non accettata')

        except Exception as e:
            print(f'Error: {e}')
Пример #6
0
def sending():
    global session
    rucontinue = "y"
    while rucontinue == "y":
        phone_number = input("insert your taget phone number:")
        count_massage = int(input("how many times?"))
        massage = input("your massage:")
        service = MessagingService(session)
        for i in range(0, count_massage):
            print("massage %s is seding" % str(i + 1))
            service.send_message(phone_number, massage)
        rucontinue = input("are you want to continue?(y for continue)")
 def __init__(self, phone_IP, send_number):
     self.__send_number = format_phone_number(send_number)
     self.__session = AirmoreSession(IPv4Address(phone_IP))
     self.__correct_direction = lambda x: x.type == MessageType.RECEIVED
     assert self.__session.is_server_running
     assert self.__session.request_authorization()
     self.__service = MessagingService(self.__session)
     self.__initialization_time = datetime.datetime.now()
     self.__chat_id = None
     self.__chat_id = self.__get_chat_id()
     self.__buffer = b''
     self.__already_read = set()
     # Add new messages to already read...
     self.get_new_messages()
    def employee_send(self, ip_addr, port, cellPhone, name, info):
        # Airmore 활성화
        ipAddress = ip_addr
        ip = IPv4Address(ipAddress)

        session = AirmoreSession(ip, int(port))
        service = MessagingService(session)
        now_date = datetime.date.today()
        #보낼 문자내용
        if info == '직원등록':
            message = '{}일자로 {}님의 직원등록이 완료되었습니다.'.format(now_date, name)
        elif info == '직원수정':
            message = '{}님의 정보가 변경 완료되었습니다.'.format(name)
        elif info == '보험사서류발송':
            message = '처리 서류를 메일로 발송하였습니다. 확인 부탁드립니다.'.format(name)
        elif info == '관리자등록':
            message = '{}일자로 {}님의 관리자등록이 완료되었습니다.'.format(now_date, name)
        service.send_message(cellPhone, message)
	def waitForPasscodeLabel(self, method):
	
		global PIN_CODE
		
		session = AirmoreSession(IPv4Address(str(config.core['airmore_server'])))  # also you can put your port as int, airmore's port default is 2333	
		session.is_server_running  # True
		session.request_authorization()  # True if accepted, False if denied

		service = MessagingService(session)
		messages = service.fetch_message_history()

		pattern = "HSBC: Verification code is (\D{4}-)(\d{6})"

		for msg in messages:
			group = re.findall(pattern, msg.content)
			if len(group) > 0 and len(group[0]) > 0:
				if group[0][0] == str(self.driver.find_element(By.ID, "passcodelabel").text):
					PIN_CODE = str(group[0][1])
					return True
		
		return False
	def waitForPasscodeLabel(self, method):
	
		global PIN_CODE
		
		session = AirmoreSession(IPv4Address(str(config.core['airmore_server'])))  # also you can put your port as int, airmore's port default is 2333	
		session.is_server_running  # True
		session.request_authorization()  # True if accepted, False if denied

		service = MessagingService(session)
		messages = service.fetch_message_history()

		pattern = "For your online transaction, please use this MasterCard SecureCode One-Time Password: (\w{4})-(\d{6})"

		for msg in messages:
			group = re.findall(pattern, msg.content)
			if len(group) > 0 and len(group[0]) > 0:
				if group[0][0] == str(self.driver.find_element(By.CSS_SELECTOR , "#pwdpage > table:nth-child(2) > tbody:nth-child(1) > tr:nth-child(3) > td:nth-child(1) > table:nth-child(3) > tbody:nth-child(1) > tr:nth-child(9) > td:nth-child(2) > span:nth-child(2)").text):
					PIN_CODE = str(group[0][1])
					return True
		
		return False
Пример #11
0
 def sending(self):
     try:
         ip = str(self.ip_input.text())
         port = int(self.port_input.text())
         ip4 = IPv4Address(ip)
         phone_number = str(self.number_input.text())
         count_massage = int(self.count_input.text())
         message = str(self.content_input.toPlainText())
         session = AirmoreSession(ip4, port)
         service = MessagingService(session)
         try:
             for c in range(1, count_massage + 1):
                 service.send_message(phone_number, message)
                 percent = (c / count_massage) * 100
                 self.progressBar.setProperty("value", percent)
                 self.message_send_status.append("message %i sended" % c)
                 self.sended_lcd.display(c)
                 sleep(1)
         except:
             self.message_send_status.append(
                 "the message not send. check the information.")
     except:
         self.message_send_status.append("check the connection")
Пример #12
0
from pymongo import MongoClient
import requests
import json
from datetime import datetime
import os 

app = Flask(__name__)

ip = IPv4Address("192.168.0.144")  # let's create an IP address object
# now create a session
session = AirmoreSession(ip)

#authorization
was_accepted = session.request_authorization()
#sendign messages
service = MessagingService(session)
@app.route("/",methods=["GET"])
def main():
    return render_template("broadcast.html")

@app.route("/send_weather",methods=["POST"])
def weather_update():
    #send
    village_id = request.get_json()["village_id"] #getting the data from the broadcast website
    filee_read = open("village_database/{}.txt".format(village_id),"r")
    numbers = filee_read.read().split(",")
    message = "WEATHER UPDATE BROADCAST MESSAGE: MAX TEMP:32C, MIN TEMP:28C,LOW CHANCES OF RAIN."
    for i in numbers:
        service.send_message(i,message)

@app.route("/send_crop_prices",methods=["POST"])
Пример #13
0
 def __init__(self, ip):
     self.ip = IPv4Address(ip)
     self.session = AirmoreSession(self.ip)
     self.messageService = MessagingService(self.session)
     self.otpStart = 'Your OTP to register/access CoWIN is'
def messages(verbose: bool = False) -> List[Tuple]:
    return [(message.phone, message.content) for message in MessagingService(
        cellphone(verbose)).fetch_message_history()]
Пример #15
0
 def set_messaging_service(self):
     self.service = MessagingService(self.session)