fix: fix some error
This commit is contained in:
@@ -25,7 +25,7 @@ def clone_repo(repo_url: str, clone_dir: str) -> None:
|
||||
|
||||
|
||||
def inject_random_backdoor(
|
||||
path: str, pickle: bool = False, pyc: bool = False, sample_rate: float = 0.1
|
||||
path: str, sample_rate: float = 0.1
|
||||
) -> Tuple[Tuple[str, int], ...]:
|
||||
"""
|
||||
Insert random backdoor into the path.
|
||||
@@ -35,11 +35,6 @@ def inject_random_backdoor(
|
||||
pickle (bool): Whether to insert a backdoor into a pickle file.
|
||||
pyc (bool): Whether to insert a backdoor into a compiled Python file.
|
||||
"""
|
||||
if pickle:
|
||||
inject_pickle_backdoor(path)
|
||||
if pyc:
|
||||
inject_pyc_backdoor(path)
|
||||
|
||||
project_path = Path(path)
|
||||
all_python_files = list(project_path.rglob("*.py"))
|
||||
injected_python_files = []
|
||||
@@ -187,4 +182,5 @@ if __name__ == "__main__":
|
||||
repo_url = "https://github.com/TheAlgorithms/Python.git"
|
||||
clone_dir = "/tmp/repo"
|
||||
clone_repo(repo_url, clone_dir)
|
||||
inject_random_backdoor(clone_dir, pickle=True, pyc=True)
|
||||
inject_random_backdoor(clone_dir)
|
||||
inject_pickle_backdoor(clone_dir)
|
||||
|
||||
Reference in New Issue
Block a user