Scripts & Codes pentester
  • Stronger Encryption and Decryption in Node.js
  • recon.sh
  • encode_decode.py
  • les.sh
  • suid.sh
  • basicforensiclinuxscript.sh
  • winrmrecon.py
  • WPAnalytics.php
  • Power Recon
  • Reverse Shells
  • cvemap_wrapper.ps1
  • wfuzz_crack_form_login.sh
Powered by GitBook
On this page
  • Define a function to test SUID files
  • Check if the file exists and is executable
  • Find all SUID files on the system
  • Loop through each SUID file and test it

suid.sh

#!/bin/bash

Define a function to test SUID files

test_suid() { local file="$1" local result

Check if the file exists and is executable

if [ -x "$file" ]; then # Attempt to execute the file if [ -n "$(timeout 2 ./"$file" 2>&1)" ]; then result="Vulnerable" else result="Not Vulnerable" fi else result="Not Executable" fi

echo "$file: $result" }

Find all SUID files on the system

suid_files=$(find / -type f -perm /4000)

Loop through each SUID file and test it

for file in $suid_files; do test_suid "$file" done

Previousles.shNextbasicforensiclinuxscript.sh

Last updated 1 year ago