Skip to content

Instantly share code, notes, and snippets.

@dbuentello
Created September 16, 2017 23:17
Show Gist options
  • Save dbuentello/8addde1dfc835165f2728a7362be0843 to your computer and use it in GitHub Desktop.
Save dbuentello/8addde1dfc835165f2728a7362be0843 to your computer and use it in GitHub Desktop.
Uninstall nmap from osx installed via dmg
#!/bin/sh
receipts() {
find /private/var/db/receipts -iregex '.*/org\.insecure\.nmap.*'
}
bom_files() {
receipts | grep '\.bom$'
}
boms_list_files_installed() {
bom_files | while read -r BOM; do
lsbom -s "$BOM"
done | sed 's/^\.//g;s%/Zenmap.app%/Applications&%g;/^$/d'
}
{ receipts ; boms_list_files_installed ;} | while read -r FILENAME; do
if [ -f "$FILENAME" ]; then
echo "$FILENAME"
fi
done | sudo xargs -L1 rm -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment