Exemplo n.º 1
0
 def do_sessions(self, inp, gui=False):
     if "load" in inp:
         b = varis.targets
         om = varis.module
         varis.targets = []
         victims = []
         #for i in varis.targets:
         #    varis.targets.remove(i)
         session = inp.split("load")[1].strip()
         if session == "":
             print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" +
                   "Syntax: sessions [load|save <SESS_ID>] [list]")
             varis.targets = b
         else:
             try:
                 if ".val" in session or "--val" in session:
                     session = session.replace("--val", "").strip()
                     #print(session)
                     victims = self.sessionhelper(session, gui)
                     print(G +
                           " [+] Restored VAL session: {}".format(session) +
                           C + color.TR2 + C)
                     if om != "":
                         self.do_load(om)
                 else:
                     load(session)
                     print(G +
                           " [+] Restored session: {}.".format(session) +
                           C + color.TR2 + C)
             except FileNotFoundError:
                 print(R + " [-] " + "\033[0m" + color.UNDERLINE +
                       "\033[1m" +
                       "{}: no such session file.".format(session))
                 varis.targets = b
     elif "save" in inp:
         session = inp.split("save")[1].strip()
         if session == "":
             print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" +
                   "Syntax: sessions [load|save <SESS_ID>] [list]")
         else:
             if ".val" in session or "--val" in inp:
                 session = session.replace("--val", "").strip()
                 modlist = select.list("all", False)
                 createVal(varis.targets, modlist, session)
             else:
                 save(session)
     elif "list" in inp:
         os.system("{} core/sessioncache".format(varis.CMD_LS))
     else:
         print(R + " [-] " + "\033[0m" + color.UNDERLINE + "\033[1m" +
               "Syntax: sessions [load|save <SESS_ID>] [list]")
     if gui:
         return victims
Exemplo n.º 2
0
 def do_list(self, inp):
     select.list(inp, True)