Skip to content

Instantly share code, notes, and snippets.

@R3DHULK
Created February 4, 2023 16:06
Show Gist options
  • Save R3DHULK/032af76d8f35d3a46e44cbc5b68f20ea to your computer and use it in GitHub Desktop.
Save R3DHULK/032af76d8f35d3a46e44cbc5b68f20ea to your computer and use it in GitHub Desktop.
SQL Injection Vulnerability Scanner in C
#include <stdio.h>
#include <string.h>
#define PAYLOAD_LEN 100
int main(int argc, char *argv[])
{
char payload[PAYLOAD_LEN];
if (argc != 2) {
fprintf(stderr, "Usage: %s <input string>\n", argv[0]);
return 1;
}
strncpy(payload, argv[1], PAYLOAD_LEN);
if (strstr(payload, ";") != NULL || strstr(payload, "--") != NULL ||
strstr(payload, "union") != NULL || strstr(payload, "select") != NULL ||
strstr(payload, "from") != NULL || strstr(payload, "where") != NULL) {
printf(" [+] Possible SQL injection vulnerability found!\n");
} else {
printf(" [-] No SQL injection vulnerability found.\n");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment