diff --git a/.github/workflows/build_master.yml b/.github/workflows/build_master.yml index 4fc4ace84..f936d8a88 100644 --- a/.github/workflows/build_master.yml +++ b/.github/workflows/build_master.yml @@ -50,7 +50,7 @@ jobs: # Build the mdBook - name: Build mdBook - run: MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + run: MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Cat hacktricks-preprocessor.log #- name: Cat hacktricks-preprocessor.log diff --git a/.github/workflows/translate_af.yml b/.github/workflows/translate_af.yml index 19c3044fb..da1c8d92a 100644 --- a/.github/workflows/translate_af.yml +++ b/.github/workflows/translate_af.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_de.yml b/.github/workflows/translate_de.yml index 06fcb57b4..93b3a4ad8 100644 --- a/.github/workflows/translate_de.yml +++ b/.github/workflows/translate_de.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_el.yml b/.github/workflows/translate_el.yml index 08ce93811..2a97877e4 100644 --- a/.github/workflows/translate_el.yml +++ b/.github/workflows/translate_el.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_es.yml b/.github/workflows/translate_es.yml index 384ee3178..fe9a6bfc9 100644 --- a/.github/workflows/translate_es.yml +++ b/.github/workflows/translate_es.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_fr.yml b/.github/workflows/translate_fr.yml index 9d0ab4a10..9f28308e8 100644 --- a/.github/workflows/translate_fr.yml +++ b/.github/workflows/translate_fr.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_hi.yml b/.github/workflows/translate_hi.yml index bd989303f..9e567a8fa 100644 --- a/.github/workflows/translate_hi.yml +++ b/.github/workflows/translate_hi.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_it.yml b/.github/workflows/translate_it.yml index 9073745bd..94c244feb 100644 --- a/.github/workflows/translate_it.yml +++ b/.github/workflows/translate_it.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_ja.yml b/.github/workflows/translate_ja.yml index 84e487fb8..25c9e96f2 100644 --- a/.github/workflows/translate_ja.yml +++ b/.github/workflows/translate_ja.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_ko.yml b/.github/workflows/translate_ko.yml index d83fd3785..9b42c7ecc 100644 --- a/.github/workflows/translate_ko.yml +++ b/.github/workflows/translate_ko.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_pl.yml b/.github/workflows/translate_pl.yml index 8834cfca7..1af70c170 100644 --- a/.github/workflows/translate_pl.yml +++ b/.github/workflows/translate_pl.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_pt.yml b/.github/workflows/translate_pt.yml index 78f454f36..7472a35fa 100644 --- a/.github/workflows/translate_pt.yml +++ b/.github/workflows/translate_pt.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_sr.yml b/.github/workflows/translate_sr.yml index 1ba533556..5085afea5 100644 --- a/.github/workflows/translate_sr.yml +++ b/.github/workflows/translate_sr.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_sw.yml b/.github/workflows/translate_sw.yml index e1459dca1..6f27b4876 100644 --- a/.github/workflows/translate_sw.yml +++ b/.github/workflows/translate_sw.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_tr.yml b/.github/workflows/translate_tr.yml index 45f8a5449..12c2972fc 100644 --- a/.github/workflows/translate_tr.yml +++ b/.github/workflows/translate_tr.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_uk.yml b/.github/workflows/translate_uk.yml index d9decd685..8f1a1d9e7 100644 --- a/.github/workflows/translate_uk.yml +++ b/.github/workflows/translate_uk.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/.github/workflows/translate_zh.yml b/.github/workflows/translate_zh.yml index 9d0cc05aa..725fff02e 100644 --- a/.github/workflows/translate_zh.yml +++ b/.github/workflows/translate_zh.yml @@ -61,16 +61,9 @@ jobs: done python scripts/translator.py --language "$LANGUAGE" --branch "$BRANCH" --api-key "$OPENAI_API_KEY" -f "$(cat /tmp/file_paths.txt)" -t 3 - - name: Commit and push changes - run: | - git checkout $BRANCH - git add -A - git commit -m "Translated $LANGUAGE files" || true - git push --set-upstream origin $BRANCH - - name: Build mdBook run: | - MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (cat hacktricks-preprocessor-error.log && exit 1) + MDBOOK_BOOK__LANGUAGE=$BRANCH mdbook build || (echo "Error logs" && cat hacktricks-preprocessor-error.log && exit 1) # Login in AWs - name: Configure AWS credentials using OIDC diff --git a/hacktricks-preprocessor.py b/hacktricks-preprocessor.py index af5949449..f07acbcdf 100644 --- a/hacktricks-preprocessor.py +++ b/hacktricks-preprocessor.py @@ -46,8 +46,8 @@ def ref(matchobj): match = re.search('(.*?)', raw_html) title = match.group(1) if match else href except Exception as e: - logger.debug(f'Error opening URL {href}: {e}') - pass #nDont stop on broken link + logger.error(f'Error opening URL {href}: {e}') + pass #Dont stop on broken link else: try: if href.endswith("/"): @@ -73,7 +73,7 @@ def ref(matchobj): title = chapter["name"] logger.debug(f'Recursive title search result: {chapter["name"]}') except Exception as e: - logger.debug(e) + logger.error(f"Error: {e}") logger.error(f'Error getting chapter title: {path.normpath(path.join(dir,href))}') sys.exit(1) @@ -101,7 +101,7 @@ def files(matchobj): logger.debug(f'File search result: {os.path.join(root, href)}') except Exception as e: - logger.debug(e) + logger.error(f"Error: {e}") logger.error(f'Error searching file: {href}') sys.exit(1) diff --git a/scripts/translator.py b/scripts/translator.py index 74762086a..323ea7f5d 100644 --- a/scripts/translator.py +++ b/scripts/translator.py @@ -78,14 +78,15 @@ def cp_translation_to_repo_dir_and_check_gh_branch(branch, temp_folder, translat for file_name in filenames: src_file = os.path.join(dirpath, file_name) shutil.copy2(src_file, dest_path) + print(f"[+] Copied from {src_file} to {file_name}") print(f"Translated files copied to branch: {branch}") if translate_files: subprocess.run(['git', 'add', "-A"]) subprocess.run(['git', 'commit', '-m', f"Translated {translate_files} to {branch}"[:72]]) - subprocess.run(['git', 'checkout', MASTER_BRANCH]) - print("Commit created and moved to master branch") + subprocess.run(['git', 'push', '--set-upstream', 'origin', branch]) + print("Commit created and pushed") else: print("No commiting anything, leaving in language branch") @@ -202,7 +203,6 @@ def split_text(text, model): continue - if (line.startswith('#') and reportTokens(chunk + "\n" + line.strip(), model) > MAX_TOKENS*0.8) or \ reportTokens(chunk + "\n" + line.strip(), model) > MAX_TOKENS: @@ -255,7 +255,7 @@ def translate_file(language, file_path, file_dest_path, model, client): translated_content = '' start_time = time.time() for chunk in content_chunks: - # Don't trasnlate code blocks + # Don't translate code blocks if chunk.startswith('```'): translated_content += chunk + '\n' else: @@ -269,9 +269,10 @@ def translate_file(language, file_path, file_dest_path, model, client): f.write(translated_content) #if VERBOSE: - print(f"Page {file_path} translated in {elapsed_time:.2f} seconds") + print(f"Page {file_path} translated in {file_dest_path} in {elapsed_time:.2f} seconds") +""" def translate_directory(language, source_path, dest_path, model, num_threads, client): all_markdown_files = [] for subdir, dirs, files in os.walk(source_path): @@ -301,13 +302,13 @@ def translate_directory(language, source_path, dest_path, model, num_threads, cl tb = traceback.format_exc() print(f'Translation generated an exception: {exc}') print("Traceback:", tb) - +""" if __name__ == "__main__": print("- Version 2.0.0") # Set up argparse parser = argparse.ArgumentParser(description='Translate gitbook and copy to a new branch.') - parser.add_argument('-d', '--directory', action='store_true', help='Translate a full directory.') + #parser.add_argument('-d', '--directory', action='store_true', help='Translate a full directory.') parser.add_argument('-l', '--language', required=True, help='Target language for translation.') parser.add_argument('-b', '--branch', required=True, help='Branch name to copy translated files.') parser.add_argument('-k', '--api-key', required=True, help='API key to use.') @@ -384,17 +385,14 @@ def translate_directory(language, source_path, dest_path, model, num_threads, cl # Delete possibly removed files from the master branch delete_unique_files(branch) - elif args.directory: + #elif args.directory: # Translate everything - translate_directory(language, source_folder, dest_folder, model, num_threads, client) + #translate_directory(language, source_folder, dest_folder, model, num_threads, client) else: print("You need to indicate either a directory or a list of files to translate.") exit(0) - # Copy translated files - move_files_to_push(source_folder, dest_folder, translate_files) - # Copy Summary copy_files(source_folder, dest_folder) diff --git a/src/pentesting-cloud/azure-security/az-permissions-for-a-pentest.md b/src/pentesting-cloud/azure-security/az-permissions-for-a-pentest.md index 5ab73efd8..6225d109c 100644 --- a/src/pentesting-cloud/azure-security/az-permissions-for-a-pentest.md +++ b/src/pentesting-cloud/azure-security/az-permissions-for-a-pentest.md @@ -5,4 +5,3 @@ To start the tests you should have access with a user with **Reader permissions over the subscription** and **Global Reader role in AzureAD**. If even in that case you are **not able to access the content of the Storage accounts** you can fix it with the **role Storage Account Contributor**. {{#include ../../banners/hacktricks-training.md}} -