Skip to content

Commit a993595

Browse files
committed
release: v1.1.0 - (add commit history, fix URL output, and truncate descriptions)
1 parent 808bff9 commit a993595

File tree

3 files changed

+121
-37
lines changed

3 files changed

+121
-37
lines changed

dumpdork.py

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@ def save_config(config_file, keys_dict):
6666
yaml.dump(config, file, default_flow_style=False)
6767
print(f"{Fore.GREEN}Configuration saved to '{config_file}'")
6868

69+
def get_github_commits(repo_full_name, key, limit=3):
70+
url = f"https://api.github.com/repos/{repo_full_name}/commits"
71+
headers = {
72+
'Accept': "application/vnd.github.v3+json",
73+
'User-Agent': 'DumpDork-Tool'
74+
}
75+
if key and key.strip() != "" and key != "Not configured":
76+
headers['Authorization'] = f"token {key}"
77+
78+
try:
79+
response = requests.get(url, headers=headers, params={'per_page': limit})
80+
if response.status_code == 200:
81+
return response.json()
82+
except:
83+
pass
84+
return []
85+
6986
def perform_search(source, query, limit, key):
7087
if source not in PROVIDERS:
7188
return None
@@ -81,7 +98,7 @@ def perform_search(source, query, limit, key):
8198
headers['Authorization'] = f"token {key}"
8299
headers['Accept'] = "application/vnd.github.v3+json"
83100
headers['User-Agent'] = 'DumpDork-Tool'
84-
101+
85102
elif source == "google":
86103
url = provider["url_pattern"]
87104
params = {'query': query, 'limit': limit}
@@ -97,7 +114,7 @@ def perform_search(source, query, limit, key):
97114
'x-rapidapi-host': provider["host"],
98115
'x-rapidapi-key': key
99116
}
100-
117+
101118
try:
102119
response = requests.get(url, headers=headers, params=params)
103120
if response.status_code == 200:
@@ -114,7 +131,7 @@ def perform_search(source, query, limit, key):
114131

115132
def wizard_setup():
116133
print(f"{Fore.YELLOW}{Style.BRIGHT}Welcome to the DumpDork API Setup Wizard!")
117-
134+
118135
keys_dict = {}
119136
if os.path.exists(CONFIG_FILE):
120137
try:
@@ -129,18 +146,18 @@ def wizard_setup():
129146
print("Using official GitHub API (api.github.com)")
130147
else:
131148
print(f"RapidAPI Host: {PROVIDERS[source]['host']}")
132-
149+
133150
current_key = keys_dict.get(source, "Not configured")
134151
print(f"Current Key: {current_key}")
135-
152+
136153
prompt = f"Enter API key/token for {source} (leave blank to skip): "
137154
new_key = input(prompt).strip()
138-
155+
139156
if new_key.lower() == 'clear':
140157
keys_dict[source] = ""
141158
elif new_key:
142159
keys_dict[source] = new_key
143-
160+
144161
save_config(CONFIG_FILE, keys_dict)
145162

146163
def main():
@@ -182,22 +199,47 @@ def main():
182199

183200
if results:
184201
items = []
185-
if args.source == "brave":
186-
items = results.get('results', []) or results.get('web', {}).get('results', [])
187-
elif args.source == "github":
202+
if args.source == "github":
188203
items = results.get('items', [])
204+
elif args.source == "brave":
205+
items = results.get('results', []) or results.get('web', {}).get('results', [])
189206
else: # Google
190207
items = results.get('results', [])
191208

