Translated ['', 'src/generic-methodologies-and-resources/basic-forensic-

This commit is contained in:
Translator 2025-08-21 02:33:15 +00:00
parent d410f73b9b
commit d0b82edd14
17 changed files with 212 additions and 2006 deletions

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name '*.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -1,131 +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: Clean build directory
run: rm -rf ./book 2>/dev/null
- name: Build mdBook
run: |
git checkout "$BRANCH"
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: |
echo "Current branch:"
git rev-parse --abbrev-ref HEAD
echo "Syncing $BRANCH to S3"
aws s3 sync ./book s3://hacktricks-wiki/$BRANCH --delete
echo "Sync completed"
echo "Cat 3 files from the book"
find . -type f -name 'index.html' -print | head -n 3 | xargs -r cat

View File

@ -2,14 +2,14 @@
{{#include ../../banners/hacktricks-training.md}}
## Timestamps
## Tiempos
Un atacante puede estar interesado en **cambiar las marcas de tiempo de los archivos** para evitar ser detectado.\
Es posible encontrar las marcas de tiempo dentro del MFT en los atributos `$STANDARD_INFORMATION` \_\_ y \_\_ `$FILE_NAME`.
Ambos atributos tienen 4 marcas de tiempo: **Modificación**, **acceso**, **creación** y **modificación del registro MFT** (MACE o MACB).
**Windows explorer** y otras herramientas muestran la información de **`$STANDARD_INFORMATION`**.
**Explorador de Windows** y otras herramientas muestran la información de **`$STANDARD_INFORMATION`**.
### TimeStomp - Herramienta anti-forense
@ -42,11 +42,11 @@ Usando la misma herramienta es posible identificar **a qué hora se modificaron
### Comparación de `$STANDARD_INFORMATION` y `$FILE_NAME`
Otra forma de identificar archivos modificados sospechosos sería comparar el tiempo en ambos atributos buscando **incongruencias**.
Otra forma de identificar archivos modificados sospechosos sería comparar el tiempo en ambos atributos buscando **inconsistencias**.
### Nanosegundos
Las marcas de tiempo de **NTFS** tienen una **precisión** de **100 nanosegundos**. Por lo tanto, encontrar archivos con marcas de tiempo como 2010-10-10 10:10:**00.000:0000 es muy sospechoso**.
Las marcas de tiempo de **NTFS** tienen una **precisión** de **100 nanosegundos**. Entonces, encontrar archivos con marcas de tiempo como 2010-10-10 10:10:**00.000:0000 es muy sospechoso**.
### SetMace - Herramienta anti-forense
@ -54,13 +54,13 @@ Esta herramienta puede modificar ambos atributos `$STARNDAR_INFORMATION` y `$FIL
## Ocultamiento de Datos
NFTS utiliza un clúster y el tamaño mínimo de información. Eso significa que si un archivo ocupa un clúster y medio, la **mitad restante nunca se utilizará** hasta que se elimine el archivo. Entonces, es posible **ocultar datos en este espacio de holgura**.
NFTS utiliza un clúster y el tamaño mínimo de información. Eso significa que si un archivo ocupa y utiliza un clúster y medio, la **mitad restante nunca se va a utilizar** hasta que se elimine el archivo. Entonces, es posible **ocultar datos en este espacio de relleno**.
Hay herramientas como slacker que permiten ocultar datos en este espacio "oculto". Sin embargo, un análisis del `$logfile` y `$usnjrnl` puede mostrar que se añadieron algunos datos:
![](<../../images/image (1060).png>)
Entonces, es posible recuperar el espacio de holgura usando herramientas como FTK Imager. Tenga en cuenta que este tipo de herramienta puede guardar el contenido ofuscado o incluso cifrado.
Entonces, es posible recuperar el espacio de relleno usando herramientas como FTK Imager. Tenga en cuenta que este tipo de herramienta puede guardar el contenido ofuscado o incluso cifrado.
## UsbKill
@ -77,7 +77,7 @@ Estas distribuciones se **ejecutan dentro de la memoria RAM**. La única forma d
## Configuración de Windows
Es posible deshabilitar varios métodos de registro de Windows para dificultar mucho la investigación forense.
Es posible deshabilitar varios métodos de registro de Windows para hacer que la investigación forense sea mucho más difícil.
### Deshabilitar Marcas de Tiempo - UserAssist
@ -123,7 +123,7 @@ También puede eliminarlas a través de la GUI siguiendo los pasos propuestos en
Para deshabilitar las copias de sombra [pasos desde aquí](https://support.waters.com/KB_Inf/Other/WKB15560_How_to_disable_Volume_Shadow_Copy_Service_VSS_in_Windows):
1. Abra el programa Servicios escribiendo "services" en el cuadro de búsqueda de texto después de hacer clic en el botón de inicio de Windows.
1. Abra el programa de Servicios escribiendo "services" en el cuadro de búsqueda de texto después de hacer clic en el botón de inicio de Windows.
2. En la lista, busque "Copia de Sombra de Volumen", selecciónelo y luego acceda a Propiedades haciendo clic derecho.
3. Elija Deshabilitado en el menú desplegable "Tipo de inicio" y luego confirme el cambio haciendo clic en Aplicar y Aceptar.
@ -142,12 +142,155 @@ También es posible modificar la configuración de qué archivos se van a copiar
### Deshabilitar registros de eventos de Windows
- `reg add 'HKLM\SYSTEM\CurrentControlSet\Services\eventlog' /v Start /t REG_DWORD /d 4 /f`
- Dentro de la sección de servicios, deshabilite el servicio "Registro de Eventos de Windows"
- `reg add 'HKLM\\SYSTEM\\CurrentControlSet\\Services\\eventlog' /v Start /t REG_DWORD /d 4 /f`
- Dentro de la sección de servicios deshabilitar el servicio "Registro de Eventos de Windows"
- `WEvtUtil.exec clear-log` o `WEvtUtil.exe cl`
### Deshabilitar $UsnJrnl
- `fsutil usn deletejournal /d c:`
---
## Registro Avanzado y Manipulación de Trazas (2023-2025)
### Registro de ScriptBlock/Module de PowerShell
Las versiones recientes de Windows 10/11 y Windows Server mantienen **ricos artefactos forenses de PowerShell** bajo
`Microsoft-Windows-PowerShell/Operational` (eventos 4104/4105/4106).
Los atacantes pueden deshabilitarlos o borrarlos sobre la marcha:
```powershell
# Turn OFF ScriptBlock & Module logging (registry persistence)
New-ItemProperty -Path "HKLM:\\SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine" \
-Name EnableScriptBlockLogging -Value 0 -PropertyType DWord -Force
New-ItemProperty -Path "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\PowerShell\\ModuleLogging" \
-Name EnableModuleLogging -Value 0 -PropertyType DWord -Force
# In-memory wipe of recent PowerShell logs
Get-WinEvent -LogName 'Microsoft-Windows-PowerShell/Operational' |
Remove-WinEvent # requires admin & Win11 23H2+
```
Los defensores deben monitorear los cambios en esas claves del registro y la eliminación de eventos de PowerShell de alto volumen.
### Parche ETW (Event Tracing for Windows)
Los productos de seguridad de endpoints dependen en gran medida de ETW. Un método de evasión popular en 2024 es parchear `ntdll!EtwEventWrite`/`EtwEventWriteFull` en memoria para que cada llamada a ETW devuelva `STATUS_SUCCESS` sin emitir el evento:
```c
// 0xC3 = RET on x64
unsigned char patch[1] = { 0xC3 };
WriteProcessMemory(GetCurrentProcess(),
GetProcAddress(GetModuleHandleA("ntdll.dll"), "EtwEventWrite"),
patch, sizeof(patch), NULL);
```
Public PoCs (por ejemplo, `EtwTiSwallow`) implementan la misma primitiva en PowerShell o C++.
Debido a que el parche es **local al proceso**, los EDR que se ejecutan dentro de otros procesos pueden pasarlo por alto.
Detección: comparar `ntdll` en memoria vs. en disco, o enganchar antes del modo de usuario.
### Revitalización de Flujos de Datos Alternativos (ADS)
Se han observado campañas de malware en 2023 (por ejemplo, cargadores **FIN12**) que han estado colocando binarios de segunda etapa dentro de ADS para mantenerse fuera de la vista de los escáneres tradicionales:
```cmd
rem Hide cobalt.bin inside an ADS of a PDF
type cobalt.bin > report.pdf:win32res.dll
rem Execute directly
wmic process call create "cmd /c report.pdf:win32res.dll"
```
Enumerar flujos con `dir /R`, `Get-Item -Stream *`, o Sysinternals `streams64.exe`. Copiar el archivo de host a FAT/exFAT o a través de SMB eliminará el flujo oculto y puede ser utilizado por los investigadores para recuperar la carga útil.
### BYOVD & “AuKill” (2023)
Bring-Your-Own-Vulnerable-Driver se utiliza ahora rutinariamente para **anti-forensics** en intrusiones de ransomware. La herramienta de código abierto **AuKill** carga un controlador firmado pero vulnerable (`procexp152.sys`) para suspender o terminar los sensores EDR y forenses **antes de la encriptación y destrucción de registros**:
```cmd
AuKill.exe -e "C:\\Program Files\\Windows Defender\\MsMpEng.exe"
AuKill.exe -k CrowdStrike
```
El controlador se elimina después, dejando artefactos mínimos.
Mitigaciones: habilitar la lista de bloqueo de controladores vulnerables de Microsoft (HVCI/SAC) y alertar sobre la creación de servicios del kernel desde rutas escribibles por el usuario.
---
## Linux Anti-Forensics: Autoparcheo y C2 en la Nube (20232025)
### Autoparcheo de servicios comprometidos para reducir la detección (Linux)
Los adversarios cada vez más "autoparchean" un servicio justo después de explotarlo para prevenir la re-explotación y suprimir las detecciones basadas en vulnerabilidades. La idea es reemplazar componentes vulnerables con los últimos binarios/JARs legítimos de upstream, de modo que los escáneres informen que el host está parcheado mientras la persistencia y C2 permanecen.
Ejemplo: Apache ActiveMQ OpenWire RCE (CVE202346604)
- Después de la explotación, los atacantes obtuvieron JARs legítimos de Maven Central (repo1.maven.org), eliminaron JARs vulnerables en la instalación de ActiveMQ y reiniciaron el broker.
- Esto cerró el RCE inicial mientras mantenía otros puntos de apoyo (cron, cambios en la configuración de SSH, implantes C2 separados).
Ejemplo operativo (ilustrativo)
```bash
# ActiveMQ install root (adjust as needed)
AMQ_DIR=/opt/activemq
cd "$AMQ_DIR"/lib
# Fetch patched JARs from Maven Central (versions as appropriate)
curl -fsSL -O https://repo1.maven.org/maven2/org/apache/activemq/activemq-client/5.18.3/activemq-client-5.18.3.jar
curl -fsSL -O https://repo1.maven.org/maven2/org/apache/activemq/activemq-openwire-legacy/5.18.3/activemq-openwire-legacy-5.18.3.jar
# Remove vulnerable files and ensure the service uses the patched ones
rm -f activemq-client-5.18.2.jar activemq-openwire-legacy-5.18.2.jar || true
ln -sf activemq-client-5.18.3.jar activemq-client.jar
ln -sf activemq-openwire-legacy-5.18.3.jar activemq-openwire-legacy.jar
# Apply changes without removing persistence
systemctl restart activemq || service activemq restart
```
Forense/caza consejos
- Revise los directorios de servicios en busca de reemplazos binarios/JAR no programados:
- Debian/Ubuntu: `dpkg -V activemq` y compare los hashes/rutas de archivos con los espejos del repositorio.
- RHEL/CentOS: `rpm -Va 'activemq*'`
- Busque versiones de JAR presentes en el disco que no sean propiedad del gestor de paquetes, o enlaces simbólicos actualizados fuera de banda.
- Línea de tiempo: `find "$AMQ_DIR" -type f -printf '%TY-%Tm-%Td %TH:%TM %p\n' | sort` para correlacionar ctime/mtime con la ventana de compromiso.
- Historial de shell/telemetría de procesos: evidencia de `curl`/`wget` a `repo1.maven.org` u otros CDNs de artefactos inmediatamente después de la explotación inicial.
- Gestión de cambios: valide quién aplicó el “parche” y por qué, no solo que una versión parcheada esté presente.
### C2 de servicio en la nube con tokens portadores y stagers anti-análisis
El comercio observado combinó múltiples rutas C2 de largo recorrido y empaquetado anti-análisis:
- Cargadores ELF de PyInstaller protegidos por contraseña para dificultar el sandboxing y el análisis estático (por ejemplo, PYZ cifrado, extracción temporal bajo `/_MEI*`).
- Indicadores: hits de `strings` como `PyInstaller`, `pyi-archive`, `PYZ-00.pyz`, `MEIPASS`.
- Artefactos en tiempo de ejecución: extracción a `/tmp/_MEI*` o rutas personalizadas `--runtime-tmpdir`.
- C2 respaldado por Dropbox utilizando tokens OAuth Bearer codificados.
- Marcadores de red: `api.dropboxapi.com` / `content.dropboxapi.com` con `Authorization: Bearer <token>`.
- Cace en proxy/NetFlow/Zeek/Suricata para HTTPS saliente a dominios de Dropbox desde cargas de trabajo de servidor que normalmente no sincronizan archivos.
- C2 paralelo/respaldo a través de túneles (por ejemplo, Cloudflare Tunnel `cloudflared`), manteniendo el control si un canal es bloqueado.
- IOCs de host: procesos/unidades `cloudflared`, configuración en `~/.cloudflared/*.json`, saliente 443 a los bordes de Cloudflare.
### Persistencia y “rollback de endurecimiento” para mantener el acceso (ejemplos de Linux)
Los atacantes a menudo combinan auto-parcheo con rutas de acceso duraderas:
- Cron/Anacron: ediciones al stub `0anacron` en cada directorio `/etc/cron.*/` para ejecución periódica.
- Cace:
```bash
for d in /etc/cron.*; do [ -f "$d/0anacron" ] && stat -c '%n %y %s' "$d/0anacron"; done
grep -R --line-number -E 'curl|wget|python|/bin/sh' /etc/cron.*/* 2>/dev/null
```
- Rollback de endurecimiento de configuración SSH: habilitar inicios de sesión de root y alterar shells predeterminados para cuentas de bajo privilegio.
- Cace para habilitar inicios de sesión de root:
```bash
grep -E '^\s*PermitRootLogin' /etc/ssh/sshd_config
# valores de bandera como "yes" o configuraciones excesivamente permisivas
```
- Cace para shells interactivas sospechosas en cuentas del sistema (por ejemplo, `games`):
```bash
awk -F: '($7 ~ /bin\/(sh|bash|zsh)/ && $1 ~ /^(games|lp|sync|shutdown|halt|mail|operator)$/) {print}' /etc/passwd
```
- Artefactos de beacon aleatorios y de nombre corto (8 caracteres alfabéticos) dejados en el disco que también contactan C2 en la nube:
- Cace:
```bash
find / -maxdepth 3 -type f -regextype posix-extended -regex '.*/[A-Za-z]{8}$' \
-exec stat -c '%n %s %y' {} \; 2>/dev/null | sort
```
Los defensores deben correlacionar estos artefactos con la exposición externa y los eventos de parcheo de servicios para descubrir la auto-remediación anti-forense utilizada para ocultar la explotación inicial.
## Referencias
- Sophos X-Ops “AuKill: Un controlador vulnerable armado para deshabilitar EDR” (marzo de 2023)
https://news.sophos.com/en-us/2023/03/07/aukill-a-weaponized-vulnerable-driver-for-disabling-edr
- Red Canary “Parcheando EtwEventWrite para sigilo: Detección y Caza” (junio de 2024)
https://redcanary.com/blog/etw-patching-detection
- [Red Canary Parcheando para persistencia: Cómo el malware DripDropper de Linux se mueve a través de la nube](https://redcanary.com/blog/threat-intelligence/dripdropper-linux-malware/)
- [CVE202346604 Apache ActiveMQ OpenWire RCE (NVD)](https://nvd.nist.gov/vuln/detail/CVE-2023-46604)
{{#include ../../banners/hacktricks-training.md}}

View File

@ -42,7 +42,7 @@ Mientras obtienes la información básica, deberías verificar cosas extrañas c
Para obtener la memoria del sistema en ejecución, se recomienda usar [**LiME**](https://github.com/504ensicsLabs/LiME).\
Para **compilarlo**, necesitas usar el **mismo kernel** que está utilizando la máquina víctima.
> [!NOTE]
> [!TIP]
> Recuerda que **no puedes instalar LiME ni nada más** en la máquina víctima, ya que hará varios cambios en ella.
Así que, si tienes una versión idéntica de Ubuntu, puedes usar `apt-get install lime-forensics-dkms`\
@ -64,7 +64,7 @@ LiME también se puede usar para **enviar el volcado a través de la red** en lu
#### Apagado
Primero que nada, necesitarás **apagar el sistema**. Esto no siempre es una opción, ya que a veces el sistema será un servidor de producción que la empresa no puede permitirse apagar.\
Hay **2 maneras** de apagar el sistema, un **apagado normal** y un **apagado de "desenchufar"**. El primero permitirá que los **procesos se terminen como de costumbre** y que el **sistema de archivos** esté **sincronizado**, pero también permitirá que el posible **malware** **destruya evidencia**. El enfoque de "desenchufar" puede conllevar **alguna pérdida de información** (no se perderá mucha información ya que ya tomamos una imagen de la memoria) y el **malware no tendrá ninguna oportunidad** de hacer algo al respecto. Por lo tanto, si **sospechas** que puede haber un **malware**, simplemente ejecuta el **comando** **`sync`** en el sistema y desenchufa.
Hay **2 formas** de apagar el sistema, un **apagado normal** y un **apagado de "desconectar el enchufe"**. El primero permitirá que los **procesos se terminen como de costumbre** y que el **sistema de archivos** esté **sincronizado**, pero también permitirá que el posible **malware** **destruya evidencia**. El enfoque de "desconectar el enchufe" puede conllevar **alguna pérdida de información** (no se perderá mucha información ya que ya tomamos una imagen de la memoria) y el **malware no tendrá ninguna oportunidad** de hacer algo al respecto. Por lo tanto, si **sospechas** que puede haber un **malware**, simplemente ejecuta el **comando** **`sync`** en el sistema y desconecta el enchufe.
#### Tomando una imagen del disco
@ -132,18 +132,18 @@ r/r 16: secret.txt
icat -i raw -f ext4 disk.img 16
ThisisTheMasterSecret
```
## Buscar Malware conocido
## Buscar malware conocido
### Archivos del sistema modificados
Linux ofrece herramientas para garantizar la integridad de los componentes del sistema, crucial para detectar archivos potencialmente problemáticos.
- **Sistemas basados en RedHat**: Use `rpm -Va` para una verificación completa.
- **Sistemas basados en RedHat**: Usa `rpm -Va` para una verificación completa.
- **Sistemas basados en Debian**: `dpkg --verify` para una verificación inicial, seguido de `debsums | grep -v "OK$"` (después de instalar `debsums` con `apt-get install debsums`) para identificar cualquier problema.
### Detectores de Malware/Rootkit
Lea la siguiente página para aprender sobre herramientas que pueden ser útiles para encontrar malware:
Lee la siguiente página para aprender sobre herramientas que pueden ser útiles para encontrar malware:
{{#ref}}
malware-analysis.md
@ -151,12 +151,12 @@ malware-analysis.md
## Buscar programas instalados
Para buscar de manera efectiva programas instalados en sistemas Debian y RedHat, considere aprovechar los registros del sistema y bases de datos junto con verificaciones manuales en directorios comunes.
Para buscar de manera efectiva programas instalados en sistemas Debian y RedHat, considera aprovechar los registros del sistema y bases de datos junto con verificaciones manuales en directorios comunes.
- Para Debian, inspeccione _**`/var/lib/dpkg/status`**_ y _**`/var/log/dpkg.log`**_ para obtener detalles sobre las instalaciones de paquetes, utilizando `grep` para filtrar información específica.
- Para Debian, inspecciona _**`/var/lib/dpkg/status`**_ y _**`/var/log/dpkg.log`**_ para obtener detalles sobre las instalaciones de paquetes, utilizando `grep` para filtrar información específica.
- Los usuarios de RedHat pueden consultar la base de datos RPM con `rpm -qa --root=/mntpath/var/lib/rpm` para listar los paquetes instalados.
Para descubrir software instalado manualmente o fuera de estos gestores de paquetes, explore directorios como _**`/usr/local`**_, _**`/opt`**_, _**`/usr/sbin`**_, _**`/usr/bin`**_, _**`/bin`**_ y _**`/sbin`**_. Combine listados de directorios con comandos específicos del sistema para identificar ejecutables no asociados con paquetes conocidos, mejorando su búsqueda de todos los programas instalados.
Para descubrir software instalado manualmente o fuera de estos gestores de paquetes, explora directorios como _**`/usr/local`**_, _**`/opt`**_, _**`/usr/sbin`**_, _**`/usr/bin`**_, _**`/bin`**_ y _**`/sbin`**_. Combina listados de directorios con comandos específicos del sistema para identificar ejecutables no asociados con paquetes conocidos, mejorando tu búsqueda de todos los programas instalados.
```bash
# Debian package and log details
cat /var/lib/dpkg/status | grep -E "Package:|Status:"
@ -172,9 +172,9 @@ find /sbin/ exec rpm -qf {} \; | grep "is not"
# Find exacuable files
find / -type f -executable | grep <something>
```
## Recuperar Binarios Ejecutables Borrados
## Recuperar binarios en ejecución eliminados
Imagina un proceso que se ejecutó desde /tmp/exec y luego fue borrado. Es posible extraerlo.
Imagina un proceso que se ejecutó desde /tmp/exec y luego fue eliminado. Es posible extraerlo.
```bash
cd /proc/3746/ #PID with the exec file deleted
head -1 maps #Get address of the file. It was 08048000-08049000
@ -196,16 +196,42 @@ cat /var/spool/cron/crontabs/* \
#MacOS
ls -l /usr/lib/cron/tabs/ /Library/LaunchAgents/ /Library/LaunchDaemons/ ~/Library/LaunchAgents/
```
#### Caza: abuso de Cron/Anacron a través de 0anacron y stubs sospechosos
Los atacantes a menudo editan el stub 0anacron presente en cada directorio /etc/cron.*/ para asegurar la ejecución periódica.
```bash
# List 0anacron files and their timestamps/sizes
for d in /etc/cron.*; do [ -f "$d/0anacron" ] && stat -c '%n %y %s' "$d/0anacron"; done
# Look for obvious execution of shells or downloaders embedded in cron stubs
grep -R --line-number -E 'curl|wget|/bin/sh|python|bash -c' /etc/cron.*/* 2>/dev/null
```
#### Hunt: Endurecimiento de SSH, retroceso y shells de puerta trasera
Los cambios en sshd_config y en los shells de cuentas del sistema son comunes después de la explotación para preservar el acceso.
```bash
# Root login enablement (flag "yes" or lax values)
grep -E '^\s*PermitRootLogin' /etc/ssh/sshd_config
# System accounts with interactive shells (e.g., games → /bin/sh)
awk -F: '($7 ~ /bin\/(sh|bash|zsh)/ && $1 ~ /^(games|lp|sync|shutdown|halt|mail|operator)$/) {print}' /etc/passwd
```
#### Hunt: Marcadores de C2 en la nube (Dropbox/Cloudflare Tunnel)
- Las balizas de la API de Dropbox típicamente utilizan api.dropboxapi.com o content.dropboxapi.com a través de HTTPS con tokens de autorización: Bearer.
- Busca en proxy/Zeek/NetFlow por egresos inesperados de Dropbox desde servidores.
- Cloudflare Tunnel (`cloudflared`) proporciona C2 de respaldo a través de 443 saliente.
```bash
ps aux | grep -E '[c]loudflared|trycloudflare'
systemctl list-units | grep -i cloudflared
```
### Servicios
Rutas donde un malware podría instalarse como un servicio:
Rutas donde un malware podría ser instalado como un servicio:
- **/etc/inittab**: Llama a scripts de inicialización como rc.sysinit, dirigiendo posteriormente a scripts de inicio.
- **/etc/rc.d/** y **/etc/rc.boot/**: Contienen scripts para el inicio de servicios, siendo este último encontrado en versiones más antiguas de Linux.
- **/etc/init.d/**: Usado en ciertas versiones de Linux como Debian para almacenar scripts de inicio.
- Los servicios también pueden ser activados a través de **/etc/inetd.conf** o **/etc/xinetd/**, dependiendo de la variante de Linux.
- **/etc/systemd/system**: Un directorio para scripts del gestor de sistema y servicios.
- **/etc/systemd/system/multi-user.target.wants/**: Contiene enlaces a servicios que deben iniciarse en un nivel de ejecución multiusuario.
- **/etc/systemd/system/multi-user.target.wants/**: Contiene enlaces a servicios que deben ser iniciados en un nivel de ejecución multiusuario.
- **/usr/local/etc/rc.d/**: Para servicios personalizados o de terceros.
- **\~/.config/autostart/**: Para aplicaciones de inicio automático específicas del usuario, que pueden ser un escondite para malware dirigido a usuarios.
- **/lib/systemd/system/**: Archivos de unidad predeterminados a nivel de sistema proporcionados por paquetes instalados.
@ -220,7 +246,7 @@ Los módulos del kernel de Linux, a menudo utilizados por malware como component
### Otras Ubicaciones de Autoinicio
Linux emplea varios archivos para ejecutar automáticamente programas al iniciar sesión del usuario, potencialmente albergando malware:
Linux emplea varios archivos para ejecutar automáticamente programas al iniciar sesión el usuario, potencialmente albergando malware:
- **/etc/profile.d/**\*, **/etc/profile**, y **/etc/bash.bashrc**: Se ejecutan para cualquier inicio de sesión de usuario.
- **\~/.bashrc**, **\~/.bash_profile**, **\~/.profile**, y **\~/.config/autostart**: Archivos específicos del usuario que se ejecutan al iniciar sesión.
@ -246,8 +272,8 @@ Los sistemas Linux rastrean las actividades de los usuarios y los eventos del si
- **/var/log/xferlog**: Registra transferencias de archivos FTP.
- **/var/log/**: Siempre verifica si hay registros inesperados aquí.
> [!NOTE]
> Los registros del sistema Linux y los subsistemas de auditoría pueden estar deshabilitados o eliminados en un incidente de intrusión o malware. Debido a que los registros en los sistemas Linux generalmente contienen información muy útil sobre actividades maliciosas, los intrusos los eliminan rutinariamente. Por lo tanto, al examinar los archivos de registro disponibles, es importante buscar brechas o entradas fuera de orden que puedan ser una indicación de eliminación o manipulación.
> [!TIP]
> Los registros del sistema Linux y los subsistemas de auditoría pueden ser deshabilitados o eliminados en un incidente de intrusión o malware. Debido a que los registros en los sistemas Linux generalmente contienen alguna de la información más útil sobre actividades maliciosas, los intrusos los eliminan rutinariamente. Por lo tanto, al examinar los archivos de registro disponibles, es importante buscar brechas o entradas fuera de orden que puedan ser una indicación de eliminación o manipulación.
**Linux mantiene un historial de comandos para cada usuario**, almacenado en:
@ -261,28 +287,28 @@ Además, el comando `last -Faiwx` proporciona una lista de inicios de sesión de
Verifica archivos que pueden otorgar privilegios adicionales:
- Revisa `/etc/sudoers` en busca de privilegios de usuario no anticipados que puedan haberse otorgado.
- Revisa `/etc/sudoers.d/` en busca de privilegios de usuario no anticipados que puedan haberse otorgado.
- Revisa `/etc/sudoers` en busca de privilegios de usuario no anticipados que puedan haber sido otorgados.
- Revisa `/etc/sudoers.d/` en busca de privilegios de usuario no anticipados que puedan haber sido otorgados.
- Examina `/etc/groups` para identificar cualquier membresía o permisos de grupo inusuales.
- Examina `/etc/passwd` para identificar cualquier membresía o permisos de grupo inusuales.
Algunas aplicaciones también generan sus propios registros:
- **SSH**: Examina _\~/.ssh/authorized_keys_ y _\~/.ssh/known_hosts_ en busca de conexiones remotas no autorizadas.
- **Gnome Desktop**: Revisa _\~/.recently-used.xbel_ en busca de archivos accedidos recientemente a través de aplicaciones de Gnome.
- **Firefox/Chrome**: Verifica el historial del navegador y las descargas en _\~/.mozilla/firefox_ o _\~/.config/google-chrome_ en busca de actividades sospechosas.
- **SSH**: Examina _\~/.ssh/authorized_keys_ y _\~/.ssh/known_hosts_ para conexiones remotas no autorizadas.
- **Gnome Desktop**: Revisa _\~/.recently-used.xbel_ para archivos accedidos recientemente a través de aplicaciones de Gnome.
- **Firefox/Chrome**: Verifica el historial del navegador y las descargas en _\~/.mozilla/firefox_ o _\~/.config/google-chrome_ para actividades sospechosas.
- **VIM**: Revisa _\~/.viminfo_ para detalles de uso, como rutas de archivos accedidos e historial de búsqueda.
- **Open Office**: Verifica el acceso reciente a documentos que pueda indicar archivos comprometidos.
- **FTP/SFTP**: Revisa los registros en _\~/.ftp_history_ o _\~/.sftp_history_ en busca de transferencias de archivos que puedan ser no autorizadas.
- **MySQL**: Investiga _\~/.mysql_history_ en busca de consultas MySQL ejecutadas, que podrían revelar actividades no autorizadas en la base de datos.
- **Less**: Analiza _\~/.lesshst_ en busca de historial de uso, incluidos archivos vistos y comandos ejecutados.
- **Git**: Examina _\~/.gitconfig_ y el proyecto _.git/logs_ en busca de cambios en los repositorios.
- **Open Office**: Verifica el acceso a documentos recientes que puedan indicar archivos comprometidos.
- **FTP/SFTP**: Revisa registros en _\~/.ftp_history_ o _\~/.sftp_history_ para transferencias de archivos que podrían no estar autorizadas.
- **MySQL**: Investiga _\~/.mysql_history_ para consultas de MySQL ejecutadas, que podrían revelar actividades no autorizadas en la base de datos.
- **Less**: Analiza _\~/.lesshst_ para el historial de uso, incluidos archivos vistos y comandos ejecutados.
- **Git**: Examina _\~/.gitconfig_ y el proyecto _.git/logs_ para cambios en los repositorios.
### Registros USB
[**usbrip**](https://github.com/snovvcrash/usbrip) es un pequeño software escrito en Python 3 puro que analiza archivos de registro de Linux (`/var/log/syslog*` o `/var/log/messages*` dependiendo de la distribución) para construir tablas de historial de eventos USB.
Es interesante **conocer todos los USB que se han utilizado** y será más útil si tienes una lista autorizada de USB para encontrar "eventos de violación" (el uso de USB que no están dentro de esa lista).
Es interesante **conocer todos los USB que han sido utilizados** y será más útil si tienes una lista autorizada de USB para encontrar "eventos de violación" (el uso de USB que no están dentro de esa lista).
### Instalación
```bash
@ -303,7 +329,7 @@ Más ejemplos e información dentro del github: [https://github.com/snovvcrash/u
Examine el _**/etc/passwd**_, _**/etc/shadow**_ y **registros de seguridad** en busca de nombres inusuales o cuentas creadas y/o utilizadas en estrecha proximidad a eventos no autorizados conocidos. Además, verifique posibles ataques de fuerza bruta a sudo.\
Además, revise archivos como _**/etc/sudoers**_ y _**/etc/groups**_ en busca de privilegios inesperados otorgados a los usuarios.\
Finalmente, busque cuentas con **sin contraseñas** o contraseñas **fácilmente adivinables**.
Finalmente, busque cuentas con **sin contraseñas** o **contraseñas fácilmente adivinables**.
## Examinar el Sistema de Archivos
@ -328,20 +354,20 @@ ls -laR --sort=time /bin```
# Sort files in a directory by inode:
ls -lai /bin | sort -n```
````
> [!NOTE]
> Tenga en cuenta que un **atacante** puede **modificar** el **tiempo** para hacer que los **archivos aparezcan** **legítimos**, pero no **puede** modificar el **inode**. Si encuentra que un **archivo** indica que fue creado y modificado al **mismo tiempo** que el resto de los archivos en la misma carpeta, pero el **inode** es **inesperadamente más grande**, entonces los **timestamps de ese archivo fueron modificados**.
> [!TIP]
> Tenga en cuenta que un **atacante** puede **modificar** la **hora** para hacer que los **archivos aparezcan** **legítimos**, pero **no puede** modificar el **inode**. Si encuentra que un **archivo** indica que fue creado y modificado a la **misma hora** que el resto de los archivos en la misma carpeta, pero el **inode** es **inesperadamente más grande**, entonces los **timestamps de ese archivo fueron modificados**.
## Comparar archivos de diferentes versiones del sistema de archivos
### Resumen de comparación de versiones del sistema de archivos
Para comparar versiones del sistema de archivos y señalar cambios, usamos comandos simplificados de `git diff`:
Para comparar versiones del sistema de archivos y señalar cambios, utilizamos comandos simplificados de `git diff`:
- **Para encontrar nuevos archivos**, compare dos directorios:
```bash
git diff --no-index --diff-filter=A path/to/old_version/ path/to/new_version/
```
- **Para contenido modificado**, enumere los cambios ignorando líneas específicas:
- **Para contenido modificado**, enumera los cambios ignorando líneas específicas:
```bash
git diff --no-index --diff-filter=M path/to/old_version/ path/to/new_version/ | grep -E "^\+" | grep -v "Installed-Time"
```
@ -367,4 +393,6 @@ git diff --no-index --diff-filter=D path/to/old_version/ path/to/new_version/
- [https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203](https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---diff-filterACDMRTUXB82308203)
- **Libro: Malware Forensics Field Guide for Linux Systems: Digital Forensics Field Guides**
- [Red Canary Patching for persistence: How DripDropper Linux malware moves through the cloud](https://redcanary.com/blog/threat-intelligence/dripdropper-linux-malware/)
{{#include ../../banners/hacktricks-training.md}}