text
stringlengths
1
93.6k
lhs=[Fact(polarity="+", predicate="green", arguments=["X"])],
rhs=Fact(polarity="+", predicate="big", arguments=["X"]),
prob=1.0,
)
]
theory = Theory(facts=[fact1, fact2, fact3], rules=rules)
assertion = Fact(polarity="+", predicate="big", arguments=["'Erin'"])
theory_assertion_instance = TheoryAssertionInstance(theory, assertion, True)
logical_forms = TheoryAssertionRepresentation(
theory_assertion_instance.theory.statements_as_texts,
str(theory_assertion_instance.assertion),
)
fact_nls = [f.nl() for f in theory_assertion_instance.theory.facts]
rule_nls = [r.nl() for r in theory_assertion_instance.theory.rules]
assertion_nl = theory_assertion_instance.assertion.nl()
english = TheoryAssertionRepresentation(fact_nls + rule_nls, assertion_nl)
logic_program = dict()
for theorem_prover in supported_theorem_provers:
fact_lfs = []
rule_lfs = []
for fact in theory_assertion_instance.theory.facts:
fact_lf = fact.logical_form(theorem_prover)
fact_lfs.append(fact_lf)
for rule in theory_assertion_instance.theory.rules:
rule_lf = rule.logical_form(theorem_prover)
rule_lfs.append(rule_lf)
assertion_lf = theory_assertion_instance.assertion.logical_form(
theorem_prover, is_assertion=True
)
logic_program[theorem_prover] = TheoryAssertionRepresentation(
fact_lfs + rule_lfs, assertion_lf
)
return Example(
str(1),
theory_assertion_instance=theory_assertion_instance,
logical_forms=logical_forms,
english=english,
logic_program=logic_program,
)
# class RuletakerTestClass:
# def __init__(self):
example_obj = create_example_object()
def test_deserialization():
json = example_obj.to_json()
deserialized_obj = Example.from_json(json)
assert example_obj == deserialized_obj
def test_label_generation_from_theorem_provers():
theory_assertion_instance = example_obj.theory_assertion_instance
for theorem_prover in supported_theorem_provers:
label, _, _ = call_theorem_prover(
theorem_prover,
1,
1,
theory_assertion_instance.theory,
theory_assertion_instance.assertion,
theory_assertion_instance.label,
)
assert label == theory_assertion_instance.label
# <FILESEP>
import os
import time
import logging
# Suppress debug logs from Pillow (PIL)
logging.getLogger("PIL").setLevel(logging.WARNING)
from wifi.wifi_manager import WiFiManager
from utils.logger import Logger
from scans.nmap_scanner import run_nmap_scan
from utils.html_logger import HTMLLogger
from attacks.recon import Recon
from attacks.vulnerability_scan import VulnerabilityScanner
from attacks.exploit_tester import ExploitTester
from attacks.file_stealer import FileStealer
from utils.display import EPaperDisplay
from utils.image_state_manager import ImageStateManager
import subprocess
def load_ssh_credentials():
"""
Load SSH credentials from predefined paths in the project directory.
Searches in the following order:
- /home/pi/xeno/config/ssh_default_credentials.txt
- /root/ssh_default_credentials.txt
Returns:
list: A list of dictionaries with SSH credentials, where each dictionary contains:
- username (str): The username for SSH login.
- password (str): The password for SSH login.
Raises:
Exception: If the file cannot be read or is improperly formatted.
"""