Saturday, March 25, 2017

Different ways to mitigate DDOS Attack

DDoS is aka Distributed Denial of Service. It is type of attack where multiple Trojan infected systems are used to target a single system causing a Denial of Service (DoS) attack. Victims of a DDoS attack consist of both the end targeted system and all systems maliciously used and controlled by the hacker in the distributed attack.

How to mitigate DDOS attack?
There are couple of options available which are used to mitigate the DDOS attack like as below mentioned:-
1. Source Rate Limiting and Filtering
2. Limiting the total number of connections
3. Syn Proxy

Options from 1 to 3 are used to reduce the impact and RTBH is used to completely drop the traffic for the targeted destination address. This can be achieved either at Customer Premises or at Service Provider Edge location by forwarding all the traffic for desired destination towards the null route. The main disadvantage of RTBH is that the entire traffic has to be dropped. What does it mean that if the server is hosting port 80 and port 53 application and DDOS attack is only for port 53 in that case the entire port 80 and 53 traffic has to be dropped. This may impact the services of port 80 also even though the traffic is not destined for port 80. But this will help service providers or customers to get rid from DDOS attack or to mitigate it.

In the next post, I will be sharing more details on BGP Flow Specs to control the DDOS attacks in more dynamic way. This is what could be the next or new approach after RTBH.

Click Here To Read Rest Of The Post...

Monday, October 17, 2016

Validating IP Address By Using Python (Conditional Statement)

Splitting IP Address string variable post defines the normal way how to deal with the variables and splitting them into different items. The same splitting can be used by using conditional statement if-else with while loop. This provides more simplicity for network engineers to shorten the python code.

Syntax of If-Else Statement:
if expression:

If expression is FALSE, in that case complier will move to the ELIF part. If ELIF becomes false also, the compiler will execute else block. The elif statement allows you to check multiple expressions for TRUE and execute a block of code as soon as one of the conditions evaluates to TRUE.

while True:
  ip_address = raw_input("Enter IP Address")
  ip_address_check = ip_address.split('.')

  if (len(ip_address_check) == 4) and (1 <= int(ip_address_check[0]) <= 223) and (int(ip_address_check[0]) != 127) and (int(ip_address_check[0]) != 169 or int(ip_address_check[1]) != 254) and (0 <= int(ip_address_check[1]) <= 255 and 0 <= int(ip_address_check[2]) <= 255 and 0 <= int(ip_address_check[3]) <= 255):

  print "\nThe IP address is INVALID! Please retry!\n"

print "Shivlu Jain It's Good to go with the given IP Address"

For more info on programming skill read Do I need to be programmer before learning Automation, SDN and NFV technologies?

Click Here To Read Rest Of The Post...

Friday, October 14, 2016

Splitting IP Address string variable in Python

Python variable types post defines the different type’s variable in python. In this post, I will be covering the basis stuff which is used to convert a string into an integer and use it for further validation. The main intent of this article is to write few lines of code which can ask user to input the “IP Address Field” and split the string into different octets by using split function. Once this is done, after that convert the string to integer type so that we can check whether the given input has length of 4 or not (In case of IP Address we have a.b.c.d).

The same lines of codes can become more meaningful and useful when it is applied with if-else or with any kind of loop statements.
The given code is plain code which is used for basic understanding.
# raw_input is used whenever we want user to provide the inputs. Storing the user values in ip_address variable
ip_address = raw_input( "Enter an IP Address = ")

# Check the whether the entered IP Address is string or integer. Python has inbuilt function called type which is useful to check the variable type.
ip_address_check = type(ip_address)

print "Entered IP Address type is %s" %ip_address_check

print "\nNow we are convering this IP Address to integer\n"

print "Lets split the IP Address into four octet by using dot.\n"

# split function is used divide the string into smaller one with delimiter of dot. If user enters, in this case whenever DOT is seen, string is divided into four different parts by using split function ip_address_split = ip_address.split(".")

# By using split function, we can store the given user inputs into four arrays. Ist element is pointing towards first location which is 0.
print "The first octet is %s" %ip_address_split[0] #----> Output will be 192
print "The second octet is %s"%ip_address_split[1] #----> Output will be 168
print "The Third octet is %s"%ip_address_split[2] #----> Output will be 1
print "The Fourth octet is %s"%ip_address_split[3] #----> Output will be 1

print "\nLets check whether the length is equal to four or not - Octet Validation\n"

# len is length function which is used to check the length of string after spliting it using split function. We can use the conditional statements to check it. In this case we are not using anything.

ip_address_length = len(ip_address_split)

print "The length of IP Address is %d" %ip_address_length

print "\nCurrently everything is in string, lets convert this IP Address to integer\n"

# int is integer function which is used to convert the first string element into integer. Once this is done, we can simply compare it with different IP Addresses classes and check that this IP address is falling in which class. We are not using it here but it can be used by using conditional statements.

ip_address_split_convert = int(ip_address_split[0])
ip_address_split_convert_check = type(ip_address_split_convert)
print "After conversion ist octet, type is changed to integrer %s" %ip_address_split_convert_check

ip_address_split_convert = int(ip_address_split[1])
ip_address_split_convert_check = type(ip_address_split_convert)
print "After conversion second octet, type is changed to integrer %s" %ip_address_split_convert_check

ip_address_split_convert = int(ip_address_split[2])
ip_address_split_convert_check = type(ip_address_split_convert)
print "After conversion third octet, type is changed to integrer %s" %ip_address_split_convert_check

ip_address_split_convert = int(ip_address_split[3])
ip_address_split_convert_check = type(ip_address_split_convert)
print "After conversion fourth octet, type is changed to integrer %s" %ip_address_split_convert_check

Click Here To Read Rest Of The Post...