summaryrefslogtreecommitdiffstats
path: root/tools/sploit/sploit/until.py
blob: b4f390fc7aaa6a2f5c0b22cc26a503431f4d4874 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from functools import partial as bind
import re

def lastline(pred, /, *args, **kwargs):
    s = args[-1]
    args = args[:-1]
    p = bind(pred, *args, **kwargs)
    return p(s[-1])

def contains(regex, s):
    return re.search(regex, s)

def equals(regex, s):
    return re.fullmatch(regex, s)