Last active
August 21, 2018 21:44
-
-
Save l50/0b71356292f2955edb33b8df42ed5c46 to your computer and use it in GitHub Desktop.
Toolkit for evaluating potential vulnerabilities in open NFS mounts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Print NFS mounts associated with a list of systems | |
# Usage: print_mounts.py | tee mounts.txt | |
import subprocess | |
def return_list(file): | |
with open(file) as f: | |
list = f.readlines() | |
return list | |
def run_cmd(cmd): | |
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True) | |
(output, err) = p.communicate() | |
p_status = p.wait() | |
return output.decode('utf-8') | |
def print_mounts(target): | |
print(target) | |
print(run_cmd("showmount -e " + target)) | |
targets = return_list('systems.txt') | |
for target in targets: | |
print_mounts(target) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
system1 | |
system2 | |
system3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment