diff --git a/core/aimedb.py b/core/aimedb.py index 64bac8d..39d6373 100644 --- a/core/aimedb.py +++ b/core/aimedb.py @@ -63,7 +63,7 @@ class AimedbProtocol(Protocol): try: decrypted = cipher.decrypt(data) - except: + except Exception: self.logger.error(f"Failed to decrypt {data.hex()}") return None diff --git a/core/data/schema/base.py b/core/data/schema/base.py index 319101f..a53392f 100644 --- a/core/data/schema/base.py +++ b/core/data/schema/base.py @@ -58,7 +58,7 @@ class BaseData: self.logger.error(f"UnicodeEncodeError error {e}") return None - except: + except Exception: try: res = self.conn.execute(sql, opts) @@ -70,7 +70,7 @@ class BaseData: self.logger.error(f"UnicodeEncodeError error {e}") return None - except: + except Exception: self.logger.error(f"Unknown error") raise diff --git a/core/frontend.py b/core/frontend.py index 9eb30e6..f01be50 100644 --- a/core/frontend.py +++ b/core/frontend.py @@ -130,7 +130,7 @@ class FE_Gate(FE_Base): if b"e" in request.args: try: err = int(request.args[b"e"][0].decode()) - except: + except Exception: err = 0 else: diff --git a/core/mucha.py b/core/mucha.py index 6bb34d7..8d9dd8e 100644 --- a/core/mucha.py +++ b/core/mucha.py @@ -68,10 +68,13 @@ class MuchaServlet: return b"RESULTS=000" # TODO: Decrypt S/N + b_key = b"" + for x in range(8): + b_key += req.sendDate[(x - 1) & 7].encode() - #cipher = Blowfish.new(req.sendDate.encode(), Blowfish.MODE_ECB) - #sn_decrypt = cipher.decrypt(bytes.fromhex(req.serialNum)) - #self.logger.debug(f"Decrypt SN to {sn_decrypt.hex()}") + cipher = Blowfish.new(b_key, Blowfish.MODE_ECB) + sn_decrypt = cipher.decrypt(bytes.fromhex(req.serialNum)) + self.logger.debug(f"Decrypt SN to {sn_decrypt.hex()}") resp = MuchaAuthResponse( f"{self.config.mucha.hostname}{':' + str(self.config.allnet.port) if self.config.server.is_develop else ''}" @@ -131,7 +134,7 @@ class MuchaServlet: return ret - except: + except Exception: self.logger.error(f"Error processing mucha request {data}") return None @@ -143,7 +146,7 @@ class MuchaServlet: return urlencode.encode() - except: + except Exception: self.logger.error("Error processing mucha response") return None diff --git a/titles/chuni/base.py b/titles/chuni/base.py index ed8d0fb..4c4361c 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -644,7 +644,7 @@ class ChuniBase: upsert["userData"][0]["userName"] = self.read_wtf8( upsert["userData"][0]["userName"] ) - except: + except Exception: pass self.data.profile.put_profile_data( diff --git a/titles/cxb/base.py b/titles/cxb/base.py index a649f31..89e9cc3 100644 --- a/titles/cxb/base.py +++ b/titles/cxb/base.py @@ -197,7 +197,7 @@ class CxbBase: v_profile = self.data.profile.get_profile_index(0, uid, self.version) v_profile_data = v_profile["data"] versionindex.append(int(v_profile_data["appVersion"])) - except: + except Exception: versionindex.append("10400") def handle_action_loadrange_request(self, data: Dict) -> Dict: @@ -286,7 +286,7 @@ class CxbBase: # REV Omnimix Version Fetcher gameversion = data["saveindex"]["data"][0][2] self.logger.warning(f"Game Version is {gameversion}") - except: + except Exception: pass if "10205" in gameversion: @@ -348,7 +348,7 @@ class CxbBase: # Sunrise try: profileIndex = save_data["index"].index("0") - except: + except Exception: return {"data": ""} # Maybe profile = json.loads(save_data["data"][profileIndex]) @@ -496,7 +496,7 @@ class CxbBase: score=int(rid["sc"][0]), clear=rid["clear"], ) - except: + except Exception: self.data.score.put_ranking( user_id=uid, rev_id=int(rid["rid"]), @@ -514,7 +514,7 @@ class CxbBase: score=int(rid["sc"][0]), clear=0, ) - except: + except Exception: self.data.score.put_ranking( user_id=uid, rev_id=int(rid["rid"]), diff --git a/titles/cxb/read.py b/titles/cxb/read.py index cf2d8e1..06a171f 100644 --- a/titles/cxb/read.py +++ b/titles/cxb/read.py @@ -123,5 +123,5 @@ class CxbReader(BaseReader): genre, int(row["easy"].replace("Easy ", "").replace("N/A", "0")), ) - except: + except Exception: self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping") diff --git a/titles/mai2/index.py b/titles/mai2/index.py index b54832e..9652fc8 100644 --- a/titles/mai2/index.py +++ b/titles/mai2/index.py @@ -113,13 +113,13 @@ class Mai2Servlet: if self.game_cfg.uploads.photos and self.game_cfg.uploads.photos_dir and not path.exists(self.game_cfg.uploads.photos_dir): try: mkdir(self.game_cfg.uploads.photos_dir) - except: + except Exception: self.logger.error(f"Failed to make photo upload directory at {self.game_cfg.uploads.photos_dir}") if self.game_cfg.uploads.movies and self.game_cfg.uploads.movies_dir and not path.exists(self.game_cfg.uploads.movies_dir): try: mkdir(self.game_cfg.uploads.movies_dir) - except: + except Exception: self.logger.error(f"Failed to make movie upload directory at {self.game_cfg.uploads.movies_dir}") def render_POST(self, request: Request, version: int, url_path: str) -> bytes: diff --git a/titles/sao/read.py b/titles/sao/read.py index d70c275..649fa02 100644 --- a/titles/sao/read.py +++ b/titles/sao/read.py @@ -65,7 +65,7 @@ class SaoReader(BaseReader): ) except Exception as err: print(err) - except: + except Exception: self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping") self.logger.info("Now reading HeroLog.csv") @@ -99,7 +99,7 @@ class SaoReader(BaseReader): ) except Exception as err: print(err) - except: + except Exception: self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping") self.logger.info("Now reading Equipment.csv") @@ -131,7 +131,7 @@ class SaoReader(BaseReader): ) except Exception as err: print(err) - except: + except Exception: self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping") self.logger.info("Now reading Item.csv") @@ -161,7 +161,7 @@ class SaoReader(BaseReader): ) except Exception as err: print(err) - except: + except Exception: self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping") self.logger.info("Now reading SupportLog.csv") @@ -193,7 +193,7 @@ class SaoReader(BaseReader): ) except Exception as err: print(err) - except: + except Exception: self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping") self.logger.info("Now reading Title.csv") @@ -226,7 +226,7 @@ class SaoReader(BaseReader): print(err) elif len(titleId) < 6: # current server code cannot have multiple lengths for the id continue - except: + except Exception: self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping") self.logger.info("Now reading RareDropTable.csv") @@ -250,5 +250,5 @@ class SaoReader(BaseReader): ) except Exception as err: print(err) - except: + except Exception: self.logger.warn(f"Couldn't read csv file in {self.bin_dir}, skipping") diff --git a/titles/wacca/base.py b/titles/wacca/base.py index cca6aa5..2351001 100644 --- a/titles/wacca/base.py +++ b/titles/wacca/base.py @@ -426,7 +426,7 @@ class WaccaBase: elif item["type"] == WaccaConstants.ITEM_TYPES["note_sound"]: resp.userItems.noteSounds.append(itm_send) - except: + except Exception: self.logger.error( f"{__name__} Failed to load item {item['item_id']} for user {profile['user']}" ) diff --git a/titles/wacca/const.py b/titles/wacca/const.py index 284d236..b25d3ac 100644 --- a/titles/wacca/const.py +++ b/titles/wacca/const.py @@ -221,5 +221,5 @@ class WaccaConstants: cls.Region.YAMANASHI, cls.Region.WAKAYAMA, ][region] - except: + except Exception: return None diff --git a/titles/wacca/index.py b/titles/wacca/index.py index a59cda1..e36c295 100644 --- a/titles/wacca/index.py +++ b/titles/wacca/index.py @@ -93,7 +93,7 @@ class WaccaServlet: try: req_json = json.loads(request.content.getvalue()) version_full = Version(req_json["appVersion"]) - except: + except Exception: self.logger.error( f"Failed to parse request to {url_path} -> {request.content.getvalue()}" ) diff --git a/titles/wacca/lily.py b/titles/wacca/lily.py index 6ac60de..3ac03fa 100644 --- a/titles/wacca/lily.py +++ b/titles/wacca/lily.py @@ -424,7 +424,7 @@ class WaccaLily(WaccaS): elif item["type"] == WaccaConstants.ITEM_TYPES["note_sound"]: resp.userItems.noteSounds.append(itm_send) - except: + except Exception: self.logger.error( f"{__name__} Failed to load item {item['item_id']} for user {profile['user']}" ) diff --git a/titles/wacca/reverse.py b/titles/wacca/reverse.py index 1711013..728ef0a 100644 --- a/titles/wacca/reverse.py +++ b/titles/wacca/reverse.py @@ -289,7 +289,7 @@ class WaccaReverse(WaccaLilyR): elif item["type"] == WaccaConstants.ITEM_TYPES["note_sound"]: resp.userItems.noteSounds.append(itm_send) - except: + except Exception: self.logger.error( f"{__name__} Failed to load item {item['item_id']} for user {profile['user']}" )