Add imsnif and link it against uclibcxx (#2128)

git-svn-id: svn://svn.openwrt.org/openwrt/packages@13145 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
florian 2008-11-09 15:33:26 +00:00
parent 2b6f9b243a
commit 5ed31914ae
3 changed files with 136 additions and 0 deletions

58
net/imsnif/Makefile Normal file
View File

@ -0,0 +1,58 @@
#
# Copyright (C) 2008 OpenWrt.org
#
# $ Id:$
include $(TOPDIR)/rules.mk
PKG_NAME:=imsnif
PKG_VERSION:=0.04
PKG_RELEASE:=2
PKG_MD5SUM:=689c456f8edb77b9b4199a25514ac683
PKG_SOURCE_URL:=http://kent.dl.sourceforge.net/sourceforge/im-snif
PKG_SOURCE:=$(PKG_NAME)f_$(PKG_VERSION).tgz
PKG_CAT:=zcat
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
PKG_UNPACK:=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR) -C $(PKG_BUILD_DIR) -xvf -
include $(INCLUDE_DIR)/package.mk
define Package/imsnif
SECTION:=net
CATEGORY:=Network
DEPENDS:=+libpcap +uclibcxx
TITLE:=MSN Messenger sniffer
URL:=http://sourceforge.net/projects/im-snif
endef
define Package/imsnif/description
IMsnif is a simple program to log Instant Message activity
on the network. It uses libpcap to capture packets and
analyzes them, logging conversation, contact lists, etc.
endef
define Build/Compile
$(TARGET_CROSS)g++ $(TARGET_CPPFLAGS) -fno-builtin -fno-rtti -nostdinc++ \
-I$(STAGING_DIR)/usr/include/uClibc++ -I$(LINUX_DIR)/include \
-o $(PKG_BUILD_DIR)/src/imsnif \
$(PKG_BUILD_DIR)/src/imsniff.cpp \
$(PKG_BUILD_DIR)/src/util.cpp \
$(PKG_BUILD_DIR)/src/msn_conntrack.cpp \
$(PKG_BUILD_DIR)/src/msn_handlers.cpp \
-L$(STAGING_DIR)/usr/lib -nodefaultlibs -luClibc++ -lgcc_s -lpcap \
$(PKG_BUILD_DIR)/src/pcap_stuff.cpp
endef
define Package/imsnif/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_CONF) $(PKG_BUILD_DIR)/docs/imsniff.conf.sample $(1)/etc/imsnif.conf
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/imsnif $(1)/etc/init.d
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/imsnif $(1)/usr/bin
endef
$(eval $(call BuildPackage,imsnif))

16
net/imsnif/files/imsnif Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh /etc/rc.common
#Copyright (C) 2007 RoadRunner.cx
START=85
start() {
[ -f /etc/imsnif.conf ] && /usr/bin/imsnif || {
cat <<EOF
You have not created configuration file.
Store your configuration as /etc/imsnif.conf
EOF
}
}
stop() {
[ `ps ax|grep -v grep|grep -c imsnif` != "0" ] && killall imsnif
}

View File

@ -0,0 +1,62 @@
diff -Naur imsniff.orig/docs/imsniff.conf.sample imsniff/docs/imsniff.conf.sample
--- imsniff.orig/docs/imsniff.conf.sample 2005-05-23 21:14:06.000000000 +0300
+++ imsniff/docs/imsniff.conf.sample 2007-07-25 04:20:31.000000000 +0300
@@ -1,7 +1,7 @@
-daemonize = 0
+daemonize = 1
promisc = 0
-verbose = 2
-chatdir = /tmp/chats
-debugdir = /tmp/debug
-interface eth0
+verbose = 1
+chatdir = /var/log/imsnif
+debugdir = /var/log
+interface = eth0.1
diff -Naur imsniff.orig/src/imsniff.cpp imsniff/src/imsniff.cpp
--- imsniff.orig/src/imsniff.cpp 2005-09-02 15:52:28.000000000 +0300
+++ imsniff/src/imsniff.cpp 2007-07-25 03:14:00.000000000 +0300
@@ -4,8 +4,8 @@
//char debuglogdir[1024]="/var/log";
-char chatlogdir[MAX_DIR_LENGTH+1]="";
-char debuglogdir[MAX_DIR_LENGTH+1]="";
+char chatlogdir[MAX_DIR_LENGTH+1]="/var/log/imsnif";
+char debuglogdir[MAX_DIR_LENGTH+1]="/var/log";
int daemonize=0;
char *currentversion = "0.04";
int data_offset = -1;
@@ -652,7 +652,14 @@
c--;
c++; /* Start of real name */
if (strlen (c) == 0) /* Uh? */
+ { //Jake's hack to read default configuration file if it exists.
+ f = fopen("/etc/imsnif.conf", "r");
+ if (f!=NULL)
+ {
+ read_file (f);
+ }
return 0;
+ }
if (strchr (c, '%')!=NULL) /* Prevent strange things */
return -1;
fn = (char *) malloc (strlen (c) + 11);
diff -Naur imsniff.orig/src/util.cpp imsniff/src/util.cpp
--- imsniff.orig/src/util.cpp 2005-09-02 15:27:58.000000000 +0300
+++ imsniff/src/util.cpp 2007-07-25 04:17:36.000000000 +0300
@@ -254,11 +254,11 @@
#ifdef WIN32
struct tm *stm;
stm= localtime (&now);
- sprintf (fn, "%s/imsniff_%04d-%02d-%02d.log", debuglogdir, stm->tm_year, stm->tm_mon, stm->tm_mday);
+ sprintf (fn, "%s/imsnif_%04d-%02d-%02d.log", debuglogdir, stm->tm_year, stm->tm_mon, stm->tm_mday);
#else
struct tm stm;
localtime_r (&now, &stm);
- sprintf (fn, "%s/imsniff_%04d-%02d-%02d.log", debuglogdir, stm.tm_year, stm.tm_mon, stm.tm_mday);
+ sprintf (fn, "%s/imsnif_%04d-%02d-%02d.log", debuglogdir, stm.tm_year, stm.tm_mon, stm.tm_mday);
#endif
FILE *o=fopen (fn, "a+t");
if (o!=NULL)