parent
fec4dc6d91
commit
e16b51db74
@ -1,3 +1,4 @@
|
||||
__pycache__
|
||||
Pipfile
|
||||
Pipfile.lock
|
||||
Pipfile.lock
|
||||
DeveloperDiskImage*
|
@ -0,0 +1,3 @@
|
||||
class Object():
|
||||
def __init__(self):
|
||||
self.location = None
|
@ -0,0 +1,30 @@
|
||||
from geopy.geocoders import Nominatim
|
||||
from ..location import Location
|
||||
from .object import Object
|
||||
|
||||
class Player(Object):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.current_cooldown = 0
|
||||
|
||||
def set_location_with_query(self, query):
|
||||
loc = Nominatim(user_agent="GetLoc")
|
||||
getLoc = loc.geocode(query)
|
||||
|
||||
self.location = Location(getLoc.latitude, getLoc.longitude)
|
||||
|
||||
def set_location(self, location, did_activity):
|
||||
next_cd = self.get_cooldown_to(location)
|
||||
if did_activity:
|
||||
if next_cd + self.current_cooldown >= 120:
|
||||
self.current_cooldown = 120
|
||||
else:
|
||||
self.current_cooldown += next_cd
|
||||
self.location = location
|
||||
|
||||
def get_location(self):
|
||||
return self.location
|
||||
|
||||
def get_cooldown_to(self, location):
|
||||
# + 1 for map loading and activities
|
||||
return self.location.get_cooldown(location) + 1
|
@ -1,4 +1,6 @@
|
||||
class Raid():
|
||||
from .object import Object
|
||||
|
||||
class Raid(Object):
|
||||
def __init__(self, name, number, level, location, start_time, end_time, country):
|
||||
self.name = name
|
||||
self.number = number
|
@ -1,21 +0,0 @@
|
||||
from geopy.geocoders import Nominatim
|
||||
from .location import Location
|
||||
|
||||
class Player():
|
||||
def __init__(self):
|
||||
self.location = None
|
||||
|
||||
def set_location_with_query(self, query):
|
||||
loc = Nominatim(user_agent="GetLoc")
|
||||
getLoc = loc.geocode(query)
|
||||
|
||||
self.location = Location(getLoc.latitude, getLoc.longitude)
|
||||
|
||||
def set_location(self, location):
|
||||
self.location = location
|
||||
|
||||
def get_location(self):
|
||||
return self.location
|
||||
|
||||
def cooldown_to(self, location):
|
||||
return self.location.get_cooldown(location)
|
@ -0,0 +1,42 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pymobiledevice3.lockdown import LockdownClient
|
||||
from pymobiledevice3.cli.mounter import MobileImageMounterService
|
||||
from pymobiledevice3.cli.developer import DtSimulateLocation
|
||||
from pymobiledevice3.services.diagnostics import DiagnosticsService
|
||||
|
||||
class Device():
|
||||
def __init__(self):
|
||||
self.lockdown = LockdownClient()
|
||||
self.mounter = MobileImageMounterService(self.lockdown)
|
||||
self.diagnostics = DiagnosticsService(self.lockdown)
|
||||
self.is_mounted = False
|
||||
self.location = None
|
||||
|
||||
def mount_image(self, image_path, signature_path):
|
||||
image_type = "Developer"
|
||||
|
||||
image_path = Path(image_path)
|
||||
image = image_path.read_bytes()
|
||||
signature_path = Path(signature_path)
|
||||
signature = signature_path.read_bytes()
|
||||
|
||||
self.mounter.upload_image(image_type, image, signature)
|
||||
self.mounter.mount(image_type, signature)
|
||||
|
||||
self.is_mounted = True
|
||||
self.location = DtSimulateLocation(self.lockdown)
|
||||
return True
|
||||
|
||||
def spoof_gps(self, destination):
|
||||
self.location = DtSimulateLocation(self.lockdown)
|
||||
self.location.set(destination.latitude, destination.longitude)
|
||||
return True
|
||||
|
||||
def stop_spoofing(self):
|
||||
self.location.clear()
|
||||
self.diagnostics.restart()
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,75 @@
|
||||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
from ..objects.pokemon import Pokemon
|
||||
from ..objects.raid import Raid
|
||||
from ..location import Location
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
class Scraper():
|
||||
def __init__(self):
|
||||
self.HUNDO_URL = "https://moonani.com/PokeList/index.php"
|
||||
self.PVP_URL = "https://moonani.com/PokeList/raid.php"
|
||||
|
||||
def get_pokemons(self, url):
|
||||
pokemon_lst = []
|
||||
response = requests.get(url)
|
||||
soup = BeautifulSoup(response.text, "lxml")
|
||||
|
||||
for row in soup.find_all("tr")[1:]:
|
||||
data = row.find_all("td")[1:]
|
||||
|
||||
name = data[0].text.strip()
|
||||
number = int(data[1].text)
|
||||
|
||||
coordinates = map(float, data[2].text.split(","))
|
||||
location = Location(*coordinates)
|
||||
|
||||
cp = int(data[3].text)
|
||||
level = int(data[4].text)
|
||||
attack = int(data[5].text)
|
||||
defense = int(data[6].text)
|
||||
hp = int(data[7].text)
|
||||
iv = int(data[8].text.rstrip("%"))
|
||||
shiny = data[9].text == "Yes"
|
||||
start_time = datetime.fromisoformat(data[10].text)
|
||||
end_time = datetime.fromisoformat(data[11].text)
|
||||
country = data[12].text
|
||||
|
||||
pokemon = Pokemon(name, number, location, cp, level, attack, defense, hp, iv, shiny, start_time, end_time, country)
|
||||
pokemon_lst.append(pokemon)
|
||||
|
||||
return pokemon_lst
|
||||
|
||||
def get_hundos(self):
|
||||
return self.get_pokemons(self.HUNDO_URL)
|
||||
|
||||
def get_pvp(self):
|
||||
return self.get_pokemons(self.PVP_URL)
|
||||
|
||||
def get_raids(self):
|
||||
raid_lst = []
|
||||
response = requests.get("https://moonani.com/PokeList/raid.php")
|
||||
soup = BeautifulSoup(response.text, "lxml")
|
||||
|
||||
for row in soup.find_all("tr")[1:]:
|
||||
data = row.find_all("td")
|
||||
|
||||
name = data[0].text
|
||||
number = int(data[1].text)
|
||||
level = int(data[2].text)
|
||||
|
||||
coordinates = map(float, data[3].text.split(","))
|
||||
location = Location(*coordinates)
|
||||
|
||||
start_time = datetime.fromisoformat(data[4].text)
|
||||
end_time = datetime.fromisoformat(data[5].text)
|
||||
country = data[6].text
|
||||
|
||||
raid = Raid(name, number, level, location, start_time, end_time, country)
|
||||
raid_lst.append(raid)
|
||||
|
||||
return raid_lst
|
||||
|
||||
|
||||
|
@ -1,63 +0,0 @@
|
||||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
from .core.pokemon import Pokemon
|
||||
from .core.raid import Raid
|
||||
from .core.location import Location
|
||||
from datetime import datetime
|
||||
|
||||
def get_pokemons(url):
|
||||
pokemon_lst = []
|
||||
response = requests.get(url)
|
||||
soup = BeautifulSoup(response.text, "lxml")
|
||||
|
||||
for row in soup.find_all("tr")[1:]:
|
||||
data = row.find_all("td")[1:]
|
||||
|
||||
name = data[0].text
|
||||
number = int(data[1].text)
|
||||
|
||||
coordinates = map(float, data[2].text.split(","))
|
||||
location = Location(*coordinates)
|
||||
|
||||
cp = int(data[3].text)
|
||||
level = int(data[4].text)
|
||||
attack = int(data[5].text)
|
||||
defense = int(data[6].text)
|
||||
hp = int(data[7].text)
|
||||
iv = int(data[8].text.rstrip("%"))
|
||||
shiny = data[9].text == "Yes"
|
||||
start_time = datetime.fromisoformat(data[10].text)
|
||||
end_time = datetime.fromisoformat(data[11].text)
|
||||
country = data[12].text
|
||||
|
||||
pokemon = Pokemon(name, number, location, cp, level, attack, defense, hp, iv, shiny, start_time, end_time, country)
|
||||
pokemon_lst.append(pokemon)
|
||||
|
||||
return pokemon_lst
|
||||
|
||||
def get_raids():
|
||||
raid_lst = []
|
||||
response = requests.get("https://moonani.com/PokeList/raid.php")
|
||||
soup = BeautifulSoup(response.text, "lxml")
|
||||
|
||||
for row in soup.find_all("tr")[1:]:
|
||||
data = row.find_all("td")
|
||||
|
||||
name = data[0].text
|
||||
number = int(data[1].text)
|
||||
level = int(data[2].text)
|
||||
|
||||
coordinates = map(float, data[3].text.split(","))
|
||||
location = Location(*coordinates)
|
||||
|
||||
start_time = datetime.fromisoformat(data[4].text)
|
||||
end_time = datetime.fromisoformat(data[5].text)
|
||||
country = data[6].text
|
||||
|
||||
raid = Raid(name, number, level, location, start_time, end_time, country)
|
||||
raid_lst.append(raid)
|
||||
|
||||
return raid_lst
|
||||
|
||||
|
||||
|
@ -1,13 +1,48 @@
|
||||
from bs4 import BeautifulSoup
|
||||
from ispoof.core.location import Location
|
||||
from ispoof.core.pokemon import Pokemon
|
||||
from datetime import datetime
|
||||
import requests
|
||||
from ispoof import scraper
|
||||
from geopy.geocoders import Nominatim
|
||||
|
||||
loc = Nominatim(user_agent="GetLoc")
|
||||
getLoc = loc.geocode("12 Cao Son 7, Da Nang")
|
||||
print(type(getLoc.latitude))
|
||||
from ispoof.core.objects.player import Player
|
||||
from ispoof.core.spoofer.scraper import Scraper
|
||||
from ispoof.core.spoofer.device import Device
|
||||
from pymobiledevice3.exceptions import AlreadyMountedError
|
||||
import traceback
|
||||
|
||||
if __name__ == "__main__":
|
||||
device = Device()
|
||||
image_path = "DeveloperDiskImage.dmg"
|
||||
signature_path = "DeveloperDiskImage.dmg.signature"
|
||||
try:
|
||||
device.mount_image(image_path, signature_path)
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
print("Already mounted. Continuing.")
|
||||
player = Player()
|
||||
query = input("Enter your location: ")
|
||||
player.set_location_with_query(query)
|
||||
scraper = Scraper()
|
||||
|
||||
while True:
|
||||
pokemons = scraper.get_hundos()
|
||||
pokemons.sort(key=lambda x: x.end_time, reverse=True)
|
||||
print("Spoof to")
|
||||
print(pokemons[10])
|
||||
location = pokemons[10].location
|
||||
device.spoof_gps(location)
|
||||
did_activity = None
|
||||
while True:
|
||||
activity = input("Did you do any cooldown activities? [Y/N] ").lower()
|
||||
if activity in ("y", "n"):
|
||||
did_activity = activity == "y"
|
||||
break
|
||||
player.set_location(location, did_activity)
|
||||
print(f"Current cooldown: {player.current_cooldown} min")
|
||||
|
||||
while True:
|
||||
continue_prompt = input("Continue? [Y/N] ").lower()
|
||||
if continue_prompt in ("y", "n"):
|
||||
if continue_prompt == "n":
|
||||
device.stop_spoofing()
|
||||
exit(0)
|
||||
else: break
|
||||
|
||||
|
||||
|
||||
|
||||
# print(scraper.get_raids())
|
Loading…
Reference in new issue