diff --git a/.github/workflows/translate_af.yml b/.github/workflows/translate_af.yml deleted file mode 100644 index 804afe44d..000000000 --- a/.github/workflows/translate_af.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to AF (Afrikaans) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: af - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Afrikaans - BRANCH: af - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_de.yml b/.github/workflows/translate_de.yml deleted file mode 100644 index 2f83fefa1..000000000 --- a/.github/workflows/translate_de.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to DE (German) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: de - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: German - BRANCH: de - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_el.yml b/.github/workflows/translate_el.yml deleted file mode 100644 index 8857a75b9..000000000 --- a/.github/workflows/translate_el.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to EL (Greek) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: el - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Greek - BRANCH: el - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_es.yml b/.github/workflows/translate_es.yml deleted file mode 100644 index 8322446a9..000000000 --- a/.github/workflows/translate_es.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to ES (Spanish) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: es - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Spanish - BRANCH: es - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_fr.yml b/.github/workflows/translate_fr.yml deleted file mode 100644 index 046fe3b20..000000000 --- a/.github/workflows/translate_fr.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to FR (French) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: fr - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: French - BRANCH: fr - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_it.yml b/.github/workflows/translate_it.yml deleted file mode 100644 index b5b4ec27c..000000000 --- a/.github/workflows/translate_it.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to IT (Italian) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: it - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Italian - BRANCH: it - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_ja.yml b/.github/workflows/translate_ja.yml deleted file mode 100644 index 9c635e1da..000000000 --- a/.github/workflows/translate_ja.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to JA (Japanese) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: ja - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Japanese - BRANCH: ja - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_ko.yml b/.github/workflows/translate_ko.yml deleted file mode 100644 index d39c84266..000000000 --- a/.github/workflows/translate_ko.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to KO (Korean) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: ko - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Korean - BRANCH: ko - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_pl.yml b/.github/workflows/translate_pl.yml deleted file mode 100644 index 0dd53dd0c..000000000 --- a/.github/workflows/translate_pl.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to PL (Polish) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: pl - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Polish - BRANCH: pl - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_pt.yml b/.github/workflows/translate_pt.yml deleted file mode 100644 index e8842d728..000000000 --- a/.github/workflows/translate_pt.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to PT (Portuguese) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: pt - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Portuguese - BRANCH: pt - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_sr.yml b/.github/workflows/translate_sr.yml deleted file mode 100644 index 4f80bc8d3..000000000 --- a/.github/workflows/translate_sr.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to SR (Serbian) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: sr - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Serbian - BRANCH: sr - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_sw.yml b/.github/workflows/translate_sw.yml deleted file mode 100644 index 4c63a2558..000000000 --- a/.github/workflows/translate_sw.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to SW (Swahili) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: sw - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Swahili - BRANCH: sw - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_tr.yml b/.github/workflows/translate_tr.yml deleted file mode 100644 index 13571575b..000000000 --- a/.github/workflows/translate_tr.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to TR (Turkish) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: tr - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Turkish - BRANCH: tr - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/.github/workflows/translate_uk.yml b/.github/workflows/translate_uk.yml deleted file mode 100644 index 4991a185c..000000000 --- a/.github/workflows/translate_uk.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to UK (Ukranian) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: uk - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Ukranian - BRANCH: uk - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete diff --git a/.github/workflows/translate_zh.yml b/.github/workflows/translate_zh.yml deleted file mode 100644 index ed59a8d34..000000000 --- a/.github/workflows/translate_zh.yml +++ /dev/null @@ -1,119 +0,0 @@ -name: Translator to ZH (Chinese) - -on: - push: - branches: - - master - paths-ignore: - - 'scripts/**' - - '.gitignore' - - '.github/**' - workflow_dispatch: - -concurrency: zh - -permissions: - id-token: write - contents: write - -jobs: - run-translation: - runs-on: ubuntu-latest - environment: prod - env: - LANGUAGE: Chinese - BRANCH: zh - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 #Needed to download everything to be able to access the master & language branches - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.12 - - - name: Install python dependencies - run: | - python -m pip install --upgrade pip - pip3 install openai tqdm tiktoken - - # Install Rust and Cargo - - name: Install Rust and Cargo - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - - # Install mdBook and Plugins - - name: Install mdBook and Plugins - run: | - cargo install mdbook - cargo install mdbook-alerts - cargo install mdbook-reading-time - cargo install mdbook-pagetoc - cargo install mdbook-tabs - cargo install mdbook-codename - - - - name: Update & install wget & translator.py - run: | - sudo apt-get update - sudo apt-get install wget -y - mkdir scripts - cd scripts - wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py - cd .. - - - name: Download language branch #Make sure we have last version - run: | - git config --global user.name 'Translator' - git config --global user.email 'github-actions@github.com' - git checkout "$BRANCH" - git pull - git checkout master - - - name: Run translation script on changed files - run: | - echo "Starting translations" - echo "Commit: $GITHUB_SHA" - - # Export the OpenAI API key as an environment variable - export OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - - # Run the translation script on each changed file - git diff --name-only HEAD~1 | grep -v "SUMMARY.md" | while read -r file; do - if echo "$file" | grep -qE '\.md$'; then - echo -n "$file , " >> /tmp/file_paths.txt - else - echo "Skipping $file" - fi - done - - echo "Translating $(cat /tmp/file_paths.txt)" - python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - # Push changes to the repository - - name: Commit and push changes - run: | - git checkout "$BRANCH" - git add -A - git commit -m "Translated $BRANCH files" || true - git push --set-upstream origin "$BRANCH" - - # Build the mdBook - - name: Build mdBook - run: mdbook build - - # Login in AWs - - name: Configure AWS credentials using OIDC - uses: aws-actions/configure-aws-credentials@v3 - with: - role-to-assume: ${{ secrets.AWS_ROLE_ARN }} - aws-region: us-east-1 - - # Sync the build to S3 - - name: Sync to S3 - run: aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete \ No newline at end of file diff --git a/src/macos-hardening/macos-red-teaming/macos-mdm/README.md b/src/macos-hardening/macos-red-teaming/macos-mdm/README.md index 25ce912c9..c7555058c 100644 --- a/src/macos-hardening/macos-red-teaming/macos-mdm/README.md +++ b/src/macos-hardening/macos-red-teaming/macos-mdm/README.md @@ -11,7 +11,7 @@ ### **Przegląd MDM (Zarządzanie Urządzeniami Mobilnymi)** -[Zarządzanie Urządzeniami Mobilnymi](https://en.wikipedia.org/wiki/Mobile_device_management) (MDM) jest wykorzystywane do nadzorowania różnych urządzeń końcowych, takich jak smartfony, laptopy i tablety. Szczególnie dla platform Apple (iOS, macOS, tvOS) obejmuje zestaw specjalistycznych funkcji, interfejsów API i praktyk. Działanie MDM opiera się na kompatybilnym serwerze MDM, który jest dostępny komercyjnie lub jako open-source, i musi wspierać [Protokół MDM](https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf). Kluczowe punkty obejmują: +[Zarządzanie Urządzeniami Mobilnymi](https://en.wikipedia.org/wiki/Mobile_device_management) (MDM) jest wykorzystywane do nadzorowania różnych urządzeń końcowych, takich jak smartfony, laptopy i tablety. Szczególnie dla platform Apple (iOS, macOS, tvOS) obejmuje zestaw specjalistycznych funkcji, interfejsów API i praktyk. Działanie MDM opiera się na kompatybilnym serwerze MDM, który jest dostępny komercyjnie lub jako open-source i musi wspierać [Protokół MDM](https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf). Kluczowe punkty obejmują: - Centralne zarządzanie urządzeniami. - Zależność od serwera MDM, który przestrzega protokołu MDM. @@ -21,7 +21,7 @@ [Program Rejestracji Urządzeń](https://www.apple.com/business/site/docs/DEP_Guide.pdf) (DEP) oferowany przez Apple upraszcza integrację Zarządzania Urządzeniami Mobilnymi (MDM) poprzez umożliwienie konfiguracji bezdotykowej dla urządzeń iOS, macOS i tvOS. DEP automatyzuje proces rejestracji, pozwalając urządzeniom na działanie od razu po wyjęciu z pudełka, z minimalną interwencją użytkownika lub administratora. Kluczowe aspekty obejmują: -- Umożliwia urządzeniom autonomiczne rejestrowanie się na wcześniej zdefiniowanym serwerze MDM po pierwszej aktywacji. +- Umożliwia urządzeniom autonomiczne rejestrowanie się z wcześniej zdefiniowanym serwerem MDM po pierwszej aktywacji. - Głównie korzystne dla nowych urządzeń, ale również stosowane dla urządzeń poddawanych rekonfiguracji. - Ułatwia prostą konfigurację, szybko przygotowując urządzenia do użytku w organizacji. @@ -37,12 +37,12 @@ Ważne jest, aby zauważyć, że łatwość rejestracji zapewniana przez DEP, ch - Stosunkowo stary protokół, stworzony przed powszechnym wprowadzeniem TLS i HTTPS. - Daje klientom ustandaryzowany sposób wysyłania **Żądania Podpisania Certyfikatu** (CSR) w celu uzyskania certyfikatu. Klient poprosi serwer o wydanie podpisanego certyfikatu. -### Czym są Profile Konfiguracji (znane również jako mobileconfigs)? +### Czym są Profile Konfiguracji (aka mobileconfigs)? - Oficjalny sposób Apple na **ustawianie/egzekwowanie konfiguracji systemu.** - Format pliku, który może zawierać wiele ładunków. - Oparty na listach właściwości (w rodzaju XML). -- „może być podpisany i zaszyfrowany, aby zweryfikować ich pochodzenie, zapewnić integralność i chronić ich zawartość.” Podstawy — Strona 70, Przewodnik po Bezpieczeństwie iOS, styczeń 2018. +- „może być podpisany i zaszyfrowany, aby zweryfikować ich pochodzenie, zapewnić ich integralność i chronić ich zawartość.” Podstawy — Strona 70, Przewodnik po Bezpieczeństwie iOS, styczeń 2018. ## Protokoły @@ -56,4 +56,148 @@ Ważne jest, aby zauważyć, że łatwość rejestracji zapewniana przez DEP, ch ### DEP -- **3 API**: 1 dla sprzedawców, 1 dla dostawców MDM, 1 dla to +- **3 API**: 1 dla sprzedawców, 1 dla dostawców MDM, 1 dla tożsamości urządzenia (nieudokumentowane): +- Tzw. [API "usługi chmurowej" DEP](https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf). Jest używane przez serwery MDM do kojarzenia profili DEP z konkretnymi urządzeniami. +- [API DEP używane przez autoryzowanych sprzedawców Apple](https://applecareconnect.apple.com/api-docs/depuat/html/WSImpManual.html) do rejestracji urządzeń, sprawdzania statusu rejestracji i statusu transakcji. +- Nieudokumentowane prywatne API DEP. Jest używane przez urządzenia Apple do żądania swojego profilu DEP. Na macOS, binarny `cloudconfigurationd` jest odpowiedzialny za komunikację przez to API. +- Bardziej nowoczesne i oparte na **JSON** (w porównaniu do plist) +- Apple przyznaje dostawcy MDM **token OAuth** + +**API "usługi chmurowej" DEP** + +- RESTful +- synchronizuje rekordy urządzeń z Apple do serwera MDM +- synchronizuje „profile DEP” do Apple z serwera MDM (dostarczane przez Apple do urządzenia później) +- Profil DEP zawiera: +- URL serwera dostawcy MDM +- Dodatkowe zaufane certyfikaty dla URL serwera (opcjonalne przypinanie) +- Dodatkowe ustawienia (np. które ekrany pominąć w Asystencie Konfiguracji) + +## Numer seryjny + +Urządzenia Apple wyprodukowane po 2010 roku zazwyczaj mają **12-znakowe alfanumeryczne** numery seryjne, przy czym **pierwsze trzy cyfry reprezentują miejsce produkcji**, następne **dwie** wskazują **rok** i **tydzień** produkcji, następne **trzy** cyfry dostarczają **unikalny** **identyfikator**, a **ostatnie** **cztery** cyfry reprezentują **numer modelu**. + +{{#ref}} +macos-serial-number.md +{{#endref}} + +## Kroki rejestracji i zarządzania + +1. Tworzenie rekordu urządzenia (Sprzedawca, Apple): Rekord nowego urządzenia jest tworzony +2. Przypisanie rekordu urządzenia (Klient): Urządzenie jest przypisane do serwera MDM +3. Synchronizacja rekordu urządzenia (Dostawca MDM): MDM synchronizuje rekordy urządzeń i przesyła profile DEP do Apple +4. Rejestracja DEP (Urządzenie): Urządzenie otrzymuje swój profil DEP +5. Pobieranie profilu (Urządzenie) +6. Instalacja profilu (Urządzenie) a. w tym ładunki MDM, SCEP i root CA +7. Wydanie polecenia MDM (Urządzenie) + +![](<../../../images/image (694).png>) + +Plik `/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/PrivateFrameworks/ConfigurationProfiles.framework/ConfigurationProfiles.tbd` eksportuje funkcje, które można uznać za **wysokopoziomowe "kroki"** procesu rejestracji. + +### Krok 4: Rejestracja DEP - Uzyskiwanie Rekordu Aktywacji + +Ta część procesu zachodzi, gdy **użytkownik uruchamia Maca po raz pierwszy** (lub po całkowitym wyczyszczeniu) + +![](<../../../images/image (1044).png>) + +lub podczas wykonywania `sudo profiles show -type enrollment` + +- Określenie **czy urządzenie jest włączone w DEP** +- Rekord Aktywacji to wewnętrzna nazwa dla **profilu DEP** +- Rozpoczyna się, gdy urządzenie jest podłączone do Internetu +- Napędzane przez **`CPFetchActivationRecord`** +- Zrealizowane przez **`cloudconfigurationd`** za pośrednictwem XPC. **"Asystent Konfiguracji"** (gdy urządzenie jest po raz pierwszy uruchamiane) lub polecenie **`profiles`** skontaktuje się z tym demonem, aby uzyskać rekord aktywacji. +- LaunchDaemon (zawsze działa jako root) + +Przechodzi przez kilka kroków, aby uzyskać Rekord Aktywacji, realizowanych przez **`MCTeslaConfigurationFetcher`**. Proces ten wykorzystuje szyfrowanie zwane **Absinthe** + +1. Pobierz **certyfikat** +1. GET [https://iprofiles.apple.com/resource/certificate.cer](https://iprofiles.apple.com/resource/certificate.cer) +2. **Zainicjuj** stan z certyfikatu (**`NACInit`**) +1. Używa różnych danych specyficznych dla urządzenia (tj. **Numer Seryjny za pomocą `IOKit`**) +3. Pobierz **klucz sesji** +1. POST [https://iprofiles.apple.com/session](https://iprofiles.apple.com/session) +4. Ustanów sesję (**`NACKeyEstablishment`**) +5. Złóż żądanie +1. POST do [https://iprofiles.apple.com/macProfile](https://iprofiles.apple.com/macProfile) wysyłając dane `{ "action": "RequestProfileConfiguration", "sn": "" }` +2. Ładunek JSON jest szyfrowany przy użyciu Absinthe (**`NACSign`**) +3. Wszystkie żądania przez HTTPs, używane są wbudowane certyfikaty root + +![](<../../../images/image (566) (1).png>) + +Odpowiedź to słownik JSON z ważnymi danymi, takimi jak: + +- **url**: URL hosta dostawcy MDM dla profilu aktywacji +- **anchor-certs**: Tablica certyfikatów DER używanych jako zaufane kotwice + +### **Krok 5: Pobieranie profilu** + +![](<../../../images/image (444).png>) + +- Żądanie wysyłane do **url podanego w profilu DEP**. +- **Certyfikaty kotwiczne** są używane do **oceny zaufania**, jeśli są podane. +- Przypomnienie: właściwość **anchor_certs** profilu DEP +- **Żądanie to prosty .plist** z identyfikacją urządzenia +- Przykłady: **UDID, wersja OS**. +- Podpisane CMS, zakodowane DER +- Podpisane za pomocą **certyfikatu tożsamości urządzenia (z APNS)** +- **Łańcuch certyfikatów** zawiera wygasły **Apple iPhone Device CA** + +![](<../../../images/image (567) (1) (2) (2) (2) (2) (2) (2) (2) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (1) (2) (2).png>) + +### Krok 6: Instalacja profilu + +- Po pobraniu, **profil jest przechowywany w systemie** +- Ten krok rozpoczyna się automatycznie (jeśli w **asystencie konfiguracji**) +- Napędzany przez **`CPInstallActivationProfile`** +- Zrealizowane przez mdmclient za pośrednictwem XPC +- LaunchDaemon (jako root) lub LaunchAgent (jako użytkownik), w zależności od kontekstu +- Profile konfiguracji mają wiele ładunków do zainstalowania +- Framework ma architekturę opartą na wtyczkach do instalacji profili +- Każdy typ ładunku jest powiązany z wtyczką +- Może być XPC (w frameworku) lub klasyczny Cocoa (w ManagedClient.app) +- Przykład: +- Ładunki certyfikatów używają CertificateService.xpc + +Typowo, **profil aktywacji** dostarczany przez dostawcę MDM będzie **zawierał następujące ładunki**: + +- `com.apple.mdm`: aby **zarejestrować** urządzenie w MDM +- `com.apple.security.scep`: aby bezpiecznie dostarczyć **certyfikat klienta** do urządzenia. +- `com.apple.security.pem`: aby **zainstalować zaufane certyfikaty CA** w systemowym Keychain urządzenia. +- Instalacja ładunku MDM odpowiada **rejestracji MDM w dokumentacji** +- Ładunek **zawiera kluczowe właściwości**: +- - URL rejestracji MDM (**`CheckInURL`**) +- URL polling komend MDM (**`ServerURL`**) + temat APNs do jego wywołania +- Aby zainstalować ładunek MDM, żądanie jest wysyłane do **`CheckInURL`** +- Zrealizowane w **`mdmclient`** +- Ładunek MDM może zależeć od innych ładunków +- Umożliwia **przypinanie żądań do konkretnych certyfikatów**: +- Właściwość: **`CheckInURLPinningCertificateUUIDs`** +- Właściwość: **`ServerURLPinningCertificateUUIDs`** +- Dostarczane przez ładunek PEM +- Umożliwia urządzeniu przypisanie certyfikatu tożsamości: +- Właściwość: IdentityCertificateUUID +- Dostarczane przez ładunek SCEP + +### **Krok 7: Nasłuchiwanie poleceń MDM** + +- Po zakończeniu rejestracji MDM, dostawca może **wysyłać powiadomienia push za pomocą APNs** +- Po odebraniu, obsługiwane przez **`mdmclient`** +- Aby sprawdzić polecenia MDM, żądanie jest wysyłane do ServerURL +- Wykorzystuje wcześniej zainstalowany ładunek MDM: +- **`ServerURLPinningCertificateUUIDs`** do przypinania żądania +- **`IdentityCertificateUUID`** do certyfikatu klienta TLS + +## Ataki + +### Rejestracja urządzeń w innych organizacjach + +Jak wcześniej wspomniano, aby spróbować zarejestrować urządzenie w organizacji, **wystarczy tylko numer seryjny należący do tej organizacji**. Gdy urządzenie jest zarejestrowane, wiele organizacji zainstaluje wrażliwe dane na nowym urządzeniu: certyfikaty, aplikacje, hasła WiFi, konfiguracje VPN [i tak dalej](https://developer.apple.com/enterprise/documentation/Configuration-Profile-Reference.pdf).\ +Dlatego może to być niebezpieczny punkt wejścia dla napastników, jeśli proces rejestracji nie jest odpowiednio chroniony: + +{{#ref}} +enrolling-devices-in-other-organisations.md +{{#endref}} + +{{#include ../../../banners/hacktricks-training.md}} diff --git a/src/todo/hardware-hacking/side_channel_analysis.md b/src/todo/hardware-hacking/side_channel_analysis.md index 24d58b219..4ce962f06 100644 --- a/src/todo/hardware-hacking/side_channel_analysis.md +++ b/src/todo/hardware-hacking/side_channel_analysis.md @@ -10,12 +10,12 @@ Ataki kanałów bocznych odzyskują sekrety poprzez obserwację fizycznego lub m | Kanał | Typowy Cel | Instrumentacja | |-------|------------|-----------------| -| Zużycie energii | Karty inteligentne, MCU IoT, FPGA | Oscyloskop + rezystor szeregowy/probe HS (np. CW503) | -| Pole elektromagnetyczne (EM) | CPU, RFID, akceleratory AES | Proba H-field + LNA, ChipWhisperer/RTL-SDR | -| Czas wykonania / pamięci podręczne | CPU desktopowe i chmurowe | Wysokoprecyzyjne timery (rdtsc/rdtscp), zdalny czas przelotu | +| Zużycie energii | Karty inteligentne, MCU IoT, FPGA | Oscyloskop + rezystor szeregowy/probnik HS (np. CW503) | +| Pole elektromagnetyczne (EM) | CPU, RFID, akceleratory AES | Probnik H-field + LNA, ChipWhisperer/RTL-SDR | +| Czas wykonania / pamięci podręczne | CPU stacjonarne i w chmurze | Wysokoprecyzyjne timery (rdtsc/rdtscp), zdalny czas przelotu | | Akustyczny / mechaniczny | Klawiatury, drukarki 3D, przekaźniki | Mikrofon MEMS, wibrometr laserowy | | Optyczny i termiczny | LED-y, drukarki laserowe, DRAM | Fotodioda / kamera wysokiej prędkości, kamera IR | -| Wywołany błędem | Kryptografia ASIC/MCU | Glitch zegara/napięcia, EMFI, wstrzyknięcie laserowe | +| Wywołany błędem | ASIC/MCU kryptograficzne | Glitch zegara/napięcia, EMFI, wstrzyknięcie laserowe | --- @@ -40,12 +40,12 @@ Zdobądź *N > 1 000* śladów, hipotetyzuj bajt klucza `k`, oblicz model HW/HD import numpy as np corr = np.corrcoef(leakage_model(k), traces[:,sample]) ``` -CPA pozostaje na czołowej pozycji, ale warianty uczenia maszynowego (MLA, SCA głębokiego uczenia) dominują teraz w zawodach takich jak ASCAD-v2 (2023). +CPA pozostaje na czołowej pozycji, ale warianty uczenia maszynowego (MLA, deep-learning SCA) dominują teraz w zawodach takich jak ASCAD-v2 (2023). --- ## Analiza elektromagnetyczna (EMA) -Proby EM w bliskim polu (500 MHz–3 GHz) ujawniają identyczne informacje jak analiza mocy *bez* wstawiania shuntów. Badania z 2024 roku wykazały odzyskiwanie kluczy w **>10 cm** od STM32 przy użyciu korelacji widma i niskokosztowych front-endów RTL-SDR. +Proby EM w bliskim polu (500 MHz–3 GHz) ujawniają identyczne informacje jak analiza mocy *bez* wstawiania shuntów. Badania z 2024 roku wykazały odzyskiwanie kluczy w odległości **>10 cm** od STM32 przy użyciu korelacji widma i niskokosztowych front-endów RTL-SDR. --- @@ -53,28 +53,24 @@ Proby EM w bliskim polu (500 MHz–3 GHz) ujawniają identyczne informacje jak a Nowoczesne procesory ujawniają sekrety przez wspólne zasoby: * **Hertzbleed (2022)** – skalowanie częstotliwości DVFS koreluje z wagą Hamming'a, co pozwala na *zdalne* wydobycie kluczy EdDSA. * **Downfall / Gather Data Sampling (Intel, 2023)** – wykonanie przejściowe do odczytu danych AVX-gather przez wątki SMT. -* **Zenbleed (AMD, 2023) i Inception (AMD, 2023)** – spekulacyjne błędne przewidywanie wektorów ujawnia rejestry międzydomenowe. - -Aby uzyskać szerokie omówienie problemów klasy Spectre, zobacz {{#ref}} -../../cpu-microarchitecture/microarchitectural-attacks.md -{{#endref}} +* **Zenbleed (AMD, 2023) & Inception (AMD, 2023)** – spekulacyjne błędne przewidywanie wektorów ujawnia rejestry międzydomenowe. --- ## Ataki akustyczne i optyczne * W 2024 roku "​iLeakKeys" wykazało 95% dokładność w odzyskiwaniu naciśnięć klawiszy laptopa z **mikrofonu smartfona przez Zoom** przy użyciu klasyfikatora CNN. -* Fotodiody o wysokiej prędkości rejestrują aktywność LED DDR4 i rekonstruują klucze rundy AES w czasie <1 minuty (BlackHat 2023). +* Fotodiody o wysokiej prędkości rejestrują aktywność LED DDR4 i rekonstruują klucze rund AES w czasie <1 minuty (BlackHat 2023). --- ## Wstrzykiwanie błędów i różnicowa analiza błędów (DFA) Łączenie błędów z wyciekiem kanału bocznego skraca poszukiwanie kluczy (np. 1-ślad AES DFA). Ostatnie narzędzia w cenie dla hobbystów: -* **ChipSHOUTER i PicoEMP** – zakłócanie impulsami elektromagnetycznymi poniżej 1 ns. +* **ChipSHOUTER & PicoEMP** – zakłócanie impulsami elektromagnetycznymi poniżej 1 ns. * **GlitchKit-R5 (2025)** – platforma do zakłócania zegara/napięcia typu open-source wspierająca SoC RISC-V. --- -## Typowy przebieg ataku +## Typowy przepływ ataku 1. Zidentyfikuj kanał wycieku i punkt montażowy (pin VCC, kondensator odsprzęgający, miejsce w bliskim polu). 2. Wstaw wyzwalacz (GPIO lub oparty na wzorze). 3. Zbierz >1 k śladów z odpowiednim próbkowaniem/filtrami. @@ -88,23 +84,23 @@ Aby uzyskać szerokie omówienie problemów klasy Spectre, zobacz {{#ref}} * **Implementacje o stałym czasie** i algorytmy odporne na pamięć. * **Maskowanie/tasowanie** – podziel sekrety na losowe udziały; odporność pierwszego rzędu certyfikowana przez TVLA. * **Ukrywanie** – regulatory napięcia na chipie, zrandomizowany zegar, logika dual-rail, osłony EM. -* **Wykrywanie błędów** – redundantne obliczenia, podpisy progowe. +* **Wykrywanie błędów** – redundantne obliczenia, sygnatury progowe. * **Operacyjne** – wyłącz DVFS/turbo w jądrach kryptograficznych, izoluj SMT, zabroń współlokacji w chmurach wielodostępnych. --- ## Narzędzia i ramy * **ChipWhisperer-Husky** (2024) – oscyloskop 500 MS/s + wyzwalacz Cortex-M; API Python jak powyżej. -* **Riscure Inspector i FI** – komercyjne, wspiera automatyczną ocenę wycieków (TVLA-2.0). -* **scaaml** – biblioteka SCA oparta na głębokim uczeniu TensorFlow (v1.2 – 2025). +* **Riscure Inspector & FI** – komercyjne, wspiera automatyczną ocenę wycieków (TVLA-2.0). +* **scaaml** – biblioteka SCA oparta na głębokim uczeniu w TensorFlow (v1.2 – 2025). * **pyecsca** – otwartoźródłowa ramy ECC SCA ANSSI. --- ## Odniesienia -* [Dokumentacja ChipWhisperer](https://chipwhisperer.readthedocs.io/en/latest/) -* [Artykuł o ataku Hertzbleed](https://www.hertzbleed.com/) +* [ChipWhisperer Documentation](https://chipwhisperer.readthedocs.io/en/latest/) +* [Hertzbleed Attack Paper](https://www.hertzbleed.com/) {{#include ../../banners/hacktricks-training.md}} diff --git a/src/windows-hardening/lateral-movement/psexec-and-winexec.md b/src/windows-hardening/lateral-movement/psexec-and-winexec.md index 0998f5991..a8d91019f 100644 --- a/src/windows-hardening/lateral-movement/psexec-and-winexec.md +++ b/src/windows-hardening/lateral-movement/psexec-and-winexec.md @@ -9,8 +9,8 @@ Te techniki wykorzystują Menedżera Kontroli Usług Windows (SCM) zdalnie przez 1. Uwierzytelnienie do celu i dostęp do udziału ADMIN$ przez SMB (TCP/445). 2. Skopiowanie pliku wykonywalnego lub określenie linii poleceń LOLBAS, którą usługa uruchomi. 3. Zdalne utworzenie usługi za pomocą SCM (MS-SCMR przez \PIPE\svcctl) wskazującej na to polecenie lub binarny plik. -4. Uruchomienie usługi w celu wykonania ładunku i opcjonalnie przechwycenie stdin/stdout przez nazwany potok. -5. Zatrzymanie usługi i sprzątanie (usunięcie usługi i wszelkich zrzucanych binarnych plików). +4. Uruchomienie usługi w celu wykonania ładunku i opcjonalne przechwycenie stdin/stdout przez nazwany potok. +5. Zatrzymanie usługi i sprzątanie (usunięcie usługi i wszelkich skopiowanych binarnych plików). Wymagania/wymogi wstępne: - Lokalny administrator na docelowym hoście (SeCreateServicePrivilege) lub wyraźne prawa do tworzenia usług na docelowym hoście. @@ -20,7 +20,7 @@ Wymagania/wymogi wstępne: ### Ręczne ScExec/WinExec za pomocą sc.exe -Poniżej przedstawiono minimalne podejście do tworzenia usługi. Obraz usługi może być zrzucanym EXE lub LOLBAS, takim jak cmd.exe lub powershell.exe. +Poniżej przedstawiono minimalne podejście do tworzenia usługi. Obraz usługi może być skopiowanym EXE lub LOLBAS, takim jak cmd.exe lub powershell.exe. ```cmd :: Execute a one-liner without dropping a binary sc.exe \\TARGET create HTSvc binPath= "cmd.exe /c whoami > C:\\Windows\\Temp\\o.txt" start= demand @@ -60,7 +60,7 @@ PsExec64.exe -accepteula \\HOST -r WinSvc$ -s cmd.exe /c ipconfig \\live.sysinternals.com\tools\PsExec64.exe -accepteula \\HOST -s cmd.exe /c whoami ``` OPSEC -- Zostawia zdarzenia instalacji/odinstalacji usługi (nazwa usługi często PSEXESVC, chyba że użyto -r) i tworzy C:\Windows\PSEXESVC.exe podczas wykonywania. +- Zostawia zdarzenia instalacji/odinstalacji usługi (Nazwa usługi często PSEXESVC, chyba że użyto -r) i tworzy C:\Windows\PSEXESVC.exe podczas wykonywania. ### Impacket psexec.py (podobny do PsExec) @@ -109,34 +109,36 @@ cme smb HOST -u USER -H NTHASH -x "ipconfig /all" --exec-method smbexec Typowe artefakty hosta/sieci przy użyciu technik podobnych do PsExec: - Zdarzenia zabezpieczeń 4624 (Typ logowania 3) i 4672 (Specjalne uprawnienia) na docelowym koncie administratora. - Zdarzenia zabezpieczeń 5140/5145 dotyczące udostępniania plików i szczegółowe zdarzenia udostępniania plików pokazujące dostęp do ADMIN$ oraz tworzenie/zapisywanie binariów usług (np. PSEXESVC.exe lub losowe 8-znakowe .exe). -- Instalacja usługi zabezpieczeń 7045 na docelowym: nazwy usług takie jak PSEXESVC, RemComSvc lub niestandardowe (-r / -service-name). +- Zainstalowanie usługi zabezpieczeń 7045 na docelowym: nazwy usług takie jak PSEXESVC, RemComSvc lub niestandardowe (-r / -service-name). - Sysmon 1 (Utworzenie procesu) dla services.exe lub obrazu usługi, 3 (Połączenie sieciowe), 11 (Utworzenie pliku) w C:\Windows\, 17/18 (Rura utworzona/połączona) dla rur takich jak \\.\pipe\psexesvc, \\.\pipe\remcom_*, lub zrandomizowane odpowiedniki. - Artefakt rejestru dla EULA Sysinternals: HKCU\Software\Sysinternals\PsExec\EulaAccepted=0x1 na hoście operatora (jeśli nie jest tłumione). Pomysły na polowanie - Powiadomienie o instalacjach usług, gdzie ImagePath zawiera cmd.exe /c, powershell.exe lub lokalizacje TEMP. - Szukaj tworzenia procesów, gdzie ParentImage to C:\Windows\PSEXESVC.exe lub dzieci services.exe działających jako LOCAL SYSTEM wykonujących powłokę. -- Oznaczaj nazwane rury kończące się na -stdin/-stdout/-stderr lub znane nazwy rur klonów PsExec. +- Oznacz nazwane rury kończące się na -stdin/-stdout/-stderr lub znane nazwy rur klonów PsExec. ## Rozwiązywanie typowych problemów -- Odmowa dostępu (5) podczas tworzenia usług: brak prawdziwego lokalnego administratora, ograniczenia UAC dla lokalnych kont lub ochrona przed manipulacją EDR na ścieżce binariów usługi. +- Odmowa dostępu (5) podczas tworzenia usług: brak prawdziwego lokalnego administratora, zdalne ograniczenia UAC dla lokalnych kont lub ochrona przed manipulacją EDR na ścieżce binariów usługi. - Ścieżka sieciowa nie została znaleziona (53) lub nie można połączyć się z ADMIN$: zapora blokująca SMB/RPC lub wyłączone udostępnianie administratora. -- Kerberos nie działa, ale NTLM jest zablokowany: połącz się używając nazwy hosta/FQDN (nie IP), upewnij się, że SPN są poprawne, lub dostarcz -k/-no-pass z biletami przy użyciu Impacket. +- Kerberos nie działa, ale NTLM jest zablokowany: połącz się używając nazwy hosta/FQDN (nie IP), upewnij się, że SPN są poprawne, lub dostarcz -k/-no-pass z biletami podczas korzystania z Impacket. - Rozpoczęcie usługi przekracza czas, ale ładunek działał: oczekiwane, jeśli nie jest to prawdziwy plik binarny usługi; przechwyć wyjście do pliku lub użyj smbexec do bieżącego I/O. -## Notatki dotyczące zabezpieczeń (nowoczesne zmiany) -- Windows 11 24H2 i Windows Server 2025 wymagają podpisywania SMB domyślnie dla połączeń wychodzących (i Windows 11 przychodzących). Nie wpływa to na legalne użycie PsExec z ważnymi poświadczeniami, ale zapobiega nadużywaniu niepodpisanego SMB relay i może wpłynąć na urządzenia, które nie obsługują podpisywania. -- Nowe blokowanie NTLM klienta SMB (Windows 11 24H2/Server 2025) może uniemożliwić fallback NTLM przy łączeniu przez IP lub do serwerów nie-Kerberos. W zabezpieczonych środowiskach to złamie oparte na NTLM PsExec/SMBExec; użyj Kerberos (nazwa hosta/FQDN) lub skonfiguruj wyjątki, jeśli jest to rzeczywiście potrzebne. +## Notatki dotyczące zabezpieczeń +- Windows 11 24H2 i Windows Server 2025 wymagają podpisywania SMB domyślnie dla połączeń wychodzących (i Windows 11 przychodzących). Nie łamie to legalnego użycia PsExec z ważnymi poświadczeniami, ale zapobiega nadużywaniu niepodpisanego przekazywania SMB i może wpłynąć na urządzenia, które nie obsługują podpisywania. +- Nowe blokowanie NTLM w kliencie SMB (Windows 11 24H2/Server 2025) może uniemożliwić powrót do NTLM podczas łączenia się przez IP lub do serwerów nie-Kerberos. W zabezpieczonych środowiskach to złamie oparte na NTLM PsExec/SMBExec; użyj Kerberos (nazwa hosta/FQDN) lub skonfiguruj wyjątki, jeśli jest to rzeczywiście potrzebne. - Zasada najmniejszych uprawnień: minimalizuj członkostwo lokalnych administratorów, preferuj Just-in-Time/Just-Enough Admin, egzekwuj LAPS i monitoruj/powiadamiaj o instalacjach usług 7045. ## Zobacz także -- WMI-based remote exec (często bardziej bezplikowe): +- Wykonanie zdalne oparte na WMI (często bardziej bezplikowe): + {{#ref}} ./wmiexec.md {{#endref}} -- WinRM-based remote exec: +- Wykonanie zdalne oparte na WinRM: + {{#ref}} ./winrm.md {{#endref}} @@ -147,4 +149,5 @@ Pomysły na polowanie - PsExec - Sysinternals | Microsoft Learn: https://learn.microsoft.com/sysinternals/downloads/psexec - Zabezpieczenia SMB w Windows Server 2025 i Windows 11 (podpisywanie domyślnie, blokowanie NTLM): https://techcommunity.microsoft.com/blog/filecab/smb-security-hardening-in-windows-server-2025--windows-11/4226591 + {{#include ../../banners/hacktricks-training.md}}