Ejemplo n.º 1
0
 def getPublicIp(self):
     """ Get public IP address """
     if self.public is None:
         self.public = stun.get_ip_info()[1]
         if self.public is None:
             self.public = str(publicip.get())
     return self.public
Ejemplo n.º 2
0
    def getPublicIp(self):
        if self.public is None:
            self.public = stun.get_ip_info()[1]
            if self.public is None:
                self.public = str(publicip.get())

        return self.public
 def main(self):
     try:
         SERVER_PORT = int(sys.argv[1])
     except:
         print("[Usage: Server.py Server_port]\n")
     rtspSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
     rtspSocket.bind(('', SERVER_PORT))
     rtspSocket.listen(5)
     print("Listenning from client...")
     print("Server port: %s" % SERVER_PORT)
     print("IPv4 address: ")
     publicip.get()
     # Receive client info (address,port) through RTSP/TCP session
     while True:
         clientInfo = {}
         clientInfo['rtspSocket'] = rtspSocket.accept()
         ServerWorker(clientInfo).run()
Ejemplo n.º 4
0
    def send_msg(self, msg):
        global author
        author = str(publicip.get()) + str(random.randint(1, 1000))
        request_Queue = self.sqs.get_queue_by_name(QueueName='requestQueue')
        try:
            self.req_smg = request_Queue.send_message(MessageBody=msg,
                                                      MessageAttributes={
                                                          'Author': {
                                                              'StringValue':
                                                              author,
                                                              'DataType':
                                                              'String'
                                                          }
                                                      })

            print("Your request has been sent.\n")

        except bx.ClientError:
            print(" here ")
Ejemplo n.º 5
0
#pip install socket
#pip install publicip

import socket
import publicip

print(publicip.get())  # returns public ip

print(socket.gethostname())  # returns computer name
Ejemplo n.º 6
0
def ip():
    print(publicip.get())
Ejemplo n.º 7
0
# -*- coding: UTF-8 -*-

import smtplib
import publicip
from getmac import get_mac_address as getmac

smtp = smtplib.SMTP('smtp.gmail.com', 587)
smtp.starttls()

smtp.login('*****@*****.**', 'Suporte@123')
mac = str(getmac())
ip = str(publicip.get())
de = '*****@*****.**'
para = ['*****@*****.**']
msg = """From: %s
To: %s
Subject: Teste de Email SRT

Endereco de IP:{} 
MAC:{} """.format(ip, mac) % (de, ','.join(para))

smtp.sendmail(de, para, msg)

smtp.quit()
Ejemplo n.º 8
0
import publicip

publicip.get()