aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Expand)AuthorAgeFilesLines
* scripts/kconfig.pl: Indicate which file we couldn't openJohn Crispin2014-01-191-1/+1
* scripts/download.pl: prefer the GNU mirror redirect over the primary site (#1...Felix Fietkau2013-12-131-1/+1
* add a feature flag for device tree supportImre Kaloz2013-11-221-0/+1
* scripts/gen-dependencies.sh: prevent zero-length dep.* files from accumulatin...Felix Fietkau2013-11-191-1/+1
* build: fix build on Mac OS X 10.9Felix Fietkau2013-10-281-0/+12
* ipkg-make-index: use more backwards-compatible openssl call for SHA256Steven Barth2013-10-171-1/+1
* build: drop FIT option until we actually need itLuka Perkov2013-10-171-1/+0
* build: add menuconfig option for building FIT imagesLuka Perkov2013-10-161-0/+1
* build: move mkits.sh script to more common placeLuka Perkov2013-10-161-0/+115
* opkg: add support for SHA256 verificationSteven Barth2013-10-041-0/+2
* scripts/gen-dependencies.sh: use the cross readelf (#12940)Felix Fietkau2013-09-291-1/+1
* build: include the cpu type as part of the toolchain/target directory nameFelix Fietkau2013-09-261-0/+11
* feeds: enable cloning of specific git commitLuka Perkov2013-09-251-2/+8
* scripts/feeds: ensure that --ff is enabledFlorian Fainelli2013-09-021-1/+1
* scripts/checkpatch.pl: Fix whitespace errorsVasilis Tsiligiannis2013-08-311-20/+20
* scripts/{cleanfile,cleanpatch}: Add scripts for cleaning up file and patch wh...Vasilis Tsiligiannis2013-08-312-0/+434
* scripts/checkpatch.pl: Remove checks for __setup's documentationVasilis Tsiligiannis2013-08-311-26/+0
* scripts/checkpatch.pl: Remove check for deprecated featuresVasilis Tsiligiannis2013-08-311-37/+0
* scripts/checkpatch.pl: Introduce 'checkpatch.pl' scriptVasilis Tsiligiannis2013-08-311-0/+3553
* build: process transitive dependencies after local dependenciesFelix Fietkau2013-08-041-1/+7
* build: suppress conditional dependencies if there are unconditional dependenc...Felix Fietkau2013-08-041-0/+1
* kernel: add a new global config symbol for enabling rfkill support (can be en...Felix Fietkau2013-07-211-0/+1
* scripts/metadata.pl: emit dependencies for package/kernel/linuxFelix Fietkau2013-07-191-1/+1
* scripts/gen-dependencies.sh: clean up temp filesFelix Fietkau2013-07-191-0/+1
* scripts: change metadata.pm and metadata.pl to not emit "default m if ALL" Kc...Jo-Philipp Wich2013-07-182-3/+7
* gen-dependencies.sh: sort kmod dependenciesFelix Fietkau2013-07-181-1/+1
* build: implement kernel module dependency trackingFelix Fietkau2013-07-181-0/+10
* metadata.pl: use alphabetical order for menuconfig categories, also fixes ran...Jo-Philipp Wich2013-07-161-1/+1
* remove broken mirrors for linux kernelMirko Vogt2013-07-141-4/+0
* scripts/download.pl: use HTTP instead of FTP for the default GNU siteFelix Fietkau2013-07-091-1/+1
* metadata.pl: fixpath exclusion of kernel packagesJohn Crispin2013-06-291-1/+1
* target: split jffs2 NAND out of jffs2Jonas Gorski2013-06-051-1/+2
* feeds: fix check for core packages that are not in the package/ toplevel dire...Jo-Philipp Wich2013-05-291-1/+10
* build: clean up stale files from a previous build when installing a package b...Felix Fietkau2013-05-291-0/+24
* scripts: dl_cleanup.py: properly detect file names with <date>-<githash> vers...Jo-Philipp Wich2013-05-261-1/+1
* build: add config symbols for different ARM arch levelsFelix Fietkau2013-05-131-0/+1
* scripts/remote-gdb: add support for debugging core filesFelix Fietkau2013-05-091-2/+4
* scripts/remote-gdb: fix path when built for muslFelix Fietkau2013-05-091-2/+2
* scripts/config: fix an option processing error that caused duplication in dif...Felix Fietkau2013-05-021-3/+3
* scripts/config: warn on deprected "depends" syntax instead of throwing a synt...Felix Fietkau2013-04-222-143/+158
* build: add new menuconfig code based on linux 3.9Felix Fietkau2013-04-1834-3797/+5722
* build: consistently use 'depends on' instead of 'depends'Felix Fietkau2013-04-171-7/+7
* buildroot: allow enabling MIPS16 user-space buildFlorian Fainelli2013-04-051-0/+1
* build: BSD compile fixesFelix Fietkau2013-03-072-0/+25
* scripts: update GNU mirrorsLuka Perkov2013-02-281-4/+1
* scripts/symlink-tree.sh: print warnings/errors to stderrJonas Gorski2013-02-211-3/+3
* scripts/ipkg: print warnings/errors to stderrJonas Gorski2013-02-211-16/+16
* buildroot: allow specifying libc personality for external toolchainsJo-Philipp Wich2013-02-201-0/+4
* Add xz compressed packages to known extensions of dl_cleanupGabor Juhos2013-02-171-1/+5
* scripts: bundle-libraries.sh: support mixing 32bit and 64bit binariesJo-Philipp Wich2013-01-281-6/+7
ody of request ~bq rex Expression in the body of response ~t rex Shortcut for content-type header. ~d rex Request domain ~m rex Method ~u rex URL ~c CODE Response code. rex Equivalent to ~u rex """ from __future__ import absolute_import import re import sys import pyparsing as pp class _Token: def dump(self, indent=0, fp=sys.stdout): print >> fp, "\t" * indent, self.__class__.__name__, if hasattr(self, "expr"): print >> fp, "(%s)" % self.expr, print >> fp class _Action(_Token): @classmethod def make(klass, s, loc, toks): return klass(*toks[1:]) class FErr(_Action): code = "e" help = "Match error" def __call__(self, f): return True if f.error else False class FReq(_Action): code = "q" help = "Match request with no response" def __call__(self, f): if not f.response: return True class FResp(_Action): code = "s" help = "Match response" def __call__(self, f): return True if f.response else False class _Rex(_Action): flags = 0 def __init__(self, expr): self.expr = expr try: self.re = re.compile(self.expr, self.flags) except: raise ValueError("Cannot compile expression.") def _check_content_type(expr, o): val = o.headers.get("content-type") if val and re.search(expr, val): return True return False class FAsset(_Action): code = "a" help = "Match asset in response: CSS, Javascript, Flash, images." ASSET_TYPES = [ "text/javascript", "application/x-javascript", "application/javascript", "text/css", "image/.*", "application/x-shockwave-flash" ] def __call__(self, f): if f.response: for i in self.ASSET_TYPES: if _check_content_type(i, f.response): return True return False class FContentType(_Rex): code = "t" help = "Content-type header" def __call__(self, f): if _check_content_type(self.expr, f.request): return True elif f.response and _check_content_type(self.expr, f.response): return True return False class FRequestContentType(_Rex): code = "tq" help = "Request Content-Type header" def __call__(self, f): return _check_content_type(self.expr, f.request) class FResponseContentType(_Rex): code = "ts" help = "Response Content-Type header" def __call__(self, f): if f.response: return _check_content_type(self.expr, f.response) return False class FHead(_Rex): code = "h" help = "Header" flags = re.MULTILINE def __call__(self, f): if f.request and self.re.search(str(f.request.headers)): return True if f.response and self.re.search(str(f.response.headers)): return True return False class FHeadRequest(_Rex): code = "hq" help = "Request header" flags = re.MULTILINE def __call__(self, f): if f.request and self.re.search(str(f.request.headers)): return True class FHeadResponse(_Rex): code = "hs" help = "Response header" flags = re.MULTILINE def __call__(self, f): if f.response and self.re.search(str(f.response.headers)): return True class FBod(_Rex): code = "b" help = "Body" def __call__(self, f): if f.request and f.request.content: if self.re.search(f.request.get_decoded_content()): return True if f.response and f.response.content: if self.re.search(f.response.get_decoded_content()): return True return False class FBodRequest(_Rex): code = "bq" help = "Request body" def __call__(self, f): if f.request and f.request.content: if self.re.search(f.request.get_decoded_content()): return True class FBodResponse(_Rex): code = "bs" help = "Response body" def __call__(self, f): if f.response and f.response.content: if self.re.search(f.response.get_decoded_content()): return True class FMethod(_Rex): code = "m" help = "Method" flags = re.IGNORECASE def __call__(self, f): return bool(self.re.search(f.request.method)) class FDomain(_Rex): code = "d" help = "Domain" flags = re.IGNORECASE def __call__(self, f): return bool(self.re.search(f.request.host)) class FUrl(_Rex): code = "u" help = "URL" # FUrl is special, because it can be "naked". @classmethod def make(klass, s, loc, toks): if len(toks) > 1: toks = toks[1:] return klass(*toks) def __call__(self, f): return self.re.search(f.request.url) class FSrc(_Rex): code = "src" help = "Match source address" def __call__(self, f): return f.client_conn.address and self.re.search(repr(f.client_conn.address)) class FDst(_Rex): code = "dst" help = "Match destination address" def __call__(self, f): return f.server_conn.address and self.re.search(repr(f.server_conn.address)) class _Int(_Action): def __init__(self, num): self.num = int(num) class FCode(_Int): code = "c" help = "HTTP response code" def __call__(self, f): if f.response and f.response.status_code == self.num: return True class FAnd(_Token): def __init__(self, lst): self.lst = lst def dump(self, indent=0, fp=sys.stdout): print >> fp, "\t" * indent, self.__class__.__name__ for i in self.lst: i.dump(indent + 1, fp) def __call__(self, f): return all(i(f) for i in self.lst) class FOr(_Token): def __init__(self, lst): self.lst = lst def dump(self, indent=0, fp=sys.stdout): print >> fp, "\t" * indent, self.__class__.__name__ for i in self.lst: i.dump(indent + 1, fp) def __call__(self, f): return any(i(f) for i in self.lst) class FNot(_Token): def __init__(self, itm): self.itm = itm[0] def dump(self, indent=0, fp=sys.stdout): print >> fp, "\t" * indent, self.__class__.__name__ self.itm.dump(indent + 1, fp) def __call__(self, f): return not self.itm(f) filt_unary = [ FReq, FResp, FAsset, FErr ] filt_rex = [ FHeadRequest, FHeadResponse, FHead, FBodRequest, FBodResponse, FBod, FMethod, FDomain, FUrl, FRequestContentType, FResponseContentType, FContentType, FSrc, FDst, ] filt_int = [ FCode ] def _make(): # Order is important - multi-char expressions need to come before narrow # ones. parts = [] for klass in filt_unary: f = pp.Literal("~%s" % klass.code) + pp.WordEnd() f.setParseAction(klass.make) parts.append(f) simplerex = "".join(c for c in pp.printables if c not in "()~'\"") rex = pp.Word(simplerex) |\ pp.QuotedString("\"", escChar='\\') |\ pp.QuotedString("'", escChar='\\') for klass in filt_rex: f = pp.Literal("~%s" % klass.code) + pp.WordEnd() + rex.copy() f.setParseAction(klass.make) parts.append(f) for klass in filt_int: f = pp.Literal("~%s" % klass.code) + pp.WordEnd() + pp.Word(pp.nums) f.setParseAction(klass.make) parts.append(f) # A naked rex is a URL rex: f = rex.copy() f.setParseAction(FUrl.make) parts.append(f) atom = pp.MatchFirst(parts) expr = pp.operatorPrecedence(atom, [(pp.Literal("!").suppress(), 1, pp.opAssoc.RIGHT, lambda x: FNot(*x)), (pp.Literal("&").suppress(), 2, pp.opAssoc.LEFT, lambda x: FAnd(*x)), (pp.Literal("|").suppress(), 2, pp.opAssoc.LEFT, lambda x: FOr(*x)), ]) expr = pp.OneOrMore(expr) return expr.setParseAction(lambda x: FAnd(x) if len(x) != 1 else x) bnf = _make() def parse(s): try: filt = bnf.parseString(s, parseAll=True)[0] filt.pattern = s return filt except pp.ParseException: return None except ValueError: return None help = [] for i in filt_unary: help.append( ("~%s" % i.code, i.help) ) for i in filt_rex: help.append( ("~%s regex" % i.code, i.help) ) for i in filt_int: help.append( ("~%s int" % i.code, i.help) ) help.sort() help.extend( [ ("!", "unary not"), ("&", "and"), ("|", "or"), ("(...)", "grouping"), ] )