コード例 #1
0
ファイル: cli.py プロジェクト: xenoscr/ThunderShell
 def view_event(self, data):
     log_path = Utils.get_arg_at(data, 1, 2)
     if log_path == "":
         UI.error("Missing arguments")
         return 
 
     log_path += ".log"
     
     rows = Utils.get_arg_at(data, 2, 2)
     if rows == "":
         rows = 10
     else:
         try:
             rows = int(rows)
         except:
             rows = 10
             
     log_path = Log.get_current_path(log_path)
     
     data = []
     
     if Utils.file_exists(log_path):
         for line in open(log_path, "rb").readlines():
             data.append(line)
         
         print("\nLast %d lines of log\n----------------------\n" % rows)    
         data = list(data)
         
         for i in range(0, rows):
             try:
                 print data[i]
             except:
                 pass
コード例 #2
0
ファイル: cli.py プロジェクト: GuardaCyber/ThunderShell
 def view_event(self, data):
     log_path = Utils.get_arg_at(data, 1, 2)
     if log_path == "":
         UI.error("Missing arguments")
         return 
 
     log_path += ".log"
     
     rows = Utils.get_arg_at(data, 2, 2)
     if rows == "":
         rows = 10
     else:
         try:
             rows = int(rows)
         except:
             rows = 10
             
     log_path = Log.get_current_path(log_path)
     
     data = []
     
     if Utils.file_exists(log_path):
         for line in open(log_path, "rb").readlines():
             data.append(line)
         
         print "\nLast %d lines of log\n-----------------------\n" % rows    
         data = list(reversed(data))
         
         for i in range(0, rows):
             try:
                 print data[i]
             except:
                 pass
コード例 #3
0
ファイル: webapi.py プロジェクト: vjingbi/ThunderShell
 def get_shell_output(self):
     if self.auth():
         guid = self.request.path.split("/")[3]
         guid = Utils.validate_guid(guid)
         path = Log.get_current_path("shell_%s.log" % guid)
         data = Utils.load_file(path, False, False)
         self.output["data"] = base64.b64encode(data)
         return self.output["data"]
コード例 #4
0
ファイル: apis.py プロジェクト: neux7z/ThunderShell
 def get_shell_output(self):
     if self.auth():
         try:
             guid = self.request.path.split('/')[3]
             guid = Utils.validate_guid(guid)
             path = Log.get_current_path('shell_%s.log' % guid)
             data = Utils.load_file(path, False, False)
             self.output['data'] = base64.b64encode(data)
         except:
             return
コード例 #5
0
ファイル: cli.py プロジェクト: u53r55/ThunderShell
    def view_event(self, data):
        log_path = Utils.get_arg_at(data, 1, 2)
        if log_path == "":
            UI.error("Missing arguments")
            return

        if log_path == "key":
            UI.warn("Your encryption key is '%s'" %
                    self.config.get("encryption-key"))
            return

        if log_path == "password":
            UI.warn("Your server password is '%s'" %
                    self.config.get("server-password"))
            return

        if not log_path in ("http", "event", "error"):
            UI.error("Invalid path")
            return

        log_path += ".log"

        rows = Utils.get_arg_at(data, 2, 2)
        if rows == "":
            rows = 10
        else:
            try:
                rows = int(rows)
            except:
                rows = 10

        log_path = Log.get_current_path(log_path)

        data = []

        if Utils.file_exists(log_path):
            for line in open(log_path, "rb").readlines():
                data.append(line)

            data = list(reversed(data))

            print("\nLast %d lines of log\n----------------------\n" % rows)
            data = list(data)

            for i in range(0, rows):
                try:
                    print data[i]
                except:
                    pass
コード例 #6
0
    def view_event(self, data):
        log_path = Utils.get_arg_at(data, 1, 2)
        if log_path == '':
            UI.error('Missing arguments')
            return

        if log_path == 'key':
            UI.warn("Your encryption key is '%s'" %
                    self.config.get('encryption-key'))
            return

        if log_path == 'password':
            UI.warn("Your server password is '%s'" %
                    self.config.get('server-password'))
            return

        if not log_path in ('http', 'event', 'error'):
            UI.error('Invalid path')
            return

        log_path += '.log'

        rows = Utils.get_arg_at(data, 2, 2)
        if rows == '':
            rows = 10
        else:
            try:
                rows = int(rows)
            except:
                rows = 10

        log_path = Log.get_current_path(log_path)
        data = []
        if Utils.file_exists(log_path):
            for line in open(log_path, 'rb').readlines():
                data.append(line)
            data = list(reversed(data))
            print '''Last %d lines of log\n----------------------''' % rows
            data = list(data)
            for i in range(0, rows):
                try:
                    print data[i]
                except:
                    pass