File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
linPEAS/builder/linpeas_parts Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1616if [ " $is_aws_ec2 " = " Yes" ]; then
1717 print_2title " AWS EC2 Enumeration"
1818
19- HEADER=" X-aws-ec2-metadata-token: "
19+ TOKEN=" "
20+ TOKEN_HEADER=" X-aws-ec2-metadata-token"
21+ TOKEN_TTL=" X-aws-ec2-metadata-token-ttl-seconds: 21600"
2022 URL=" http://169.254.169.254/latest/meta-data"
2123
2224 aws_req=" "
2325 if [ " $( command -v curl || echo -n ' ' ) " ]; then
24- aws_req=" curl -s -f -L -H '$HEADER '"
26+ # Get token for IMDSv2
27+ TOKEN=$( curl -s -f -X PUT " http://169.254.169.254/latest/api/token" -H " $TOKEN_TTL " 2> /dev/null)
28+ aws_req=" curl -s -f -L -H '$TOKEN_HEADER : $TOKEN '"
2529 elif [ " $( command -v wget || echo -n ' ' ) " ]; then
26- aws_req=" wget -q -O - --header '$HEADER '"
30+ # Get token for IMDSv2
31+ TOKEN=$( wget -q -O - --method=PUT --header=" $TOKEN_TTL " " http://169.254.169.254/latest/api/token" 2> /dev/null)
32+ aws_req=" wget -q -O - --header '$TOKEN_HEADER : $TOKEN '"
2733 else
2834 echo " Neither curl nor wget were found, I can't enumerate the metadata service :("
2935 fi
Original file line number Diff line number Diff line change @@ -31,13 +31,10 @@ execBin() {
3131
3232 # ---------------- 120‑second wall‑clock timeout ----------------
3333 if command -v timeout > /dev/null 2>&1 ; then # GNU/BSD timeout
34- print_info " Running $TOOL_NAME with 120s timeout"
3534 timeout --preserve-status -s 9 120 " $TMP_BIN " $PARAMS
3635 elif command -v gtimeout > /dev/null 2>&1 ; then # Homebrew coreutils (macOS)
37- print_info " Running $TOOL_NAME with 120s gtimeout"
38- gtimeout --preserve-status 120 " $TMP_BIN " $PARAMS
36+ gtimeout --preserve-status -s 9 120 " $TMP_BIN " $PARAMS
3937 else # POSIX fall‑back
40- print_info " Running $TOOL_NAME with 120s custom timeout"
4138 (
4239 " $TMP_BIN " $PARAMS & # run in background
4340 cmdpid=$!
You can’t perform that action at this time.
0 commit comments