aboutsummaryrefslogtreecommitdiff
path: root/src/lib/third_party/include/libinjection.h
diff options
context:
space:
mode:
authorLuca Deri <lucaderi@users.noreply.github.com>2019-12-08 23:49:23 +0100
committerGitHub <noreply@github.com>2019-12-08 23:49:23 +0100
commit1a115cac5a05afb3d3aa5fc982db1dde5a72f42c (patch)
tree4a5810f4cf3b43b58b4fdcd2652fb9b9b9f9f6f9 /src/lib/third_party/include/libinjection.h
parent11401edfe7c4c9f9728c64172a48c2ea4401c750 (diff)
parent606ff10ecf9efb69dee24e0ce88ce40195bdda7d (diff)
Merge pull request #817 from MrTiz9/dev
Integration of the libinjection library
Diffstat (limited to 'src/lib/third_party/include/libinjection.h')
-rw-r--r--src/lib/third_party/include/libinjection.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/lib/third_party/include/libinjection.h b/src/lib/third_party/include/libinjection.h
new file mode 100644
index 000000000..6b40b1df6
--- /dev/null
+++ b/src/lib/third_party/include/libinjection.h
@@ -0,0 +1,65 @@
+/**
+ * Copyright 2012-2016 Nick Galbreath
+ * nickg@client9.com
+ * BSD License -- see COPYING.txt for details
+ *
+ * https://libinjection.client9.com/
+ *
+ */
+
+#ifndef LIBINJECTION_H
+#define LIBINJECTION_H
+
+#ifdef __cplusplus
+# define LIBINJECTION_BEGIN_DECLS extern "C" {
+# define LIBINJECTION_END_DECLS }
+#else
+# define LIBINJECTION_BEGIN_DECLS
+# define LIBINJECTION_END_DECLS
+#endif
+
+LIBINJECTION_BEGIN_DECLS
+
+/*
+ * Pull in size_t
+ */
+#include <string.h>
+
+/*
+ * Version info.
+ *
+ * This is moved into a function to allow SWIG and other auto-generated
+ * binding to not be modified during minor release changes. We change
+ * change the version number in the c source file, and not regenerated
+ * the binding
+ *
+ * See python's normalized version
+ * http://www.python.org/dev/peps/pep-0386/#normalizedversion
+ */
+const char* libinjection_version(void);
+
+/**
+ * Simple API for SQLi detection - returns a SQLi fingerprint or NULL
+ * is benign input
+ *
+ * \param[in] s input string, may contain nulls, does not need to be null-terminated
+ * \param[in] slen input string length
+ * \param[out] fingerprint buffer of 8+ characters. c-string,
+ * \return 1 if SQLi, 0 if benign. fingerprint will be set or set to empty string.
+ */
+int libinjection_sqli(const char* s, size_t slen, char fingerprint[]);
+
+/** ALPHA version of xss detector.
+ *
+ * NOT DONE.
+ *
+ * \param[in] s input string, may contain nulls, does not need to be null-terminated
+ * \param[in] slen input string length
+ * \return 1 if XSS found, 0 if benign
+ *
+ */
+int libinjection_xss(const char* s, size_t slen);
+
+LIBINJECTION_END_DECLS
+
+#endif /* LIBINJECTION_H */