Example #1
0
def Main():

         print '[-] Waiting for clients...' 
         s.listen(5)                                                                   # Now wait for client connection.
         c, addr = s.accept()                                                          # Establish connection with client.
         print '[-] Got connection from', addr[0]     
         logit.logger("Info","New Connection from: " + addr[0])                        # Log New Connection

         while True:                                                                   # While Client Not Disconnected.
            try:                                                                       # Try to do something.
               msg = (c.recv(1024).decode("UTF-8"))                                    # Recieve Socket Message
               print "[" + addr[0] + "]", ' >> ' + "New Request Recieved, Logged."     # Log Message
               msg = (msg.encode("UTF-8"))
               logit.logger("Req","New Request:  " + msg + " From: " + addr[0])        # Log New Client Connection
               if(msg == ""):
                  print '[-] Client Disconnected...'
                  logit.logger("Info","Client Disconnected: " + addr[0])
                  Main()
               else:
                  language = check_language.checkLanguage(msg)                         # Check For the Request Language
                  continue                                                             # Don't stop, Continue
            except:                                                                    # If Client disconnect, then....
               print '[-] Client Disconnected...'
               logit.logger("Info","Client Disconnected: " + addr[0])
               time.sleep(1)
               Main()
               continue               
Example #2
0
def getNameData(IMEI):

    hash_IMEI = hashlib.md5(IMEI).hexdigest()
    sql = "SELECT * FROM Profiles WHERE android_imei=?"
    cursor.execute(sql, [(hash_IMEI)])
    try:
        
        results = cursor.fetchall()[0]
        resultsLen = len(results)
        if(resultsLen == 0):
            print 'Could not find any results.'
        else:
            nameData = (results)[0] + " " + (results)[1]
            return nameData
    except:
        
        logit.logger("Warning","Failed to verify Android Device, IMEI: " + IMEI)
        logit.logger("Warning","Unverified android device tried to get Name data From DB.")
        return False
Example #3
0
def isVaildIMEI(IMEI):

    vaildIMEI = False

    hash_IMEI = hashlib.md5(IMEI).hexdigest()
    sql = "SELECT * FROM Profiles WHERE android_imei=?"
    cursor.execute(sql, [(hash_IMEI)])
    try:
        
        results = cursor.fetchall()[0]
        resultsLen = len(results)
        if(resultsLen == 0):
            print 'Could not find any results.'
        else:
            IMEIFromDB = (results)[6]
            nameData = getNameData(IMEI)
            vaildIMEI = True
            logit.logger("Info", nameData + " Accessed the Server.")
            return vaildIMEI
    except:

        logit.logger("Warning","Unverified android device tried to access the server: " + IMEI)
        return False
Example #4
0
s = socket.socket()                                                                    # Create a socket object
Server_HOST = socket.gethostname()                                                     # Get local machine name
Server_PORT = 44444                                                                    # Reserve a port for your service
         
print '[-] Server started!'                                                            # Server Started Message
time.sleep(1)                                                                          # Sleep 1 Second.                                                    # Waiting for Clients...
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind((Server_HOST, Server_PORT))                                                     # Bind to the port
Main()

while(exception == 0):
   try:

      Main()                                                 # Continue to do the same in loop.

   except (KeyboardInterrupt, SystemExit):                                             # If Server Crashed then...
      
      print("[!] Server Interuppted Or Crashed Down ...")
      time.sleep(1)
      logit.logger("Fatal","Server Crashed Unexpectualy.")
      time.sleep(1)
      print("[-] Reconnecting to the server ...")
      time.sleep(1)
      print '[-] Server started!'                                                      # Server Started Message
      time.sleep(1)                                                                    # Sleep 1 Second.
      print '[-] Waiting for clients...'                                               # Waiting for Clients...

      
   continue                                                                            # Power back the server, Again.
Example #5
0
import Weather
sys.path.append("Functions/Logger")
import logit
sys.path.append("Functions/getProfileData")
import profileData

print("------------------------ Check Weather -----------------------")
print("")

location = "Haifa"
weather = Weather.main(location)
print("")
print weather
print("")

logit.logger("Info","Test Module run out. ")

print("")
print ("--------------------------------------------------------------")
print("")

IMEI = "356516040249414"
Fake_IMEI = "35651604000000"
print ("------------ Get Profile Full Name by IMEI ------------------")
print("")

nameData = profileData.getNameData(IMEI)
print nameData

print("")
print ("-------------------------------------------------------------")