diff options
author | Josue <j.encinar.87@gmail.com> | 2019-06-05 09:23:02 +0200 |
---|---|---|
committer | Josue <j.encinar.87@gmail.com> | 2019-06-05 09:24:00 +0200 |
commit | 13559f14d66dc2be990610fec3221a1955063173 (patch) | |
tree | 7a23764e0407ed6115ade8df939b4f484d5f862e /pwndb_credentials.py | |
parent | 98d95965d435a42de962d4e818dd28d98245b2a8 (diff) | |
download | pwndbtorcredentials-13559f14d66dc2be990610fec3221a1955063173.tar.lz pwndbtorcredentials-13559f14d66dc2be990610fec3221a1955063173.tar.xz pwndbtorcredentials-13559f14d66dc2be990610fec3221a1955063173.zip |
Now re.findall is used
Diffstat (limited to 'pwndb_credentials.py')
-rw-r--r-- | pwndb_credentials.py | 19 |
1 files 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 |