From 13559f14d66dc2be990610fec3221a1955063173 Mon Sep 17 00:00:00 2001 From: Josue Date: Wed, 5 Jun 2019 09:23:02 +0200 Subject: Now re.findall is used --- pwndb_credentials.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/pwndb_credentials.py b/pwndb_credentials.py index 8fa6896..c0fbc1d 100644 --- a/pwndb_credentials.py +++ b/pwndb_credentials.py @@ -36,19 +36,16 @@ class FindPasswords(): def request_data(self): result = [] - if self.session is None: - return [] - try: + if self.session is not None: response = self.session.post(self.url, data=self.data, timeout=5) - soup = soup = BeautifulSoup(response.text, features="html.parser") - passwords = soup.find("pre").get_text() - if passwords: - i = 0 - for line in passwords.split("\n"): - if "[password]" in line: + if response.status_code == 200: + soup = BeautifulSoup(response.text, features="html.parser") + try: + passwords = soup.find("pre").get_text() + for line in re.findall("\[password\] => .*", passwords): result.append(line.split("=> ")[1]) - except Exception as e: - print(e) + except Exception as e: + print(e) return result -- cgit v1.2.3