pushed edits
This commit is contained in:
@@ -98,7 +98,7 @@ print(f"{results[0]} MB/s")
|
||||
#Add all the regexs
|
||||
for i in range(1,args.num_of_regexes+1):
|
||||
regex = base64.b64encode(bytes(secrets.token_hex(16).encode())).decode()
|
||||
if not firegex.nf_add_regex(service_id,regex,"B",active=True,is_blacklist=True,is_case_sensitive=False):
|
||||
if not firegex.nf_add_regex(service_id,regex,"B",active=True,is_case_sensitive=False):
|
||||
puts("Benchmark Failed: Coulnd't add the regex ✗", color=colors.red)
|
||||
exit_test(1)
|
||||
puts(f"Performance with {i} regex(s): ", color=colors.red, end='')
|
||||
|
||||
@@ -67,7 +67,7 @@ else:
|
||||
#Add new regex
|
||||
secret = bytes(secrets.token_hex(16).encode())
|
||||
regex = base64.b64encode(secret).decode()
|
||||
if firegex.nf_add_regex(service_id,regex,"B",active=True,is_blacklist=True,is_case_sensitive=True):
|
||||
if firegex.nf_add_regex(service_id,regex,"B",active=True,is_case_sensitive=True):
|
||||
puts(f"Sucessfully added regex {str(secret)} ✔", color=colors.green)
|
||||
else:
|
||||
puts("Test Failed: Coulnd't add the regex {str(secret)} ✗", color=colors.red)
|
||||
@@ -166,7 +166,7 @@ for r in firegex.nf_get_service_regexes(service_id):
|
||||
checkRegex(regex,should_work=False)
|
||||
|
||||
#Add case insensitive regex
|
||||
if(firegex.nf_add_regex(service_id,regex,"B",active=True,is_blacklist=True,is_case_sensitive=False)):
|
||||
if(firegex.nf_add_regex(service_id,regex,"B",active=True, is_case_sensitive=False)):
|
||||
puts(f"Sucessfully added case insensitive regex {str(secret)} ✔", color=colors.green)
|
||||
else:
|
||||
puts(f"Test Failed: Coulnd't add the case insensitive regex {str(secret)} ✗", color=colors.red)
|
||||
|
||||
@@ -121,9 +121,9 @@ class FiregexAPI:
|
||||
req = self.s.get(f"{self.address}api/nfregex/regex/{regex_id}/disable")
|
||||
return verify(req)
|
||||
|
||||
def nf_add_regex(self, service_id: str, regex: str, mode: str, active: bool, is_blacklist: bool, is_case_sensitive: bool):
|
||||
def nf_add_regex(self, service_id: str, regex: str, mode: str, active: bool, is_case_sensitive: bool):
|
||||
req = self.s.post(f"{self.address}api/nfregex/regexes/add",
|
||||
json={"service_id": service_id, "regex": regex, "mode": mode, "active": active, "is_blacklist": is_blacklist, "is_case_sensitive": is_case_sensitive})
|
||||
json={"service_id": service_id, "regex": regex, "mode": mode, "active": active, "is_case_sensitive": is_case_sensitive})
|
||||
return verify(req)
|
||||
|
||||
def nf_add_service(self, name: str, port: int, proto: str, ip_int: str):
|
||||
|
||||
Reference in New Issue
Block a user