192209
for item in items:
193-
title = item.get('title') or item.get('full_name') or 'No Title'
194-
url = item.get('url') or item.get('html_url') or item.get('link') or 'No URL'
195-
desc = item.get('description') or item.get('snippet') or 'No Description'
196-
197-
print(f"{Fore.CYAN}Title: {Style.BRIGHT}{title}")
198-
print(f"{Fore.GREEN}URL: {Style.BRIGHT}{urllib.parse.unquote(url)}")
199-
print(f"{Fore.MAGENTA}Description: {Style.BRIGHT}{desc}\n")
200-
210+
if args.source == "github":
211+
full_name = item.get('full_name') or 'No Name'
212+
url = item.get('html_url') or 'No URL'
213+
desc = item.get('description') or 'No Description'
214+
owner = item.get('owner', {}).get('login', 'Unknown')
215+
216+
if desc and len(desc) > 150:
217+
desc = desc[:147] + "..."
218+
219+
print(f"{Fore.CYAN}Repo: {Style.BRIGHT}{full_name} ({Fore.WHITE}by @{owner}{Fore.CYAN})")
220+
print(f"{Fore.GREEN}URL: {Style.BRIGHT}{urllib.parse.unquote(url)}")
221+
print(f"{Fore.MAGENTA}Description: {Style.BRIGHT}{desc}")
222+
223+
commits = get_github_commits(full_name, api_key)
224+
if commits:
225+
print(f"{Fore.YELLOW}Recent Commits:")
226+
for c in commits:
227+
msg = c.get('commit', {}).get('message', '').split('\n')[0]
228+
date = c.get('commit', {}).get('author', {}).get('date', '')[:10]
229+
print(f" {Fore.WHITE}- [{date}] {msg[:80]}")
230+
print("")
231+
else:
232+
title = item.get('title') or 'No Title'
233+
url = item.get('url') or item.get('link') or 'No URL'
234+
desc = item.get('description') or item.get('snippet') or 'No Description'
235+
236+
if desc and len(desc) > 150:
237+
desc = desc[:147] + "..."
238+
239+
print(f"{Fore.CYAN}Title: {Style.BRIGHT}{title}")
240+
print(f"{Fore.GREEN}URL: {Style.BRIGHT}{urllib.parse.unquote(url)}")
241+
print(f"{Fore.MAGENTA}Description: {Style.BRIGHT}{desc}\n")
242+
201243
print(f"{Fore.YELLOW}{Style.BRIGHT}Execution finished. Total results found: {len(items)}")
202244

203245
if args.output:

dumpdork/main.py

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@ def save_config(config_file, keys_dict):
6666
yaml.dump(config, file, default_flow_style=False)
6767
print(f"{Fore.GREEN}Configuration saved to '{config_file}'")
6868

69+
def get_github_commits(repo_full_name, key, limit=3):
70+
url = f"https://api.github.com/repos/{repo_full_name}/commits"
71+
headers = {
72+
'Accept': "application/vnd.github.v3+json",
73+
'User-Agent': 'DumpDork-Tool'
74+
}
75+
if key and key.strip() != "" and key != "Not configured":
76+
headers['Authorization'] = f"token {key}"
77+
78+
try:
79+
response = requests.get(url, headers=headers, params={'per_page': limit})
80+
if response.status_code == 200:
81+
return response.json()
82+
except:
83+
pass
84+
return []
85+
6986
def perform_search(source, query, limit, key):
7087
if source not in PROVIDERS:
7188
return None
@@ -81,7 +98,7 @@ def perform_search(source, query, limit, key):
8198
headers['Authorization'] = f"token {key}"
8299
headers['Accept'] = "application/vnd.github.v3+json"
83100
headers['User-Agent'] = 'DumpDork-Tool'
84-
101+
85102
elif source == "google":
86103
url = provider["url_pattern"]
87104
params = {'query': query, 'limit': limit}
@@ -97,7 +114,7 @@ def perform_search(source, query, limit, key):
97114
'x-rapidapi-host': provider["host"],
98115
'x-rapidapi-key': key
99116
}
100-
117+
101118
try:
102119
response = requests.get(url, headers=headers, params=params)
103120
if response.status_code == 200:
@@ -114,7 +131,7 @@ def perform_search(source, query, limit, key):
114131

