Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8fb1f33
Replaced GPL dependencies with permissive alternatives.
Oct 10, 2025
4e94c0d
Ran Pre-Commit Hooks
Oct 10, 2025
a6335b2
Removed Unnecessary Encoding Declaration
Oct 11, 2025
cd97d9e
Merge branch 'main' of https://github.com/Azure/PyRIT into feat/repla…
Oct 11, 2025
55bb556
Hardcoded list of country names to avoid external dependency
Oct 11, 2025
e0cd883
Merge branch 'main' of https://github.com/Azure/PyRIT into feat/repla…
Oct 13, 2025
10790d7
Use blocking input() for manual prompt; remove questionary
Oct 13, 2025
855d72a
[BREAKING] FEAT: Enable Entra ID Authentication across the codebase (…
jsong468 Oct 14, 2025
313b8f6
MAINT: Cache Azure ML/Foundry token in integration test (#1132)
jsong468 Oct 14, 2025
d32b2ed
Replace external krippendorff with internal implementation
Oct 15, 2025
a41231a
Updated pyproject.toml, typing/flake8 fixes
Oct 15, 2025
2485e9a
Merge branch 'main' into feat/replace_gpl_libraries
romanlutz Oct 15, 2025
b206daf
Remove fpdf from unit test; Add reportlab
Oct 15, 2025
82bb0f9
Merge branch 'main' of https://github.com/Azure/PyRIT into feat/repla…
Oct 15, 2025
926dd2a
Merge branch 'feat/replace_gpl_libraries' of https://github.com/0xFir…
Oct 15, 2025
04b629c
Refactored Krippendorff's alpha implementation according to pyrits scope
Oct 21, 2025
386afdb
Merge branch 'main' of https://github.com/Azure/PyRIT into feat/repla…
Oct 21, 2025
f17480c
break up function into smaller pieces, rename function
romanlutz Oct 27, 2025
e64611a
tests for Krippendorff's alpha calculation
romanlutz Oct 27, 2025
656fc49
Merge branch 'main' into feat/replace_gpl_libraries
romanlutz Oct 27, 2025
af965d1
update docstring to credit simpledorff for implementation inspiration
Oct 27, 2025
fac5570
pre-commit, ran pdf converter notebook
romanlutz Oct 27, 2025
ac2cb02
Merge branch 'feat/replace_gpl_libraries' of https://github.com/0xFir…
romanlutz Oct 27, 2025
ea4d0c3
nbstripout
romanlutz Oct 27, 2025
88bdfd8
Merge branch 'main' of https://github.com/Azure/PyRIT into feat/repla…
romanlutz Oct 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 229 additions & 7 deletions pyrit/datasets/seclists_bias_testing_dataset.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# -*- coding: utf-8 -*-
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

import random
from pathlib import Path
from typing import Literal, Optional

import pycountry
# import pycountry
from iso3166 import countries

from pyrit.datasets.dataset_helper import FILE_TYPE_HANDLERS, fetch_examples
from pyrit.models import SeedPromptDataset
Expand Down Expand Up @@ -58,15 +60,235 @@ def fetch_seclists_bias_testing_dataset(
# Fetch the examples using the provided `fetch_examples` function
examples = fetch_examples(source, source_type, cache, data_home)

# Define placeholder values generation functions using pycountry and random.choice
countries = list(pycountry.countries)
subdivisions = list(pycountry.subdivisions)
# NEW:
# Build country names list from iso3166
country_names = [c.name for c in countries]

# Build subdivisions list from all countries that have subdivisions

subdivision_names = [
"California",
"Texas",
"New York",
"Florida",
"Illinois",
"Pennsylvania",
"Ohio",
"Georgia",
"North Carolina",
"Michigan",
"New Jersey",
"Virginia",
"Washington",
"Arizona",
"Massachusetts",
"Tennessee",
"Indiana",
"Missouri",
"Maryland",
"Wisconsin",
"Colorado",
"Minnesota",
"South Carolina",
"Alabama",
"Louisiana",
"Kentucky",
"Oregon",
"Oklahoma",
"Connecticut",
"Utah",
"Iowa",
"Nevada",
"Arkansas",
"Mississippi",
"Kansas",
"New Mexico",
"Nebraska",
"West Virginia",
"Idaho",
"Hawaii",
"New Hampshire",
"Maine",
"Montana",
"Rhode Island",
"Delaware",
"South Dakota",
"North Dakota",
"Alaska",
"Vermont",
"Wyoming",
"Ontario",
"Quebec",
"British Columbia",
"Alberta",
"Manitoba",
"Saskatchewan",
"Nova Scotia",
"New Brunswick",
"Newfoundland and Labrador",
"Prince Edward Island",
"Northwest Territories",
"Yukon",
"Nunavut",
"England",
"Scotland",
"Wales",
"Northern Ireland",
"Greater London",
"Bavaria",
"Baden-Wurttemberg",
"Berlin",
"Brandenburg",
"Bremen",
"Hamburg",
"Hesse",
"Lower Saxony",
"North Rhine-Westphalia",
"Rhineland-Palatinate",
"Saarland",
"Saxony",
"Saxony-Anhalt",
"Schleswig-Holstein",
"Thuringia",
"Ile-de-France",
"Provence-Alpes-Cote d'Azur",
"Auvergne-Rhone-Alpes",
"Nouvelle-Aquitaine",
"Occitanie",
"Grand Est",
"Hauts-de-France",
"Normandie",
"Bretagne",
"Centre-Val de Loire",
"Bourgogne-Franche-Comte",
"Pays de la Loire",
"Corse",
"New South Wales",
"Victoria",
"Queensland",
"Western Australia",
"South Australia",
"Tasmania",
"Australian Capital Territory",
"Northern Territory",
"Tokyo",
"Osaka",
"Kanagawa",
"Aichi",
"Saitama",
"Chiba",
"Hyogo",
"Hokkaido",
"Fukuoka",
"Kyoto",
"Shizuoka",
"Hiroshima",
"Ibaraki",
"Sao Paulo",
"Rio de Janeiro",
"Minas Gerais",
"Bahia",
"Rio Grande do Sul",
"Parana",
"Pernambuco",
"Ceara",
"Para",
"Santa Catarina",
"Goias",
"Maranhao",
"Paraiba",
"Espirito Santo",
"Mato Grosso",
"Amazonas",
"Maharashtra",
"Uttar Pradesh",
"Tamil Nadu",
"West Bengal",
"Karnataka",
"Gujarat",
"Rajasthan",
"Andhra Pradesh",
"Madhya Pradesh",
"Kerala",
"Delhi",
"Bihar",
"Telangana",
"Odisha",
"Assam",
"Punjab",
"Haryana",
"Beijing",
"Shanghai",
"Guangdong",
"Jiangsu",
"Zhejiang",
"Shandong",
"Henan",
"Sichuan",
"Hubei",
"Hunan",
"Hebei",
"Fujian",
"Anhui",
"Liaoning",
"Shaanxi",
"Jiangxi",
"Heilongjiang",
"Guangxi",
"Yunnan",
"Moscow",
"Saint Petersburg",
"Sverdlovsk Oblast",
"Novosibirsk Oblast",
"Republic of Tatarstan",
"Nizhny Novgorod Oblast",
"Chelyabinsk Oblast",
"Samara Oblast",
"Rostov Oblast",
"Republic of Bashkortostan",
"Krasnoyarsk Krai",
"Lombardy",
"Lazio",
"Campania",
"Sicily",
"Veneto",
"Emilia-Romagna",
"Piedmont",
"Apulia",
"Tuscany",
"Calabria",
"Sardinia",
"Liguria",
"Madrid",
"Catalonia",
"Andalusia",
"Valencia",
"Galicia",
"Castile and Leon",
"Basque Country",
"Castilla-La Mancha",
"Canary Islands",
"Murcia",
]

# Helper classes to maintain compatibility with the existing lambda functions
class CountryCompat:
def __init__(self, name):
self.name = name

class SubdivisionCompat:
def __init__(self, name):
self.name = name

# Create compatibility objects
countries_compat = [CountryCompat(name) for name in country_names]
subdivisions_compat = [SubdivisionCompat(name) for name in subdivision_names]

placeholder_values = {
"Country": lambda: country if country else random.choice(countries).name,
"Region": lambda: region if region else random.choice(subdivisions).name,
"Country": lambda: country if country else random.choice(countries_compat).name,
"Region": lambda: region if region else random.choice(subdivisions_compat).name,
"Nationality": lambda: (
nationality if nationality else random.choice(countries).name
nationality if nationality else random.choice(countries_compat).name
), # Same as Country, the target LLM should be able to understand the context
"GENDER": lambda: gender if gender else random.choice(["male", "female", "non-binary"]),
"SKIN_COLOR": lambda: skin_color if skin_color else random.choice(["white", "black", "brown", "yellow"]),
Expand Down
6 changes: 4 additions & 2 deletions pyrit/executor/workflow/xpia.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from enum import Enum
from typing import Dict, Optional, Protocol, overload

from aioconsole import ainput
# from aioconsole import ainput
import questionary

from pyrit.common.utils import combine_dict, get_kwarg_param
from pyrit.executor.core import StrategyConverterConfig
Expand Down Expand Up @@ -622,7 +623,8 @@ async def _setup_async(self, *, context: XPIAContext) -> None:

# Create the manual input callback
async def manual_input_async() -> str:
return await ainput("Please trigger the processing target's execution and paste the output here: ")
prompt = "Please trigger the processing target's execution and paste the output here:"
return await questionary.text(prompt).ask_async() # type: ignore

# Set the processing callback on the context
context.processing_callback = manual_input_async
Expand Down
Loading