Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Secure home pc & and server
- //This script is about getting everything secure.
- //dbust loading dir.Store it in dbuslist.
- dbustlist = []
- getFiles = function(x)
- files = x.get_files;
- if files.len > 0 then
- for i in range(0,files.len -1)
- globals.dbustlist.push(files);
- end for
- end if
- return;
- end function
- dirBust = function(x)
- folders = x.get_folders
- if folders.len > 0 then
- for i in range(0,folders.len -1)
- globals.dbustlist.push(folders[i]);
- getFiles(folders[i]);
- dirBust(folders[i]);
- end for
- else
- getFiles(x);
- end if
- return;
- end function
- //Secure chmod everyfile found.
- secureFiles = function(x)
- usershash = get_shell.host_computer.File("/etc/passwd").get_content.split(char(10));
- users = [];
- for i in range(0,usershash.len -1)
- if usershash[i] != "" then
- users.push(usershash[i].split(char(58))[0]);
- end if
- end for
- isValid = false
- for i in range(0,users.len -1)
- if x.owner == users[i] then
- isValid = true;
- end if
- end for
- if isValid == true then
- if x.owner == "root" then
- // [user]r-x [guest]--x [other]---
- // Those file are owned by the system and mostly are system files.
- // Minimal access to it users can execute root owned like /bin/program.
- // Users cannot read or write any owned system files.
- x.chmod("u+rx");
- x.chmod("u-w");
- x.chmod("g-rw");
- x.chmod("g+x");
- else
- // [user]rwx [guest]--x [other]---
- // Users have full rights on their content.Therefore a user cannot have access to
- // its parent in term of r or w.As a child he can only execute what parent provided him
- // or its own content.
- x.chmod("u+wrx");
- x.chmod("g-rw");
- x.chmod("g+x");
- end if
- else
- //Those files have no actual owner that belongs to the server users /etc/passwd.
- //But they still registered.Those files are considered malicious.They are blocked.
- //As no user are owning thoses files, then no one have right on it.Root have right but dont own him.
- //Users may have no right but dont own him.
- x.chmod("u-wrx");
- x.chmod("g-wrx");
- end if
- x.chmod("o-wrx");
- end function
- dirBust(get_shell.host_computer.File("/"));
- //Here i have to manually chmod / never forget to chmod
- //this folder.In my disclosure, i could download many server
- //with only guest permission and scripting shell exploit.
- get_shell.host_computer.File("/").chmod("u-wrx");
- get_shell.host_computer.File("/").chmod("g-wrx");
- get_shell.host_computer.File("/").chmod("o-wrx");
- for i in range(0,dbustlist.len -1)
- if typeof(dbustlist[i]) == "file" then
- secureFiles(dbustlist[i]);
- end if
- end for
- //Note:Run the script as root as its an admistration script.If not its scope will be limited to its user level.
Add Comment
Please, Sign In to add comment