Skip to content

Commit

Permalink
Close #126 - add help to sqli tool
Browse files Browse the repository at this point in the history
  • Loading branch information
nickg committed May 21, 2017
1 parent 98be0b1 commit e194dd6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* client9/libinjection#112 - fix shared library on macOS
* client9/libinjection#122 #115 - false positive issue for XSS
* client9/libinjection#113 - save space in struct
* #126 - add usage to sqli cli tool

# v3.9.2 - 2016-05-21

Expand Down
1 change: 1 addition & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ reader: reader.c ${STATICLIB}
${CC} ${CFLAGS} -o reader reader.c -L. ${STATICLIB}

sqli: sqli_cli.c ${STATICLIB}
rm -f sqli
${CC} ${CFLAGS} -o sqli sqli_cli.c -L. ${STATICLIB}

html5: html5_cli.c ${STATICLIB}
Expand Down
22 changes: 21 additions & 1 deletion src/sqli_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ void print_token(stoken_t *t) {
printf("%s", "\n");
}

void usage() {
printf("\n");
printf("libinjection sqli tester\n");
printf("\n");
printf(" -ca parse as ANSI SQL\n");
printf(" -cm parse as MySQL SQL\n");
printf(" -q0 parse as is\n");
printf(" -q1 parse in single-quote mode\n");
printf(" -q2 parse in doiuble-quote mode\n");
printf("\n");
printf(" -f --fold fold results\n");
printf("\n");
printf(" -d --detect detect SQLI. empty reply = not detected\n");
printf("\n");
}

int main(int argc, const char* argv[])
{
size_t slen;
Expand All @@ -78,10 +94,14 @@ int main(int argc, const char* argv[])
sfilter sf;

if (argc < 2) {
fprintf(stderr, "need more args\n");
usage();
return 1;
}
while (1) {
if (strcmp(argv[offset], "-h") == 0 || strcmp(argv[offset], "-?") == 0 || strcmp(argv[offset], "--help") == 0) {
usage();
return 1;
}
if (strcmp(argv[offset], "-m") == 0) {
flags |= FLAG_SQL_MYSQL;
offset += 1;
Expand Down

0 comments on commit e194dd6

Please sign in to comment.