Created
September 11, 2023 21:06
-
-
Save evost/e18e8ee3a9f56997394bffd768251fdc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
import pickle | |
version = '11.09.2023_45767' | |
def get_exploit_db(): | |
length = 6000 | |
result = [] | |
for i in range(8): | |
print(f'Iteration {i}. Records: {i * length} - {(i + 1) * length}') | |
url = f'https://www.exploit-db.com/?draw=3&start={i * length}&length={length}' | |
print(url) | |
response = requests.get(url, headers={'User-Agent': 'python', 'X-Requested-With': 'XMLHttpRequest'}) | |
print('Response done') | |
result.extend(response.json()['data']) | |
print('Result extended') | |
with open(file=f'exploit-db_{version}_list.pickle', mode='wb') as edb: | |
pickle.dump(obj=result, file=edb, protocol=None, fix_imports=True, buffer_callback=None) | |
print('Pickle file done') | |
print(edb.name) | |
with open(file=f'exploit-db_{version}_list.json', mode='w', encoding="utf-8") as edb: | |
json.dump(obj=result, fp=edb) | |
print('File done') | |
print(edb.name) | |
def read_exploit_db(): | |
with open(file=f'exploit-db_{version}_list.pickle', mode='rb') as edb: | |
return pickle.load(file=edb, fix_imports=True) | |
if __name__ == '__main__': | |
get_exploit_db() | |
obj = read_exploit_db() | |
print(len(obj)) | |
print(type(obj)) | |
print(json.dumps(obj=obj[0], indent=2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment