OpenAI and Trickest: The AI-Powered Duo Breaking Language Barriers
Explore how OpenAI and Trickest synergize to translate HackTricks content into multiple languages, pioneering AI-powered multilingual expansion.
In the wake of groundbreaking AI innovations spreading over IT industries worldwide, the Trickest community has been buzzing with curiosity and brainstorming about the potential integration of AI within the Trickest portfolio.
In a recent project, I decided to leverage the power of OpenAI and the impressive speed, reliability, and user-friendly nature of Trickest to broaden the accessibility of HackTricks. With their synergy, I succeeded in translating the entire content of HackTricks to Spanish, French, and Portuguese in just about 10 hours for each language. These translated versions are now fully accessible on HackTricks.
Orchestrating the Translation
A custom Python script - translator.py was the one using the power of OpenAI's comprehensive language model for accurate and efficient translations.
OpenAI empowers developers to seamlessly integrate AI capabilities into their applications. The gpt-3.5-turbo
model, built on the acclaimed GPT architecture, was the one I chose for this project. Known for its prowess in interpreting and generating text that closely mirrors human language, it was the perfect fit for translation tasks.
However, it's important to mention that I initially intended to use gpt-4
. Due to its slow API and getaway timeout for long requests, which produced a Python timeout error after 10 minutes when asked to translate more than 1000 words at once, I went for gpt-3.5-turbo
. I completed the task in just about one and a half minutes, as opposed to gpt-4
.
Using the Power of Trickest Nodes in Workflow Builder
Using nodes in the Workflow Builder played a significant role in my translation project. Instead of using my personal computer or a cloud machine, I chose to run the script within a node on a custom build Trickest workflow.
I selected Trickest because of its speed and reliability. The setup was straightforward, facilitating the easy running of the translator script in a node with a single button click to trigger the workflow. The entire translation process was executed in approximately 30 hours. This would have been a challenging task on a local machine prone to frequent suspensions.
Let's take a look at one of the simplest Trickest workflows I've ever created:
In the workflow, the first node will specify the languages and the branch names for translation. This is managed by the following script:
echo -e -n "Spanish es\nFrench fr\nPortuguese pt" | tee out/output.txt
The three nodes next to the right are aimed to individualize the languages and branch names. This enables me to perform tasks in parallel. In this scenario, however, I chose to run a distinct node for each translation process to avoid overwhelming the OpenAI API. Each translation took approximately 10 hours, and since Trickest imposes a maximum node lifespan of 24 hours, attempting three translations in the same node would exceed this limit.
Finally, this is the script used for translating HackTricks into new languages:
apt-get update >/dev/null
apt-get install wget python3 python3-pip -y >/dev/null
python3 -m pip install openai tqdm >/dev/null
translate(){
language=$1
branch=$2
echo "[+] Translating to $language"
# Download hacktricks
git clone https://<gh_token>@github.com/carlospolop/hacktricks
# Download translator
cd hacktricks
mkdir scripts
cd scripts
wget https://raw.githubusercontent.com/carlospolop/hacktricks-cloud/master/scripts/translator.py
cd ..
# Translate
python3 scripts/translator.py --language $language --branch $branch --api-key <api-key> --model gpt-3.5-turbo --org-id <org-id> -t 5
echo "[+] Translated to $language"
rm -rf scripts
# Configure github and push
git config --global user.name "Translator workflow"
git config --global user.email "translator@trickest.io"
git add .
git commit -m "Translated to $language"
git push --set-upstream origin $branch
echo "[+] Pushed"
cd ..
rm -rf hacktricks
}
echo "[+] Params:"
cat in/batch-output-1/output.txt
language=$(cat in/batch-output-1/output.txt | cut -d " " -f1)
branch=$(cat in/batch-output-1/output.txt | cut -d " " -f2)
translate "$language" "$branch"
The End Result
With the help of my custom Trickest workflow, here's how users can now change languages in HackTricks.
In Conclusion
This ambitious undertaking of translating HackTricks into multiple languages has showcased the incredible potential of synergy between OpenAI and Trickest.
The synergy has truly underlined the powerful impact that advanced language models can have on breaking language barriers and promoting information accessibility. Moreover, Trickest's robust and user-friendly platform has significantly streamlined the translation process, highlighting how it can revolutionize complex projects. Sign up to access Trickest to make your own AI-powered workflow.
Get a PERSONALIZED DEMO
See Trickest
in Action
Gain visibility, elite security, and complete coverage with Trickest Platform and Solutions.