115132
def wizard_setup():
116133
print(f"{Fore.YELLOW}{Style.BRIGHT}Welcome to the DumpDork API Setup Wizard!")
117-
134+
118135
keys_dict = {}
119136
if os.path.exists(CONFIG_FILE):
120137
try:
@@ -129,18 +146,18 @@ def wizard_setup():
129146
print("Using official GitHub API (api.github.com)")
130147
else:
131148
print(f"RapidAPI Host: {PROVIDERS[source]['host']}")
132-
149+
133150
current_key = keys_dict.get(source, "Not configured")
134151
print(f"Current Key: {current_key}")
135-
152+
136153
prompt = f"Enter API key/token for {source} (leave blank to skip): "
137154
new_key = input(prompt).strip()
138-
155+
139156
if new_key.lower() == 'clear':
140157
keys_dict[source] = ""
141158
elif new_key:
142159
keys_dict[source] = new_key
143-
160+
144161
save_config(CONFIG_FILE, keys_dict)
145162

146163
def main():
@@ -182,22 +199,47 @@ def main():
182199

183200
if results:
184201
items = []
185-
if args.source == "brave":
186-
items = results.get('results', []) or results.get('web', {}).get('results', [])
187-
elif args.source == "github":
202+
if args.source == "github":
188203
items = results.get('items', [])
204+
elif args.source == "brave":
205+
items = results.get('results', []) or results.get('web', {}).get('results', [])
189206
else: # Google
190207
items = results.get('results', [])
191208

192209
for item in items:
193-
title = item.get('title') or item.get('full_name') or 'No Title'
194-
url = item.get('url') or item.get('html_url') or item.get('link') or 'No URL'
195-
desc = item.get('description') or item.get('snippet') or 'No Description'
196-
197-
print(f"{Fore.CYAN}Title: {Style.BRIGHT}{title}")
198-
print(f"{Fore.GREEN}URL: {Style.BRIGHT}{urllib.parse.unquote(url)}")
199-
print(f"{Fore.MAGENTA}Description: {Style.BRIGHT}{desc}\n")
200-
210+
if args.source == "github":
211+
full_name = item.get('full_name') or 'No Name'
212+
url = item.get('html_url') or 'No URL'
213+
desc = item.get('description') or 'No Description'
214+
owner = item.get('owner', {}).get('login', 'Unknown')
215+
216+
if desc and len(desc) > 150:
217+
desc = desc[:147] + "..."
218+
219+
print(f"{Fore.CYAN}Repo: {Style.BRIGHT}{full_name} ({Fore.WHITE}by @{owner}{Fore.CYAN})")
220+
print(f"{Fore.GREEN}URL: {Style.BRIGHT}{urllib.parse.unquote(url)}")
221+
print(f"{Fore.MAGENTA}Description: {Style.BRIGHT}{desc}")
222+
223+
commits = get_github_commits(full_name, api_key)
224+
if commits:
225+
print(f"{Fore.YELLOW}Recent Commits:")
226+
for c in commits:
227+
msg = c.get('commit', {}).get('message', '').split('\n')[0]
228+
date = c.get('commit', {}).get('author', {}).get('date', '')[:10]
229+
print(f" {Fore.WHITE}- [{date}] {msg[:80]}")
230+
print("")
231+
else:
232+
title = item.get('title') or 'No Title'
233+
url = item.get('url') or item.get('link') or 'No URL'
234+
desc = item.get('description') or item.get('snippet') or 'No Description'
235+
236+
if desc and len(desc) > 150:
237+
desc = desc[:147] + "..."
238+
239+
print(f"{Fore.CYAN}Title: {Style.BRIGHT}{title}")
240+
print(f"{Fore.GREEN}URL: {Style.BRIGHT}{urllib.parse.unquote(url)}")
241+
print(f"{Fore.MAGENTA}Description: {Style.BRIGHT}{desc}\n")
242+
201243
print(f"{Fore.YELLOW}{Style.BRIGHT}Execution finished. Total results found: {len(items)}")
202244

203245
if args.output:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name='dumpdork',
5-
version='1.0.0',
5+
version='1.1.0',
66
packages=find_packages(),
77
install_requires=[
88
'colorama==0.4.6',

0 commit comments

Comments
 (0)