Created
February 4, 2023 16:06
-
-
Save R3DHULK/032af76d8f35d3a46e44cbc5b68f20ea to your computer and use it in GitHub Desktop.
SQL Injection Vulnerability Scanner in C
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
#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