Coder Social home page Coder Social logo

pcaprestservice's Introduction

PCAPRestService

REST service to provide users information regarding the packet capture process .It talks with a C library via JNI ,and provides a JSON response to the client . Its also use to get packet data from the elasticsearch .Please see the section on Functions provided

#Creating .SO from C file

Below is the command to generate the .SO file .Here we have loaded the library using a library path,you can also directly load it from java path .

gcc -fPIC -shared -I /usr/lib/jvm/java-8-oracle/include -I /usr/lib/jvm/java-8-oracle/include/linux -o libJNIDemo.so JNIWrapper.c

Make sure the header file and the .C file are in the same directory .Once the Library .SO file is created,update the PCAP_SO_FILE_LOCATION in URIConstansts.java

#Build process,requirements

1)Below are the gradle specifications (Please check build.gradle file )

-Gradle version:2.3

-Java Source Compatibility :1.7

-Elasticsearch support:2.2

2)git clone https://github.com/asj177/PCAPRestService.git

3)Go to PCAPRestService

4)gradle clean build

5)After build is successful ,got to build/libs

6)run the command java -jar demo-0.0.1-SNAPSHOT.jar

Runs at 8080

#Configurations

1)Do not forget to add your .SO file path at URIConstansts.java (Name of the Variable :PCAP_SO_FILE_LOCATION)

2)Do not forget to add your INI file path at URIConstants.java (Name of the Variable:PCAP_INI_FILE_LOCATION)

3)Do not forget to add your file storage path at URIConstants.java (Name of the Variable:PCAP_FILE_LOCATION)

#Functions

1)Start the PCAP Mining Process API

EndPoint:/pcap

Method:POST

Accept:application/json

Content-type:application/json

Body:PCAPParams in JSON format eg:{"ip_a":"10.X.X.X"}

Headers Should also contain the Key

2)Get PCAP Status API

EndPoint:/pcap/status

Metod:GET

Accept:Applications/JSON

Content-Type:Application/JSON

Headers should also contain the Key

3)Get PCAP Mining Stats

EndPoint:/pcap/miningStat

Method:POST

Accept:Applications/JSON

Content-Type:Application/JSON

Body:PCAP Params as in Start PCAP Mining

Headers should also contain the Key

4)Cancel PCAP Operations:Work in Progress

5)Get PCAP File

EndPoint:/pcap/file

Method:GET

Accept:APPLICATION_OCTET_STREAM_VALUE

Request Params:Should contain the file name which is the key

6)Get ES Data

EndPoint:/esdata/{to}/{from}

Method:GET

Accept:Application/Json

Content-Type:applications/json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.