Skip to content

Commit 1a85614

Browse files
authored
Merge branch 'HackTricks-wiki:master' into master
2 parents e4e6a40 + 47c4cdb commit 1a85614

4 files changed

Lines changed: 64 additions & 12 deletions

File tree

.github/workflows/build_master.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,28 @@ jobs:
8888
RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
8989
echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
9090
91-
# Copy ONLY the .gz version to the searchindex repo (no uncompressed .js)
91+
# XOR encrypt the compressed file
92+
KEY='Prevent_Online_AVs_From_Flagging_HackTricks_Search_Gzip_As_Malicious_394h7gt8rf9u3rf9g'
93+
cat > /tmp/xor_encrypt.py << 'EOF'
94+
import sys
95+
key = sys.argv[1]
96+
input_file = sys.argv[2]
97+
output_file = sys.argv[3]
98+
with open(input_file, 'rb') as f:
99+
data = f.read()
100+
key_bytes = key.encode('utf-8')
101+
encrypted = bytearray(len(data))
102+
for i in range(len(data)):
103+
encrypted[i] = data[i] ^ key_bytes[i % len(key_bytes)]
104+
with open(output_file, 'wb') as f:
105+
f.write(encrypted)
106+
print(f"Encrypted: {len(data)} bytes")
107+
EOF
108+
python3 /tmp/xor_encrypt.py "$KEY" "${ASSET}.gz" "${ASSET}.gz.enc"
109+
110+
# Copy ONLY the encrypted .gz version to the searchindex repo (no uncompressed .js)
92111
cd /tmp/searchindex-repo
93-
cp "${GITHUB_WORKSPACE}/${ASSET}.gz" "${FILENAME}.gz"
112+
cp "${GITHUB_WORKSPACE}/${ASSET}.gz.enc" "${FILENAME}.gz"
94113
95114
# Stage all files
96115
git add -A

.github/workflows/translate_all.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,27 @@ jobs:
184184
RATIO=$(awk "BEGIN {printf \"%.1f\", ($COMPRESSED_SIZE / $ORIGINAL_SIZE) * 100}")
185185
echo "Compression: ${ORIGINAL_SIZE} bytes -> ${COMPRESSED_SIZE} bytes (${RATIO}%)"
186186
187-
# Copy ONLY the .gz version to the searchindex repo (no uncompressed .js)
188-
cp "${ASSET}.gz" "/tmp/searchindex-repo/${FILENAME}.gz"
187+
# XOR encrypt the compressed file
188+
KEY='Prevent_Online_AVs_From_Flagging_HackTricks_Search_Gzip_As_Malicious_394h7gt8rf9u3rf9g'
189+
cat > /tmp/xor_encrypt.py << 'EOF'
190+
import sys
191+
key = sys.argv[1]
192+
input_file = sys.argv[2]
193+
output_file = sys.argv[3]
194+
with open(input_file, 'rb') as f:
195+
data = f.read()
196+
key_bytes = key.encode('utf-8')
197+
encrypted = bytearray(len(data))
198+
for i in range(len(data)):
199+
encrypted[i] = data[i] ^ key_bytes[i % len(key_bytes)]
200+
with open(output_file, 'wb') as f:
201+
f.write(encrypted)
202+
print(f"Encrypted: {len(data)} bytes")
203+
EOF
204+
python3 /tmp/xor_encrypt.py "$KEY" "${ASSET}.gz" "${ASSET}.gz.enc"
205+
206+
# Copy ONLY the encrypted .gz version to the searchindex repo (no uncompressed .js)
207+
cp "${ASSET}.gz.enc" "/tmp/searchindex-repo/${FILENAME}.gz"
189208
190209
# Commit and push with retry logic
191210
cd /tmp/searchindex-repo
@@ -224,8 +243,8 @@ jobs:
224243
git config user.name "GitHub Actions"
225244
git config user.email "github-actions@github.com"
226245
227-
# Re-copy ONLY the .gz version (no uncompressed .js)
228-
cp "${ASSET}.gz" "${FILENAME}.gz"
246+
# Re-copy ONLY the encrypted .gz version (no uncompressed .js)
247+
cp "${ASSET}.gz.enc" "${FILENAME}.gz"
229248
230249
git add "${FILENAME}.gz"
231250
git commit -m "Update ${FILENAME}.gz from hacktricks-cloud build"

src/pentesting-cloud/aws-security/aws-services/aws-sagemaker-enum/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ aws sagemaker list-jumpstart-script-resources --region $REGION
205205
## Unauthorized Access
206206

207207
{{#ref}}
208-
../aws-sagemaker-unauthenticated-enum/README.md
208+
../../aws-unauthenticated-enum-access/aws-sagemaker-unauthenticated-enum/README.md
209209
{{#endref}}
210210

211211
## References

theme/ht_searcher.js

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@
2121
try { importScripts('https://cdn.jsdelivr.net/npm/elasticlunr@0.9.5/elasticlunr.min.js'); }
2222
catch { importScripts(abs('/elasticlunr.min.js')); }
2323
24-
/* 2 — decompress gzip data */
24+
/* 2 — XOR decryption function */
25+
function xorDecrypt(encryptedData, key){
26+
const keyBytes = new TextEncoder().encode(key);
27+
const decrypted = new Uint8Array(encryptedData.length);
28+
for(let i = 0; i < encryptedData.length; i++){
29+
decrypted[i] = encryptedData[i] ^ keyBytes[i % keyBytes.length];
30+
}
31+
return decrypted.buffer;
32+
}
33+
34+
/* 3 — decompress gzip data */
2535
async function decompressGzip(arrayBuffer){
2636
if(typeof DecompressionStream !== 'undefined'){
2737
/* Modern browsers: use native DecompressionStream */
@@ -40,21 +50,25 @@
4050
}
4151
}
4252
43-
/* 3 — load a single index (remote → local) */
53+
/* 4 — load a single index (remote → local) */
4454
async function loadIndex(remote, local, isCloud=false){
55+
const XOR_KEY = "Prevent_Online_AVs_From_Flagging_HackTricks_Search_Gzip_As_Malicious_394h7gt8rf9u3rf9g";
4556
let rawLoaded = false;
4657
if(remote){
4758
/* Try ONLY compressed version from GitHub (remote already includes .js.gz) */
4859
try {
4960
const r = await fetch(remote,{mode:'cors'});
5061
if (r.ok) {
51-
const compressed = await r.arrayBuffer();
62+
const encryptedCompressed = await r.arrayBuffer();
63+
/* Decrypt first */
64+
const compressed = xorDecrypt(new Uint8Array(encryptedCompressed), XOR_KEY);
65+
/* Then decompress */
5266
const text = await decompressGzip(compressed);
5367
importScripts(URL.createObjectURL(new Blob([text],{type:'application/javascript'})));
5468
rawLoaded = true;
55-
console.log('Loaded compressed from GitHub:',remote);
69+
console.log('Loaded encrypted+compressed from GitHub:',remote);
5670
}
57-
} catch(e){ console.warn('compressed GitHub',remote,'failed →',e); }
71+
} catch(e){ console.warn('encrypted+compressed GitHub',remote,'failed →',e); }
5872
}
5973
/* If remote (GitHub) failed, fall back to local uncompressed file */
6074
if(!rawLoaded && local){

0 commit comments

Comments
 (0)