Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit c23aed9

Browse files
SSL Issue
1 parent fa7659b commit c23aed9

File tree

11 files changed

+30
-27
lines changed

11 files changed

+30
-27
lines changed

Basic/bid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def bid_specific_auction(server, auction_id_or_link, price, delay=True):
99
URL = f"https://{server}.e-sim.org/"
1010
if ".e-sim.org/auction.html?id=" in auction_id_or_link:
1111
auction_id_or_link = auction_id_or_link.split("=")[1]
12-
auction_url = requests.get(f"{URL}auction.html?id={auction_id_or_link}")
12+
auction_url = requests.get(f"{URL}auction.html?id={auction_id_or_link}", verify=False)
1313
tree = fromstring(auction_url.content)
1414
try:
1515
auction_time = str(tree.xpath(f'//*[@id="auctionClock{auction_id}"]')[0].text)

Basic/mpp_dow_attack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def mpp_dow_attack(server, ID, action, delay_or_battle_link=""):
1111
if ".e-sim.org/battle.html?id=" in delay_or_battle_link:
1212
while 1:
1313
delay_or_battle_link = delay_or_battle_link.replace("battle", "apiBattles").replace("id", "battleId")
14-
apiBattles = requests.get(delay_or_battle_link).json()[0]
14+
apiBattles = requests.get(delay_or_battle_link, verify=False).json()[0]
1515
dScore = apiBattles['defenderScore']
1616
aScore = apiBattles['attackerScore']
1717
round_ends = apiBattles["hoursRemaining"] * 3600 +\

Basic/register.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ def register(server, nick, password, lan, countryId):
1717
headers = {"User-Agent": agent, "Referer": "https://e-sim.org"}
1818
session = requests.session()
1919
session.headers.update(headers)
20+
permanent_servers = 'primera', 'secura', 'suna', 'alpha'
21+
if server.lower() not in permanent_servers:
22+
session.verify = False
2023
session.get(URL + "index.html?lan=" + lan.replace(f"{URL}lan.", ""))
2124
login_params = {"preview": "USA_MODERN", "login": nick, "password": password,
2225
"mail": f'{nick.replace(" ", "")}@gmail.com', "countryId": countryId, "checkHuman": "Human"}

