IPFR33LY / EverwingHax

Parses the everwing data associated with a users ID and gives Max Coins, Trophies and upgrades all current dragons to max level.
MIT License
2 stars 2 forks source link

KeyError: '"' #6

Closed mikeechen closed 7 years ago

mikeechen commented 7 years ago

Not sure if you're still working on this. I stumbled upon this when looking around about this game and tried to run your script both using the .exe file and and script from the source, and I'm getting this error when running the script:

Traceback (most recent call last):
  File "Everwing_data.py", line 203, in <module>
    state = lz_string_decode(str(state))
  File "Everwing_data.py", line 24, in lz_string_decode
    lz_object = LZString.decompressFromBase64(lzstring)
  File "/Users/mikeechen/Projects/EverwingHax/p3lzstring.py", line 416, in decompressFromBase64
    return _decompress(len(compressed), 32, lambda index: getBaseValue(keyStrBase64, compressed[index]))
  File "/Users/mikeechen/Projects/EverwingHax/p3lzstring.py", line 224, in _decompress
    val=getNextValue(0),
  File "/Users/mikeechen/Projects/EverwingHax/p3lzstring.py", line 416, in <lambda>
    return _decompress(len(compressed), 32, lambda index: getBaseValue(keyStrBase64, compressed[index]))
  File "/Users/mikeechen/Projects/EverwingHax/p3lzstring.py", line 27, in getBaseValue
    return baseReverseDic[alphabet][character]
KeyError: '"'

Looking at the response from them it looks like they're using " as a key, and maybe that's where the error is coming from? Not a python dev, but would love to learn more and see if I can help with solving the problem!

IPFR33LY commented 7 years ago

They might have updated something on their side that broke the decompression. I haven't looked at this since the last commit I did.

Their compressed game state data probably changed.

On Aug 17, 2017 9:02 PM, "Michael Chen" notifications@github.com wrote:

Not sure if you're still working on this. I stumbled upon this when looking around about this game and tried to run your script both using the .exe file and and script from the source, and I'm getting this error when running the script:

