Compare commits
No commits in common. "b0c97d889e6f526989a63bf4c5600d7287ac05de" and "59bed77548d525ec31e7b055eda22fc8a5c4205b" have entirely different histories.
b0c97d889e
...
59bed77548
|
@ -47,32 +47,47 @@ FILE6 = iPDC.desktop
|
|||
CC = gcc
|
||||
LIBS = -lpthread
|
||||
LDLIBS=`pkg-config --cflags --libs gtk+-3.0 osmgpsmap-1.0`
|
||||
CFLAGS=-g -I./inc -fcommon `pkg-config --cflags --libs gtk+-3.0 osmgpsmap-1.0`
|
||||
CFLAGS=-g -fcommon `pkg-config --cflags --libs gtk+-3.0 osmgpsmap-1.0`
|
||||
|
||||
SOURCES = \
|
||||
ipdc.c \
|
||||
recreate.c recreate.h \
|
||||
connections.c connections.h \
|
||||
new_pmu_or_pdc.c new_pmu_or_pdc.h \
|
||||
parser.c parser.h \
|
||||
dallocate.c dallocate.h \
|
||||
align_sort.c align_sort.h \
|
||||
ipdcGui.c ipdcGui.h \
|
||||
attack_detection.c attack_detection.h \
|
||||
data_vis.c data_vis.h \
|
||||
utility_tools.c utility_tools.h \
|
||||
Attack_detect.c Attack_detect.h
|
||||
|
||||
OBJECTS = ipdc.c recreate.o connections.o new_pmu_or_pdc.o parser.o dallocate.o align_sort.o ipdcGui.o attack_detection.o data_vis.o utility_tools.o Attack_detect.o
|
||||
|
||||
CLEAN_OBJECTS = recreate.o connections.o new_pmu_or_pdc.o parser.o dallocate.o align_sort.o ipdcGui.o ~iPDC.xml
|
||||
|
||||
PROGRAM = iPDC
|
||||
SOURCE_FILES = $(wildcard src/*.c)
|
||||
OBJECT_FILES = $(patsubst src/%.c, bin/%.o, $(SOURCE_FILES))
|
||||
CLEAN_OBJECTS = $(wildcard bin/*.o) $(PROGRAM)
|
||||
|
||||
all: $(PROGRAM)
|
||||
COMPILE = $(CC)
|
||||
|
||||
$(PROGRAM): $(OBJECT_FILES)
|
||||
$(CC) $(CFLAGS) $(OBJECT_FILES) -o $(PROGRAM) $(LDLIBS)
|
||||
|
||||
bin/%.o: src/%.c
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
$(PROGRAM): $(OBJECTS)
|
||||
$(CC) $(OBJECTS) $(LDLIBS) $(LIBS) -o $@
|
||||
|
||||
%.o: %.c
|
||||
$(COMPILE) $(CFLAGS) -c $<
|
||||
|
||||
install: $(PROGRAM)
|
||||
gtk-builder-convert assets/iPDC.glade assets/iPDC.xml
|
||||
gtk-builder-convert iPDC.glade iPDC.xml
|
||||
mkdir -p $(CREATE_DIR)iPDC/$
|
||||
cp -f assets/$(FILE1) $(CREATE_DIR)iPDC/$(FILE1)
|
||||
cp -f assets/$(FILE2) $(CREATE_DIR)iPDC/$(FILE2)
|
||||
cp -f assets/$(FILE3) $(CREATE_DIR)iPDC/$(FILE3)
|
||||
cp -f assets/$(FILE4) $(CREATE_DIR)iPDC/$(FILE4)
|
||||
cp -f assets/$(FILE5) $(CREATE_DIR)iPDC/$(FILE5)
|
||||
cp -f assets/$(FILE6) $(DESKTOP_DIR)/$(FILE6)
|
||||
cp -f $(FILE1) $(CREATE_DIR)iPDC/$(FILE1)
|
||||
cp -f images/$(FILE2) $(CREATE_DIR)iPDC/$(FILE2)
|
||||
cp -f images/$(FILE3) $(CREATE_DIR)iPDC/$(FILE3)
|
||||
cp -f images/$(FILE4) $(CREATE_DIR)iPDC/$(FILE4)
|
||||
cp -f images/$(FILE5) $(CREATE_DIR)iPDC/$(FILE5)
|
||||
cp -f images/$(FILE6) $(DESKTOP_DIR)/$(FILE6)
|
||||
cp $(PROGRAM) $(INSTALL_PREFIX)bin/$(PROGRAM)
|
||||
# rm -f $(CLEAN_OBJECTS) $(PROGRAM)
|
||||
|
||||
uninstall:
|
||||
rm -f $(INSTALL_PREFIX)bin/$(PROGRAM)
|
||||
|
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 266 KiB After Width: | Height: | Size: 266 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
@ -1,10 +0,0 @@
|
|||
#include<gtk/gtk.h>
|
||||
#include<osm-gps-map.h>
|
||||
typedef struct{
|
||||
OsmGpsMap *util_map;
|
||||
GdkPixbuf *g_red_image;
|
||||
GdkPixbuf *g_green_image;
|
||||
OsmGpsMapImage *g_last_image;
|
||||
} myParameters;
|
||||
|
||||
gboolean update_images(gpointer* pars);
|
|
@ -50,7 +50,7 @@
|
|||
#include "utility_tools.h"
|
||||
|
||||
/* Common fixed path for storage of few common files */
|
||||
#define UI_fILE "./assets/iPDC.ui"
|
||||
#define UI_fILE "./iPDC.ui"
|
||||
//#define UI_fILE "/usr/local/share/iPDC/iPDC.xml"
|
||||
|
||||
|
|
@ -5,6 +5,12 @@
|
|||
#include "osm-gps-map.h"
|
||||
#include "Attack_detect.h"
|
||||
|
||||
typedef struct{
|
||||
OsmGpsMap *util_map;
|
||||
GdkPixbuf *g_red_image;
|
||||
GdkPixbuf *g_green_image;
|
||||
OsmGpsMapImage *g_last_image;
|
||||
} myParameters;
|
||||
|
||||
gboolean update_images(gpointer* pars){
|
||||
myParameters* parameters = (myParameters*) pars;
|
||||
|
@ -36,7 +42,7 @@ gboolean update_images(gpointer* pars){
|
|||
if (green){
|
||||
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image);
|
||||
}else{
|
||||
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_red_image);
|
||||
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image);
|
||||
}
|
||||
|
||||
}
|
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
|
@ -1,62 +0,0 @@
|
|||
#include<gtk/gtk.h>
|
||||
#include "align_sort.h"
|
||||
#include "parser.h"
|
||||
#include "osm-gps-map.h"
|
||||
#include "map_vis.h"
|
||||
|
||||
#define UI_fILE "./assets/utility_tools.ui"
|
||||
#define RED_IMAGE "./assets/red.png"
|
||||
#define GREEN_IMAGE "./assets/green.png"
|
||||
|
||||
|
||||
|
||||
// void change_image(OsmGpsMap *map, float lat, float lon, OsmGpsMapImage *image)
|
||||
// {
|
||||
// if (g_last_image)
|
||||
// osm_gps_map_image_remove(map, g_last_image);
|
||||
// osm_gps_map_image_add(map, lat, lon, image);
|
||||
// }
|
||||
|
||||
void utility_tools(GtkButton *but, gpointer udata)
|
||||
{
|
||||
OsmGpsMap *util_map;
|
||||
GtkWidget *window;
|
||||
GdkPixbuf *g_red_image;
|
||||
GdkPixbuf *g_green_image;
|
||||
OsmGpsMapImage *g_last_image;
|
||||
// -------------------
|
||||
GtkBuilder *builder;
|
||||
GError *error = NULL;
|
||||
builder = gtk_builder_new();
|
||||
if(!gtk_builder_add_from_file(builder, UI_fILE, &error))
|
||||
{
|
||||
g_warning("%s", error->message);
|
||||
g_free(error);
|
||||
}
|
||||
g_red_image = gdk_pixbuf_new_from_file_at_size (RED_IMAGE, 24,24,NULL);
|
||||
g_green_image = gdk_pixbuf_new_from_file_at_size (GREEN_IMAGE, 24,24,NULL);
|
||||
window = GTK_WIDGET(gtk_builder_get_object(builder, "util_window"));
|
||||
GtkContainer *map_container = GTK_CONTAINER(gtk_builder_get_object(builder, "map_layout"));
|
||||
|
||||
|
||||
|
||||
util_map = g_object_new (OSM_TYPE_GPS_MAP,
|
||||
"map-source", OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID,
|
||||
"tile-cache", "/tmp/",
|
||||
NULL);
|
||||
osm_gps_map_set_center_and_zoom (util_map, 15.4589, 75.0078, 10);
|
||||
|
||||
g_last_image = osm_gps_map_image_add(util_map,15.4589, 75.0078, g_red_image);
|
||||
g_last_image = osm_gps_map_image_add(util_map,15.518597, 74.925584, g_green_image);
|
||||
myParameters parameters = {util_map, g_red_image, g_green_image, g_last_image};
|
||||
gpointer data = (gpointer) ¶meters;
|
||||
g_timeout_add(20, (GSourceFunc) update_images, data);
|
||||
|
||||
gtk_widget_set_size_request(GTK_WIDGET(util_map), 600, 500);
|
||||
|
||||
gtk_container_add(map_container, GTK_WIDGET(util_map));
|
||||
g_signal_connect(window, "destroy", G_CALLBACK(gtk_widget_destroy), NULL);
|
||||
|
||||
gtk_widget_show_all(window);
|
||||
gtk_main();
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
#include<gtk/gtk.h>
|
||||
#include "utility_tools.h"
|
||||
#include "align_sort.h"
|
||||
#include "parser.h"
|
||||
#include "Attack_detect.h"
|
||||
|
||||
#define UI_fILE "./utility_tools.ui"
|
||||
|
||||
|
||||
|
||||
// void change_image(OsmGpsMap *map, float lat, float lon, OsmGpsMapImage *image)
|
||||
// {
|
||||
// if (g_last_image)
|
||||
// osm_gps_map_image_remove(map, g_last_image);
|
||||
// osm_gps_map_image_add(map, lat, lon, image);
|
||||
// }
|
||||
|
||||
typedef struct{
|
||||
OsmGpsMap *util_map;
|
||||
GdkPixbuf *g_red_image;
|
||||
GdkPixbuf *g_green_image;
|
||||
OsmGpsMapImage *g_last_image;
|
||||
} myParameters;
|
||||
|
||||
gboolean update_images(gpointer* pars){
|
||||
myParameters* parameters = (myParameters*) pars;
|
||||
struct data_frame *df = TSB[0].first_data_frame;
|
||||
if(parameters->g_green_image == NULL){
|
||||
return FALSE;
|
||||
}
|
||||
if (parameters->util_map == NULL){
|
||||
return FALSE;
|
||||
}
|
||||
if (df == NULL){
|
||||
return FALSE;
|
||||
}
|
||||
int freq = to_intconvertor(df->dpmu[0]->freq);
|
||||
gboolean green =attack_detect(df,&START,&COUNT,&SUM_OF_FREQUENCY);
|
||||
if(parameters->util_map != NULL){
|
||||
|
||||
// if(parameters->g_last_image != 0){
|
||||
// osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image);
|
||||
// }
|
||||
// if (freq > 300){
|
||||
// parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image);
|
||||
// }else{
|
||||
// parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image);
|
||||
// }
|
||||
if(parameters->g_last_image != 0){
|
||||
osm_gps_map_image_remove(parameters->util_map, parameters->g_last_image);
|
||||
}
|
||||
if (green){
|
||||
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_green_image);
|
||||
}else{
|
||||
parameters->g_last_image = osm_gps_map_image_add(parameters->util_map,15.518597, 74.925584, parameters->g_red_image);
|
||||
}
|
||||
|
||||
}
|
||||
gtk_widget_queue_draw(GTK_WIDGET(parameters->util_map));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void utility_tools(GtkButton *but, gpointer udata)
|
||||
{
|
||||
OsmGpsMap *util_map;
|
||||
GtkWidget *window;
|
||||
GdkPixbuf *g_red_image;
|
||||
GdkPixbuf *g_green_image;
|
||||
OsmGpsMapImage *g_last_image;
|
||||
// -------------------
|
||||
GtkBuilder *builder;
|
||||
GError *error = NULL;
|
||||
builder = gtk_builder_new();
|
||||
if(!gtk_builder_add_from_file(builder, UI_fILE, &error))
|
||||
{
|
||||
g_warning("%s", error->message);
|
||||
g_free(error);
|
||||
}
|
||||
g_red_image = gdk_pixbuf_new_from_file_at_size ("red.png", 24,24,NULL);
|
||||
g_green_image = gdk_pixbuf_new_from_file_at_size ("green.png", 24,24,NULL);
|
||||
window = GTK_WIDGET(gtk_builder_get_object(builder, "util_window"));
|
||||
GtkContainer *map_container = GTK_CONTAINER(gtk_builder_get_object(builder, "map_layout"));
|
||||
|
||||
|
||||
|
||||
util_map = g_object_new (OSM_TYPE_GPS_MAP,
|
||||
"map-source", OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID,
|
||||
"tile-cache", "/tmp/",
|
||||
NULL);
|
||||
osm_gps_map_set_center_and_zoom (util_map, 15.4589, 75.0078, 10);
|
||||
|
||||
g_last_image = osm_gps_map_image_add(util_map,15.4589, 75.0078, g_red_image);
|
||||
g_last_image = osm_gps_map_image_add(util_map,15.518597, 74.925584, g_green_image);
|
||||
myParameters parameters = {util_map, g_red_image, g_green_image, g_last_image};
|
||||
gpointer data = (gpointer) ¶meters;
|
||||
g_timeout_add(20, (GSourceFunc) update_images, data);
|
||||
|
||||
gtk_widget_set_size_request(GTK_WIDGET(util_map), 600, 500);
|
||||
|
||||
gtk_container_add(map_container, GTK_WIDGET(util_map));
|
||||
g_signal_connect(window, "destroy", G_CALLBACK(gtk_widget_destroy), NULL);
|
||||
|
||||
gtk_widget_show_all(window);
|
||||
gtk_main();
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.24"/>
|
||||
</interface>
|