Fight/auto_fight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def auto_fight(server, battle_id="", side="attacker", wep="0", food="", gift="",
2929
current_loc = _location(server)
3030
double_click(server, session)
3131
fly(server, current_loc, session=session)
32-
apiBattles = requests.get(f"{URL}apiBattles.html?battleId={battle_id}").json()[0]
32+
apiBattles = session.get(f"{URL}apiBattles.html?battleId={battle_id}").json()[0]
3333
if 8 in (apiBattles['attackerScore'], apiBattles['defenderScore']):
3434
print("Battle has finished, i will search for another one")
3535
battle_id = _get_battle_id(server, battle_id, session)

Fight/fight.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def fight(link, side, weaponQuality="0", dmg_or_hits="100kk", ticketQuality="5",
2020
print(f'side must be "defender" or "attacker" (not {side})')
2121
return
2222
dmg = int(dmg_or_hits.replace("k", "000"))
23-
api = requests.get(link.replace("battle", "apiBattles").replace("id", "battleId")).json()[0]
23+
api = session.get(link.replace("battle", "apiBattles").replace("id", "battleId")).json()[0]
2424
if not session:
2525
session = login(server)
2626
r = session.get(link)
@@ -37,8 +37,8 @@ def fight(link, side, weaponQuality="0", dmg_or_hits="100kk", ticketQuality="5",
3737

3838
if api['type'] == "ATTACK":
3939
if side.lower() == "attacker":
40-
apiMap = requests.get(f'{URL}apiMap.html').json()
41-
apiRegions = requests.get(f'{URL}apiRegions.html').json()
40+
apiMap = session.get(f'{URL}apiMap.html').json()
41+
apiRegions = session.get(f'{URL}apiRegions.html').json()
4242
try:
4343
neighboursId = [region['neighbours'] for region in apiRegions if region["id"] == api['regionId']][0]
4444
aBonus = [i for region in apiMap for i in neighboursId if

Fight/hunt.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ def hunt(server, maxDmgForBh="500000", startTime="30", weaponQuality="5"):
1616
maxDmgForBh, startTime = int(maxDmgForBh.replace("k", "000")), int(startTime)
1717
print(f"Startint to hunt at {server}.")
1818
nick = get_nick_and_pw(server)[0]
19-
apiCitizen = requests.get(f"{URL}apiCitizenByName.html?name={nick.lower()}").json()
19+
apiCitizen = requests.get(f"{URL}apiCitizenByName.html?name={nick.lower()}", verify=False).json()
2020
while 1:
2121
try:
2222
battles_time = {}
23-
apiMap = requests.get(f'{URL}apiMap.html').json()
23+
apiMap = requests.get(f'{URL}apiMap.html', verify=False).json()
2424
for row in apiMap:
2525
if "battleId" in row:
26-
apiBattles = requests.get(f'{URL}apiBattles.html?battleId={row["battleId"]}').json()[0]
26+
apiBattles = requests.get(f'{URL}apiBattles.html?battleId={row["battleId"]}', verify=False).json()[0]
2727
round_ends = apiBattles["hoursRemaining"]*3600 + apiBattles["minutesRemaining"]*60 + apiBattles["secondsRemaining"]
2828
battles_time[row["battleId"]] = round_ends
29-
apiRegions = requests.get(URL + "apiRegions.html").json()
29+
apiRegions = requests.get(URL + "apiRegions.html", verify=False).json()
3030
for battle_id, round_ends in sorted(battles_time.items(), key=lambda x: x[1]):
31-
apiBattles = requests.get(f'{URL}apiBattles.html?battleId={battle_id}').json()[0]
31+
apiBattles = requests.get(f'{URL}apiBattles.html?battleId={battle_id}', verify=False).json()[0]
3232
if apiBattles['frozen']:
3333
continue
3434
time_to_sleep = apiBattles["hoursRemaining"]*3600 + apiBattles["minutesRemaining"]*60 + apiBattles["secondsRemaining"]
@@ -40,7 +40,7 @@ def hunt(server, maxDmgForBh="500000", startTime="30", weaponQuality="5"):
4040
time.sleep(time_to_sleep - startTime)
4141
except:
4242
pass
43-
apiFights = requests.get(f'{URL}apiFights.html?battleId={battle_id}&roundId={apiBattles["currentRound"]}').json()
43+
apiFights = requests.get(f'{URL}apiFights.html?battleId={battle_id}&roundId={apiBattles["currentRound"]}', verify=False).json()
4444
defender, attacker = {}, {}
4545
for hit in apiFights:
4646
side = defender if hit['defenderSide'] else attacker

Fight/hunt_specific_battle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def hunt_specific_battle(link, side, max_dmg_for_bh="1", weapon_quality="0"):
1919
print(f'"side" must be "defender" or "attacker" (not {side})')
2020
return
2121
max_dmg_for_bh = max_dmg_for_bh.replace("k", "000")
22-
r = requests.get(link.replace("battle", "apiBattles").replace("id", "battleId")).json()[0]
22+
r = requests.get(link.replace("battle", "apiBattles").replace("id", "battleId"), verify=False).json()[0]
2323
while 8 not in (r['defenderScore'], r['attackerScore']):
24-
r = requests.get(link.replace("battle", "apiBattles").replace("id", "battleId")).json()[0]
24+
r = requests.get(link.replace("battle", "apiBattles").replace("id", "battleId"), verify=False).json()[0]
2525
time_till_round_end = r["hoursRemaining"]*3600 + r["minutesRemaining"]*60 +\
2626
r["secondsRemaining"] - randint(15, 45)
2727
print(f"Hunting at {link} ({side}). sleeping for {time_till_round_end} seconds.")

Fight/win_battle.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ def watch(link, side, start_time="60", keep_wall="3kk", let_overkill="10000000",
3030
return
3131
let_overkill = let_overkill.replace("k", "000")
3232
keep_wall = keep_wall.replace("k", "000")
33-
r = requests.get(link.replace("battle", "apiBattles").replace("id", "battleId")).json()[0]
33+
r = requests.get(link.replace("battle", "apiBattles").replace("id", "battleId"), verify=False).json()[0]
3434
while 8 not in (r['defenderScore'], r['attackerScore']):
35-
r = requests.get(link.replace("battle", "apiBattles").replace("id", "battleId")).json()[0]
35+
r = requests.get(link.replace("battle", "apiBattles").replace("id", "battleId"), verify=False).json()[0]
3636
time_till_round_end = r["hoursRemaining"]*3600 + r["minutesRemaining"]*60 + \
3737
r["secondsRemaining"] - int(start_time)
3838
print(f"Sleeping for {time_till_round_end} seconds.")
@@ -47,8 +47,8 @@ def watch(link, side, start_time="60", keep_wall="3kk", let_overkill="10000000",
4747
gift_limit = tree.xpath('//*[@id="giftQ5"]/text()')[0]
4848
if r['type'] == "ATTACK":
4949
if side.lower() == "attacker":
50-
apiMap = requests.get(f'{URL}apiMap.html').json()
51-
apiRegions = requests.get(URL + "apiRegions.html").json()
50+
apiMap = session.get(f'{URL}apiMap.html').json()
51+
apiRegions = session.get(URL + "apiRegions.html").json()
5252
try:
5353
neighboursId = [z['neighbours'] for z in apiRegions if z["id"] == r['regionId']][0]
5454
aBonus = [i for z in apiMap for i in neighboursId if i == z['regionId'] and

Time_saver/missions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def missions(server, missions_to_complete="ALL", action="ALL", session=""):
110110
payload = {'action': "buy", 'id': productId, 'quantity': 1, "submit": "Buy"}
111111
session.post(URL + "productMarket.html", data=payload)
112112
elif num in (12, 54):
113-
Citizen = requests.get(f'{URL}apiCitizenById.html?id={my_id}').json()
114-
apiRegions = requests.get(URL + "apiRegions.html").json()
113+
Citizen = session.get(f'{URL}apiCitizenById.html?id={my_id}').json()
114+
apiRegions = session.get(URL + "apiRegions.html").json()
115115
capital = [row['id'] if row['homeCountry'] == Citizen['citizenshipId'] and
116116
row['capital'] else 1 for row in apiRegions][0]
117117
fly(server, capital, 3, session=session)
@@ -134,7 +134,7 @@ def missions(server, missions_to_complete="ALL", action="ALL", session=""):
134134
"sendToMilitaryUnit": "on", "sendToParty": "on", "sendToFriends": "on"}
135135
session.post(f"{URL}shoutActions.html", data=payload)
136136
elif num == 19:
137-
Citizen = requests.get(f'{URL}apiCitizenById.html?id={my_id}').json()
137+
Citizen = session.get(f'{URL}apiCitizenById.html?id={my_id}').json()
138138
monetaryMarket = session.get(
139139
URL + 'monetaryMarket.html?buyerCurrencyId=0&sellerCurrencyId=' + str(
140140
int(Citizen['currentLocationRegionId'] / 6)))
@@ -148,7 +148,7 @@ def missions(server, missions_to_complete="ALL", action="ALL", session=""):
148148
ID = tree.xpath(f'//*[starts-with(@id, "cell")]/a/text()')[0].replace("#", "")
149149
sell_eqs(server, ID, 0.01, 48, session)
150150
elif num == 22:
151-
Citizen = requests.get(f'{URL}apiCitizenById.html?id={my_id}').json()
151+
Citizen = session.get(f'{URL}apiCitizenById.html?id={my_id}').json()
152152
payload = {'product': "GRAIN", 'countryId': Citizen['citizenshipId'], 'storageType': "PRODUCT",
153153
"action": "POST_OFFER", "price": 0.1, "quantity": 100}
154154
sell_grain = session.post(URL + "storage.html", data=payload)
@@ -211,11 +211,11 @@ def missions(server, missions_to_complete="ALL", action="ALL", session=""):
211211
elif num == 52:
212212
fly(server, 1, 3, session)
213213
elif num == 55:
214-
requests.get(URL + f"lan.{my_id}/")
214+
requests.get(URL + f"lan.{my_id}/", verify=False)
215215
elif num in (61, 55):
216216
send_motivates(server, "ALL", session)
217217
elif num == 57:
218-
Citizen = requests.get(f'{URL}apiCitizenById.html?id={my_id}').json()
218+
Citizen = session.get(f'{URL}apiCitizenById.html?id={my_id}').json()
219219
payload = {'receiverName': f"{Citizen['citizenship']} Org", "title": "Hi",
220220
"body": choice(["Hi", "Can you send me some gold?", "Hello there!", "Discord?"]), "action": "REPLY", "submit": "Send"}
221221
session.post(URL + "composeMessage.html", data=payload)

Time_saver/sell_coins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
def mm(server, session=""):
77
"""Sells all currencies in your account in the appropriate markets & edit current offers if needed."""
88
URL = f"https://{server}.e-sim.org/"
9-
api = requests.get(URL + "apiCountries.html").json()
9+
api = requests.get(URL + "apiCountries.html", verify=False).json()
1010

1111
if not session:
1212
session = login(server)

0 commit comments

Comments
 (0)