示例#1
0
 def url_line(self):
     body = colored('[{}]'.format(self.status_code),
                    status_code_colors(self.status_code))
     body += ' {} '.format(self.crawler_url.url.url)
     body += colored(' ({})'.format(self.name or self.__class__.__name__),
                     Fore.LIGHTYELLOW_EX)
     return body
示例#2
0
 def get_url_info(self):
     size = self.data['resp'].headers.get('Content-Length')
     size = len(self.data.get('text', '')) if size is None else size
     status_code = int(self.data['resp'].status_code)
     out = colored('({})'.format(status_code), status_code_colors(status_code)) + " "
     out += colored('({:>6})'.format(sizeof_fmt(size)), Fore.LIGHTYELLOW_EX) + " "
     return out
示例#3
0
 def one_line(self, line_size, url_column, extra_len):
     text = self.text[:line_size-url_column-len(list(remove_ansi_escape(self.url_info)))-3]
     out = self.url_info
     out += colored(('{:<%d}' % url_column).format(self.url.url), Fore.LIGHTBLUE_EX) + "  "
     if self.url.extra:
         out += colored(' {} '.format(format_extra(self.url.extra, extra_len)), Fore.LIGHTBLUE_EX)
     out += text
     return out
示例#4
0
 def multi_line(self, line_size, extra_len):
     out = colored('┏', Fore.LIGHTBLUE_EX) + ' {} {}\n'.format(
         self.url_info, colored(self.url.url, Fore.LIGHTBLUE_EX)
     )
     out += colored('┗', Fore.LIGHTBLUE_EX)
     if self.url.extra:
         out += colored(' {}'.format(format_extra(self.url.extra, extra_len)), Fore.LIGHTBLUE_EX)
     out += ' {}'.format(self.text[:line_size-2])
     return out
示例#5
0
 def __str__(self):
     body = super(ProcessIndexOfRequest, self).__str__()
     ext_files = list(self.interesting_ext_files())
     name_files = list(self.interesting_name_files())
     if ext_files:
         body += colored('\n    Interesting extension files:', Fore.BLUE)
         body += ' {}'.format(', '.join(map(lambda x: x.name, ext_files)))
     if name_files:
         body += colored('\n    Interesting file names:', Fore.MAGENTA)
         body += ' {}'.format(', '.join(map(lambda x: x.name, name_files)))
     if not ext_files and not name_files:
         body += colored(' (Nothing interesting)', Fore.LIGHTYELLOW_EX)
     return body
示例#6
0
 def __str__(self):
     body = self.url_line()
     if self.crawler_url.exists:
         body += colored(' (FAKE 404)', Fore.YELLOW)
     if self.index_file:
         body += '\n    Index file found: {}'.format(self.index_file.name)
     return body
示例#7
0
 def multi_line(self, line_size):
     out = colored('┏', Fore.LIGHTBLUE_EX) + ' {} {}\n'.format(
         self.url_info, colored(self.url.url, Fore.LIGHTBLUE_EX))
     out += colored('┗', Fore.LIGHTBLUE_EX) + ' {}'.format(
         self.text[:line_size - 2])
     return out
示例#8
0
 def __str__(self):
     body = super(ProcessRedirect, self).__str__()
     body += colored('\n    Redirect to: ', Fore.BLUE)
     body += '{}'.format(self.redirector.address)
     return body
示例#9
0
 def __str__(self):
     body = colored('[ERROR]', Back.LIGHTRED_EX, Fore.LIGHTWHITE_EX)
     body += ' {} '.format(self.crawler_url.url.url)
     body += colored('({})'.format(self.error), Fore.LIGHTYELLOW_EX)
     return body
示例#10
0
 def __str__(self):
     body = self.url_line()
     if self.index_file:
         body += colored('\n    Index file found: ', Fore.BLUE)
         body += '{}'.format(self.index_file.name)
     return body
示例#11
0
 def __str__(self):
     body = colored('[{}]'.format(self.level), Back.LIGHTRED_EX,
                    Fore.LIGHTWHITE_EX)
     body += colored(' {}'.format(self.error), Fore.LIGHTYELLOW_EX)
     return body