improves on the nfregex binary x3
This commit is contained in:
@@ -88,7 +88,7 @@ def checkRegex(regex, should_work=True, upper=False):
|
||||
if r["regex"] == regex:
|
||||
#Test the regex
|
||||
s = base64.b64decode(regex).upper() if upper else base64.b64decode(regex)
|
||||
if not server.sendCheckData(secrets.token_bytes(200) + s + secrets.token_bytes(200)):
|
||||
if not server.sendCheckData(secrets.token_bytes(40) + s + secrets.token_bytes(40)):
|
||||
puts("The malicious request was successfully blocked ✔", color=colors.green)
|
||||
n_blocked += 1
|
||||
time.sleep(1)
|
||||
@@ -104,7 +104,7 @@ def checkRegex(regex, should_work=True, upper=False):
|
||||
puts("Test Failed: The regex wasn't found ✗", color=colors.red)
|
||||
exit_test(1)
|
||||
else:
|
||||
if server.sendCheckData(secrets.token_bytes(200) + base64.b64decode(regex) + secrets.token_bytes(200)):
|
||||
if server.sendCheckData(secrets.token_bytes(40) + base64.b64decode(regex) + secrets.token_bytes(40)):
|
||||
puts("The request wasn't blocked ✔", color=colors.green)
|
||||
else:
|
||||
puts("Test Failed: The request was blocked when it shouldn't have", color=colors.red)
|
||||
@@ -186,18 +186,6 @@ checkRegex(regex)
|
||||
|
||||
clear_regexes()
|
||||
|
||||
#Create Server regex and verify that should not matches
|
||||
if(firegex.nf_add_regex(service_id,regex,"S",active=True, is_case_sensitive=True)):
|
||||
puts(f"Sucessfully added server to client regex {str(secret)} ✔", color=colors.green)
|
||||
else:
|
||||
puts(f"Test Failed: Coulnd't add server to client regex {str(secret)} ✗", color=colors.red)
|
||||
exit_test(1)
|
||||
|
||||
checkRegex(regex, should_work=False)
|
||||
|
||||
#Delete regex
|
||||
clear_regexes()
|
||||
|
||||
#Rename service
|
||||
if(firegex.nf_rename_service(service_id,f"{args.service_name}2")):
|
||||
puts(f"Sucessfully renamed service to {args.service_name}2 ✔", color=colors.green)
|
||||
|
||||
@@ -9,23 +9,23 @@ ERROR=0
|
||||
pip3 install -r requirements.txt
|
||||
|
||||
echo "Running standard API test"
|
||||
#python3 api_test.py -p $PASSWORD || ERROR=1
|
||||
python3 api_test.py -p $PASSWORD || ERROR=1
|
||||
echo "Running Netfilter Regex TCP ipv4"
|
||||
python3 nf_test.py -p $PASSWORD -m tcp || ERROR=1
|
||||
echo "Running Netfilter Regex TCP ipv6"
|
||||
#python3 nf_test.py -p $PASSWORD -m tcp -6 || ERROR=1
|
||||
python3 nf_test.py -p $PASSWORD -m tcp -6 || ERROR=1
|
||||
echo "Running Netfilter Regex UDP ipv4"
|
||||
#python3 nf_test.py -p $PASSWORD -m udp || ERROR=1
|
||||
python3 nf_test.py -p $PASSWORD -m udp || ERROR=1
|
||||
echo "Running Netfilter Regex UDP ipv6"
|
||||
#python3 nf_test.py -p $PASSWORD -m udp -6 || ERROR=1
|
||||
python3 nf_test.py -p $PASSWORD -m udp -6 || ERROR=1
|
||||
echo "Running Port Hijack TCP ipv4"
|
||||
#python3 ph_test.py -p $PASSWORD -m tcp || ERROR=1
|
||||
python3 ph_test.py -p $PASSWORD -m tcp || ERROR=1
|
||||
echo "Running Port Hijack TCP ipv6"
|
||||
#python3 ph_test.py -p $PASSWORD -m tcp -6 || ERROR=1
|
||||
python3 ph_test.py -p $PASSWORD -m tcp -6 || ERROR=1
|
||||
echo "Running Port Hijack UDP ipv4"
|
||||
#python3 ph_test.py -p $PASSWORD -m udp || ERROR=1
|
||||
python3 ph_test.py -p $PASSWORD -m udp || ERROR=1
|
||||
echo "Running Port Hijack UDP ipv6"
|
||||
#python3 ph_test.py -p $PASSWORD -m udp -6 || ERROR=1
|
||||
python3 ph_test.py -p $PASSWORD -m udp -6 || ERROR=1
|
||||
|
||||
exit $ERROR
|
||||
|
||||
|
||||
Reference in New Issue
Block a user