Beispiel #1
0
    def __init__(self):
        # Abrimos uma conexão com o banco de dados:
        self.conexao = pymysql.connect(db='keylogger', user='******', passwd='')
        # Cria um cursor:
        self.cursor = self.conexao.cursor()

        _ip = ip.Ip()
        self.getIP = _ip.get_ip()
        self.getUser = _ip.get_user()
Beispiel #2
0
    def get_domain_from_ip(self, ip_address, elastic_output):
        global domain_list
        counter = 0
        ip1 = ip.Ip(ip_address)
        ip1.geolocation(elastic_output)
        ip1.threatcrowd_ip(elastic_output)
        ip_virustotal = ip1.virustotal(conf['keys']['virustotal'], elastic_output)

        new_domains = []
        if ip_virustotal:
            for j in ip_virustotal[ip_address]['hostname']:
                if counter <= 3:
                    if j not in domain_list:
                        counter = counter + 1
                        domain_list.append(j)
                        new_domains.append(j)

        return new_domains
Beispiel #3
0
    def __init__(self, hostname):
        self.ip = ip.Ip()
        self.src_ip = utilities.getLocalIP()
        self.dest_ip = utilities.getDestIP(hostname)
        self.src_port = random.randint(1024, 65530)
        # self.src_port = 30910
        self.dest_port = 80
        self.seq_num = random.randint(0, 65536 * 65536)
        # self.seq_num = 5436666
        self.ack_num = 0
        self.c_wind = 1

        # The expected packets is the lists of sent packets
        # but not yet acked. The entry is expected ack number.
        self.expected_packets = Set([])
        self.received_packets = Set([])
        self.out_of_order_packets = {}
        self.last_acked_time = time.time()
Beispiel #4
0
#lots of testing

import ip

addr1 = ip.Ip(1234)

print 'self.address', addr1.address
print 'repr        ', repr(addr1)
print 'ip + 5      ', addr1 + 5, type(addr1 + 5)
print 'ip - 5      ', addr1 + 5, type(addr1 - 5)
print

addr4_1 = ip.Ipv4('192.168.0.1')
addr4_2 = ip.Ipv4([172, 16, 0, 1])
addr4_3 = ip.Ipv4((255, 255, 255, 0))

print 'self.address', addr4_1.address, addr4_2.address, addr4_3.address
print 'repr        ', repr(addr4_1), repr(addr4_2)
print 'str         ', str(addr4_1), str(addr4_2)
print 'list        ', list(addr4_1), list(addr4_2)
print 'tuple       ', tuple(addr4_1), tuple(addr4_2)
print 'ip1 + 5     ', addr4_1 + 5, type(addr4_1 + 5)
print 'ip2 + 5     ', addr4_2 + 5, type(addr4_2 + 5)
print 'ip1 - 5     ', addr4_1 - 5, type(addr4_1 - 5)
print 'ip2 - 5     ', addr4_2 - 5, type(addr4_2 - 5)
print 'ip1 | ip2   ', addr4_1 | addr4_2, type(addr4_1 | addr4_2)
print 'ip1 & ip2   ', addr4_1 & addr4_2, type(addr4_1 & addr4_2)
print 'ip1 ^ ip2   ', addr4_1 ^ addr4_2, type(addr4_1 ^ addr4_2)
print 'ip1[0]      ', addr4_1[0]
print 'ip2[0]      ', addr4_2[0]