File: pytest.py

package info (click to toggle)
modsecurity 3.0.14-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 88,920 kB
  • sloc: ansic: 174,512; sh: 43,569; cpp: 26,214; python: 15,734; makefile: 3,864; yacc: 2,947; lex: 1,359; perl: 1,243; php: 42; tcl: 4
file content (35 lines) | stat: -rwxr-xr-x 759 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python

from libinjection import *

sqli= "1 UNION ALL SELECT * FROM FOO"

if False:
    s = sfilter()
    print sqli_fingerprint(s, sqli, CHAR_NULL, COMMENTS_ANSI)
    print "----"

if False:
    s = sfilter()
    current = stoken_t()
    sqli_init(s, sqli, CHAR_NULL, COMMENTS_ANSI)
    while sqli_tokenize(s, current):
        print current.type, current.val
    print "----"

def is_pattern(state):
    return sqli_blacklist(state) and sqli_not_whitelist(state)

s = sfilter()

if is_sqli(s, sqli, None):
    print "IS SQLI"
    print len(s.pat)
    print s.current.val
    print s.current.type
    vec = s.tokenvec
    for i in range(len(s.pat)):
        atoken = vec[i]
        print atoken.type, atoken.val
else:
    print "IS NOT SQLI"