Skip to content

Commit c18739f

Browse files
Update exploithawk.c
1 parent f9b03fe commit c18739f

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

exploithawk.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ const char *exploitDirs[] = {
5353
"/var/exploits"
5454
};
5555

56+
const char *exploitDBRoots[] = {
57+
"/usr/share/exploitdb",
58+
"/var/lib/exploitdb",
59+
"/opt/exploitdb"
60+
};
61+
5662
char search_term[128];
5763

5864

@@ -112,7 +118,18 @@ void *load_csv_thread(void *arg) {
112118
if (col >= 3 && matches_search(cols[2], search_term)) {
113119
trim_newline(cols[1]);
114120
trim_newline(cols[2]);
115-
add_result("CSV", cols[2], cols[1]);
121+
if (col >= 3 && matches_search(cols[2], search_term)) {
122+
char fullpath[MAX_PATH] = "";
123+
// Find first existing ExploitDB root
124+
for (int r = 0; r < sizeof(exploitDBRoots)/sizeof(exploitDBRoots[0]); r++) {
125+
snprintf(fullpath, sizeof(fullpath), "%s/%s", exploitDBRoots[r], cols[1]);
126+
if (access(fullpath, F_OK) == 0) { // file exists
127+
add_result("ExploitDB", cols[2], fullpath);
128+
break;
129+
}
130+
}
131+
}
132+
116133
}
117134
}
118135
fclose(f);

0 commit comments

Comments
 (0)