File "Everwing_data.py", line 203, in state = lz_string_decode(str(state)) File "Everwing_data.py", line 24, in lz_string_decode lz_object = LZString.decompressFromBase64(lzstring) File "/Users/mikeechen/Projects/EverwingHax/p3lzstring.py", line 416, in decompressFromBase64 return _decompress(len(compressed), 32, lambda index: getBaseValue(keyStrBase64, compressed[index])) File "/Users/mikeechen/Projects/EverwingHax/p3lzstring.py", line 224, in _decompress val=getNextValue(0), File "/Users/mikeechen/Projects/EverwingHax/p3lzstring.py", line 416, in return _decompress(len(compressed), 32, lambda index: getBaseValue(keyStrBase64, compressed[index])) File "/Users/mikeechen/Projects/EverwingHax/p3lzstring.py", line 27, in getBaseValue return baseReverseDic[alphabet][character] KeyError: '"'```

Looking at the response from them it looks like they're using " as a key, and maybe that's where the error is coming from? Not a python dev, but would love to learn more and see if I can help with solving the problem!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/IPFR33LY/EverwingHax/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/AGP0SIRNZM9Wl9c-_PTDILI3cqr7x-_Xks5sZPCtgaJpZM4O7A9T .

mikeechen commented 7 years ago

Yea that's what I'm guessing as well. Any resource you suggest to look over so that maybe I can help a little on fixing this issue?

mikeechen commented 7 years ago
":[{"modelID":"Item:player","key":"0","state":"","stats":{"xp":104574,"lastClaimedLevel":16,"userID":"1281334205327861"},"createdTime":1502475990650.87,"createdAtAction":0},{"modelID":"Item:tutorial","key":"1","state":"","stats":{},"createdTime":1502475990650.87,"createdAtAction":0},{"modelID":"Currency:coin","key":"2","value":101081},{"modelID":"Currency:trophy","key":"3","value":2605},{"modelID":"Item:standard","key":"4","state":"questing:ocean","stats":{"level":5},"createdTime":1502475990651.87,"createdAtAction":0},{"modelID":"Item:fiona","key":"5","state":"questing:desert","stats":{"level":10},"createdTime":1502475990651.87,"createdAtAction":0},{"modelID":"Item:sophia","key":"6","state":"questing:snow","stats":{"level":1},"createdTime":1502475990651.87,"createdAtAction":0},{"modelID":"Item:coin","key":"7","state":"equipped","stats":{"level":50},"createdTime":1502475990651.87,"createdAtAction":0},{"modelID":"Item:magnet","key":"8","state":"locked","stats":{"level":1},"createdTime":1502475990651.87,"createdAtAction":0},{"modelID":"Item:lenore","key":"9","state":"locked","stats":{"level":1},"createdTime":1502475990651.87,"createdAtAction":0},{"modelID":"Item:jade","key":"10","state":"locked","stats":{"level":1},"createdTime":1502475990652.87,"createdAtAction":0},{"modelID":"Item:arcana","key":"11","state":"locked","stats":{"level":1},"createdTime":1502475990652.87,"createdAtAction":0},{"modelID":"Item:lastQuestData:forest","key":"12","state":"","stats":{"lastCharacterID":"4"},"createdTime":1502475990652.87,"createdAtAction":0},{"modelID":"Item:lastQuestData:ocean","key":"13","state":"","stats":{"lastCharacterID":"4","lastSidekickRightID":"48","lastSidekickLeftID":"59"},"createdTime":1502475990652.87,"createdAtAction":0},{"modelID":"Item:lastQuestData:desert","key":"14","state":"","stats":{"lastCharacterID":"5","lastSidekickLeftID":"26","lastSidekickRightID":"50"},"createdTime":1502475990652.87,"createdAtAction":0},{"modelID":"Item:lastQuestData:snow","key":"15","state":"","stats":{"lastCharacterID":"6","lastSidekickLeftID":"101","lastSidekickRightID":"106"},"createdTime":1502475990653.87,"createdAtAction":0},{"modelID":"Item:lastQuestData:volcano","key":"16","state":"","stats":{"lastCharacterID":"","lastSidekickLeftID":"","lastSidekickRightID":""},"createdTime":1502475990654.87,"createdAtAction":0},{"modelID":"Item:lastQuestData:neverend","key":"17","state":"","stats":{"lastCharacterID":"","lastSidekickLeftID":"","lastSidekickRightID":""},"createdTime":1502475990654.87,"createdAtAction":0},{"modelID":"Item:tutorialComplete","key":"19","state":"FTUE2","stats":{},"createdTime":1502481740775.1902,"createdAtAction":25},{"modelID":"Item:sidekick:FC00","key":"21","state":"idle","stats":{"maturity":1,"xp":12624,"zodiac":4,"zodiacBonus":0},"createdTime":1502484794448.57,"createdAtAction":56},{"modelID":"Item:sidekick:FC04","key":"23","state":"idle","stats":{"maturity":1,"xp":21400,"zodiac":8,"zodiacBonus":0},"createdTime":1502488521629.54,"createdAtAction":85},{"modelID":"Item:bossLoot","key":"24","state":"claimed","stats":{"bossNumber":1,"contextID":"1299920373468538","chestsRemaining":0,"chestsPurchased":1,"chestsOpenedByIndex":"10,23,12,2,16","isRewardSet":1,"chestType":"gold"},"createdTime":1502506166288.65,"createdAtAction":171},{"modelID":"Item:sidekick:LC10","key":"25","state":"idle","stats":{"maturity":1,"xp":21400,"zodiac":10,"zodiacBonus":0},"createdTime":1502506179278.65,"createdAtAction":173},{"modelID":"Item:sidekick:WC06","key":"26","state":"questing:desert","stats":{"maturity":1,"xp":21400,"zodiac":3,"zodiacBonus":0},"createdTime":1502506263921.65,"createdAtAction":177},{"modelID":"Item:bossLoot","key":"30","state":"claimed","stats":{"bossNumber":2,"contextID":"1299920373468538","chestsRemaining":0,"chestsPurchased":0,"chestsOpenedByIndex":"12,15,22,14","isRewardSet":1,"chestType":"gold"},"createdTime":1502523674111.19,"createdAtAction":206},{"modelID":"Item:sidekick:SC23","key":"31","state":"idle","stats":{"maturity":2,"xp":24990,"zodiac":2,"zodiacBonus":0},"createdTime":1502523691719.19,"createdAtAction":208},{"modelID":"Item:sidekick:NC02","key":"32","state":"equippedLeft","stats":{"maturity":1,"xp":21400,"zodiac":7,"zodiacBonus":0},"createdTime":1502523709012.19,"createdAtAction":209},{"modelID":"Item:sidekick:SC09","key":"33","state":"idle","stats":{"maturity":2,"xp":24990,"zodiac":9,"zodiacBonus":0},"createdTime":1502523759838.19,"createdAtAction":210},{"modelID":"Item:bossLoot","key":"38","state":"claimed","stats":{"bossNumber":3,"contextID":"1299920373468538","chestsRemaining":0,"chestsPurchased":0,"chestsOpenedByIndex":"21,10","isRewardSet":1,"chestType":"gold"},"createdTime":1502601683227.11,"createdAtAction":245},{"modelID":"Item:sidekick:FC23","key":"39","state":"idle","stats":{"maturity":1,"xp":21400,"zodiac":8,"zodiacBonus":0},"createdTime":1502601694721.11,"createdAtAction":246},{"modelID":"Item:bossLoot","key":"40","state":"claimed","stats":{"bossNumber":5,"contextID":"1299920373468538","chestsRemaining":0,"chestsPurchased":0,"chestsOpenedByIndex":"18,14,2,6","isRewardSet":1,"chestType":"gold"},"createdTime":1502760466983.1602,"createdAtAction":277},{"modelID":"Item:sidekick:FC10","key":"41","state":"idle","stats":{"maturity":1,"xp":0,"zodiac":4,"zodiacBonus":0},"createdTime":1502760473728.1602,"createdAtAction":278},{"modelID":"Item:sidekick:NC08","key":"42","state":"idle","stats":{"maturity":1,"xp":21400,"zodiac":6,"zodiacBonus":0},"createdTime":1502760484287.1602,"createdAtAction":279},{"modelID":"Item:bossLoot","key":"45","state":"claimed","stats":{"bossNumber":6,"contextID":"1299920373468538","chestsRemaining":0,"chestsPurchased":1,"chestsOpenedByIndex":"16,11,5","isRewardSet":1,"chestType":"gold"},"createdTime":1502764861376.66,"createdAtAction":311},{"modelID":"Item:sidekick:WC23","key":"48","state":"questing:ocean","stats":{"maturity":1,"xp":4370,"zodiac":8,"zodiacBonus":0},"createdTime":1502825042123.78,"createdAtAction":323},{"modelID":"Item:sidekick:WC06","key":"50","state":"questing:desert","stats":{"maturity":1,"xp":20418,"zodiac":7,"zodiacBonus":0},"createdTime":1502825231811.78,"createdAtAction":330},{"modelID":"Item:sidekick:FC10","key":"51","state":"idle","stats":{"maturity":1,"xp":69,"zodiac":9,"zodiacBonus":0},"createdTime":1502825259663.78,"createdAtAction":332},{"modelID":"Item:bossLoot","key":"56","state":"claimed","stats":{"bossNumber":7,"contextID":"1299920373468538","chestsRemaining":0,"chestsPurchased":1,"chestsOpenedByIndex":"16,17,9,20","isRewardSet":1,"chestType":"gold"},"createdTime":1502843807452.99,"createdAtAction":365},{"modelID":"Item:sidekick:NC08","key":"57","state":"idle","stats":{"maturity":1,"xp":3682,"zodiac":8,"zodiacBonus":0},"createdTime":1502843812322.99,"createdAtAction":366},{"modelID":"Item:sidekick:FC02","key":"58","state":"idle","stats":{"maturity":1,"xp":0,"zodiac":2,"zodiacBonus":0},"createdTime":1502843822240.99,"createdAtAction":367},{"modelID":"Item:sidekick:WC23","key":"59","state":"questing:ocean","stats":{"maturity":1,"xp":3447,"zodiac":7,"zodiacBonus":0},"createdTime":1502843845416.99,"createdAtAction":370},{"modelID":"Item:bossLoot","key":"65","state":"claimed","stats":{"bossNumber":8,"contextID":"1299920373468538","chestsRemaining":0,"chestsPurchased":0,"chestsOpenedByIndex":"1,16,24,12","isRewardSet":1,"chestType":"platinum"},"createdTime":1502908514203.55,"createdAtAction":386},{"modelID":"Item:sidekick:FC06","key":"67","state":"idle","stats":{"maturity":1,"xp":21400,"zodiac":9,"zodiacBonus":0},"createdTime":1502908548259.55,"createdAtAction":389},{"modelID":"Item:sidekick:LC08","key":"100","state":"idle","stats":{"maturity":1,"xp":0,"zodiac":8,"zodiacBonus":0},"createdTime":1503009286589.32,"createdAtAction":515},{"modelID":"Item:sidekick:NC08","key":"101","state":"questing:snow","stats":{"maturity":1,"xp":0,"zodiac":8,"zodiacBonus":0},"createdTime":1503009297035.32,"createdAtAction":516},{"modelID":"Item:sidekick:FC08","key":"102","state":"equippedRight","stats":{"maturity":1,"xp":4972,"zodiac":0,"zodiacBonus":0},"createdTime":1503009307167.32,"createdAtAction":517},{"modelID":"Item:sidekick:NC07","key":"103","state":"idle","stats":{"maturity":1,"xp":0,"zodiac":7,"zodiacBonus":0},"createdTime":1503009792172.32,"createdAtAction":519},{"modelID":"Item:sidekick:SC11","key":"104","state":"idle","stats":{"maturity":1,"xp":0,"zodiac":0,"zodiacBonus":0},"createdTime":1503009806854.32,"createdAtAction":520},{"modelID":"Item:sidekick:SC23","key":"105","state":"idle","stats":{"maturity":1,"xp":0,"zodiac":4,"zodiacBonus":0},"createdTime":1503009823348.32,"createdAtAction":521},{"modelID":"Item:sidekick:LC09","key":"106","state":"questing:snow","stats":{"maturity":1,"xp":0,"zodiac":5,"zodiacBonus":0},"createdTime":1503010366045.32,"createdAtAction":530},{"modelID":"Item:quest:ocean","key":"109","state":"","stats":{},"createdTime":1503017494066.13,"createdAtAction":548},{"modelID":"Item:quest:desert","key":"110","state":"","stats":{},"createdTime":1503017505037.13,"createdAtAction":551},{"modelID":"Item:quest:snow","key":"111","state":"","stats":{},"createdTime":1503017540342.13,"createdAtAction":552}],"instanceKeyIndex":112,"actionIndex":553,"modelHash":"md5:5dff227311f28456cc2c129cd853a561","internalHash":"md5:c724606f0c25a005e472ba2132340639","contextID":"default","userID":"1281334205327861","ownerUserID":"1281334205327861"}

I compared the response object with the state object that you're parsing, and it looks like there's an extra ": after you try to assign the variable state. I'm not entirely sure what's the data structure you're expecting, but I'd imagine this line

state = user_data['state'][11:]

might make a difference.

mikeechen commented 7 years ago

Hi I think I made it a lot easier on myself by just looking through your code and repeating similar steps in Javascript, and has been pretty successful in doing it. Thank you for the code!

IPFR33LY commented 7 years ago

Hey, sorry. I haven't been very active. Works a bit crazy. I will update the python code ASAP. and the data I want back after decompressing the string is a list object.

I'll probably go through and do a refactor and make my code a bit cleaner. Get rid of the unnecessary stuff and allow for more user interaction.

IPFR33LY commented 7 years ago

@mikeechen - I just executed the script and returned no errors when doing so. Can you send me your lz-string compressed game state data? edit: nevermind, I can grab it with your user id, lol.

I just tried mine, everything seems to work fine with no errors.

edit: Okay, looks like I need to take into consideration a few more things. I'll look over your game state data and get a solution for it.

mikeechen commented 7 years ago

Interesting. So where is the error popping out for you? Is it caused by the nature of the json object, which might be different for different players? Just wondering. My Javascript script has been working well for myself. I will let you know if I end up making a similar version of your program with JavaScript. It has been fun! And thank you for looking into this! :)

mikeechen commented 7 years ago

I just saw your comment on making this a website or something. I'm a web dev, and might seem interesting to make this thing a website and see how it goes. Might get shut down or something though since it's basically hacking into the game. Doesn't seem the devs there will be too happy about it.

nites commented 7 years ago

any update with a fix?