Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

IdeaMart

Ideamart is a platform presented by Dialog Axiata PLC to developers and content providers to use the Dialog network based features via shared APIs and monetize their efforts.

Hope you have an idea about what ideamart is. ideamart is a vast popular platform these days. I have seen lot of television advertisements also. But in the mean time I was unable to find any web application (website) which have  used ideamart APIs. So this tutorial will guide you how to use ideamart APIs in a web application. I am using basic java, JSP, servlet for this tutorial. You can extend it to any other framework like spring, vaadin, etc. This tutorial will guide you to implement following scenarios.
  • Receiving a message
  • Sending a message
  • Displaying received messages in a html page     
Prerequisites 
  • java 1.8
  • ideamart simulator 
  • apache tomcat 8
  • apache maven 3
  • IDE  (I am using intellij idea) 
Hope you are familiar with the above stuff. First you need to download or clone the repository. 
after downloading it you can open your favorite IDE and import the pom.xml file. It will download all the dependencies. To run the program you have to configure apache tomcat to your IDE 

How to configure apache tomcat in IntelliJ IDEA

Implementation 

Below image is displaying the source code structure after all the above configurations.
     
receive - This package is to handle the receiving messages. To receive a message and to send a message you need a library given by the ideamart. It is included in the resources directory. By implementing the MoSmsListener class you can handle the receiving messages. I hope you can easily understand it when you look at the Receive class implementation. receiving message URL is configured in the web.xml file. 

operations - when you receive a message you can do any operation for that. In this tutorial I am splitting it and put it into a hashmap. You can do any other operation you need.    

send - This package is to send messages to particular number. SmsRequestSender class can be used for that. 

db - This package is used for database operations. For this implementation i am using a hashmap. You can use any other database like sql or nosql. 

I hope you got some idea about the implementation. Now you are free to run the application. Before you run the program please make sure that all the libraries are included into the artifacts.
For that If you use intellij idea press Shift+ CTRL + ALT + S and then you can see the project structure.
It looks like below.
In the above picture both selected library and the other one are not in the artifacts. To add those into it right click on it and select "put into WEB-INF/lib" 
Then you can start the server and the ideamart simulator. 
You can see the index page and ideamart simulator like below.

                                                                                                             

URL - http://localhost:8080/Receiver
This URL is configured in the web.xml. In this tutorial I am going to get the name and the message with application name as a message. So your message format should have above three details.
ex - <app name> tharinda mymessage

Now you can send this message and wait for the response. When the response message came reload the index page and you will get the result below.
That's it! Hope this will help you. 

Thanks for reading :)

If you have any problem, feel free to leave a comment and I appreciate any feedback. 

For more info and contact me go to my website.

This is my 2nd year academic project.time duration is 7 week.I have only 1 week to finish this.but 90% finished now.I'm willing to tell you the brief introduction  about this project.the title is Blocking ssh bots.

The secure shell ssh is a service that is used remotely login to unix-like systems. Attackers use bots to attempt brute-force logins on unix servers running ssh.The proliferation of these botnets targeting the ssh service poses a security to unix servers. Build a system todetect, block and, analyse ssh botnet attacks on servers.

I made a simple tool that detects brute-force attempts by analysing the ssh server logs. Typically, a large number of (failed) login attempts from same ip address indicates a bot.Once a bot is detected it can be blocked by adding a (dynamic) firewall. Periodically, these blocks must be used to save memory and,

prevent permanently locking out a particular ip.

after that i implement below extensions.
1.If the number of attacks originating from a subnet exceeds a given threshold, block the entire subnet. Subnet block rules should be expired faster than individual ip block rules.

2.Visualise the botnet activity using Google maps . using GeoIP database to map an ip to its
geographical location.
each sever has a unique format.i did this for our university sever.still trying to do for any sever.if i can implement this for do that definitely i'm willing to show you that.
I'm really confused with blocking a subnet which is a large number of (failed) login attempts.looking for extend my code to do that i have to get a subnet mask of a ip address.because that including the whole IP address'which are coming from the same area.In order to do that I wanted to use a sever.
http://cisconet.com/route-server/world_map.html
it was help me to find a sever.then i used command prompt to get a subnet mask of a IP address. i used route-server.ip-plus.net as my sever.

>>telnet route-server.ip-plus.net
*** Swisscom IP+ route server (AS3303) ***
RS_AS3303>show ip bgp 123.132.123.4
BGP routing table entry for 123.128.0.0/13, version 78278792
BGP Bestpath: deterministic-med
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 2
  (65000) 3320 701 4837, (aggregated by 4837 219.158.1.45)
    164.128.32.11 from 164.128.32.11 (138.187.128.158)
      Origin IGP, metric 601000, localpref 300, valid, confed-internal, atomic-a
ggregate, best
      Community: 3303:3006 3303:3067 3320:1840 3320:2020 3320:9020


highlighted  is the subnet mask.i was confused about how do i do this using java.
http://twit88.com/blog/2007/12/22/java-writing-an-automated-telnet-client/
above link was very helpful for me to face above problem.this is the way how i did the subnet part.
implemented code is here.
https://github.com/tharinda221/BlockingBots/

I created a simple GUI to present my project.
that is here
https://github.com/tharinda221/BotsInt

you can use this code for your sever.but you have to change the regular expression for matching your log file.

thank you.
Powered by Blogger.