Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni Pellerano committed May 27, 2011
0 parents commit 3771a03
Show file tree
Hide file tree
Showing 17 changed files with 2,213 additions and 0 deletions.
18 changes: 18 additions & 0 deletions AUTHORS
@@ -0,0 +1,18 @@
vecna <vecna@delirandom.net>

pub 1024D/C6765430 2009-08-25 [expires: 2011-08-25]
Key fingerprint = 341F 1A8C E2B4 F4F4 174D 7C21 B842 093D C676 5430
uid vecna <vecna@s0ftpj.org>
uid vecna <vecna@delirandom.net>
sub 3072g/E8157737 2009-08-25 [expires: 2011-08-25]
----------------------------------------------------------------------------
evilaliv3 <giovanni.pellerano@evilaliv3.org

pub 1024D/D9A950DE 2009-05-10 [expires: 2014-05-09]
Key fingerprint = C1ED 5C8F DB6A 1C74 A807 5695 91EC 9BB8 D9A9 50DE
uid Giovanni Pellerano <giovanni.pellerano@evilaliv3.org>
sub 4096g/50A7F150 2009-05-10 [expires: 2014-05-09]
----------------------------------------------------------------------------

GITHUB:
http://github.com/evilaliv3/mitmif
28 changes: 28 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,28 @@
CMAKE_MINIMUM_REQUIRED( VERSION 2.4 )

PROJECT( janus )

SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/")

# Initializing libEvent
FIND_PACKAGE(Event)
INCLUDE_DIRECTORIES(${EVENT_INCLUDE_DIR})

ADD_SUBDIRECTORY( src )

INSTALL( FILES doc/janus.1
DESTINATION man/man1
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ )

# begin uninstall target
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY
)

ADD_CUSTOM_TARGET(
uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)
# end of uninstall target
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

Empty file added ChangeLog
Empty file.
Empty file added NEWS
Empty file.
1 change: 1 addition & 0 deletions README
95 changes: 95 additions & 0 deletions README.md
@@ -0,0 +1,95 @@
# Janus is a portable, unified and lightweight interface for mitm applications over the routing table.

It acts like a deamon and offers two simple stream sockets, one for input and one for the output traffic manipulations.
Over this sockets, before a packet, it's always appended it's size (16bit), and Janus expects to receive data back with this precise format.
The code is a portable and optimized rewrite of a first idea implemented in SniffJoke software written by Claudio Agosti.
Janus overrides the actual routing table, creating a fake gateway with the aim to block packets after the kernel (on outgoing traffic) and before the kernel (on incoming traffic).

# Requirements

cmake, gcc, iptables, route, sed

# Below are some examples starting from this common routing table:

root@linux# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
94.23.192.28 10.196.136.1 255.255.255.255 UGH 0 0 0 eth0
94.228.214.57 10.196.135.1 255.255.255.255 UGH 0 0 0 eth1
10.196.135.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.196.136.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
0.0.0.0 10.196.136.1 0.0.0.0 UG 0 0 0 eth0


#1st Example: Simple immediate exection (by default Janus executes a mitm over the default gateway)
root@linux# janus
Janus is now going to background, use SIGTERM to stop it.

root@linux# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
94.23.192.28 10.196.135.1 255.255.255.255 UGH 0 0 0 eth0
94.228.214.57 10.196.136.1 255.255.255.255 UGH 0 0 0 eth1
10.196.135.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.196.136.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
212.77.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 janus0
0.0.0.0 212.77.1.1 0.0.0.0 UG 0 0 0 janus0


#2nd Example: Custom execution (single janus instance)
root@linux# janus --net 94.23.192.28/255.255.255.255
Janus is now going to background, use SIGTERM to stop it.

root@linux# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
94.23.192.28 212.77.1.1 255.255.255.255 UGH 0 0 0 janus0
94.228.214.57 10.196.136.1 255.255.255.255 UGH 0 0 0 eth1
10.196.135.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.196.136.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
212.77.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 janus0
0.0.0.0 10.196.135.1 0.0.0.0 UG 0 0 0 eth0

#3rd Example: Custom execution (multiple janus instance, two for example)
root@linux# janus --net 94.23.192.28/255.255.255.255 --listen-port-in 4001 --listen-port-out 4002
Janus is now going to background, use SIGTERM to stop it.

root@linux# janus --net 94.228.214.57/255.255.255.255 --listen-port-in 5001 --listen-port-out 5002
Janus is now going to background, use SIGTERM to stop it.

root@linux# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
94.23.192.28 212.77.1.1 255.255.255.255 UGH 0 0 0 janus0
94.228.214.57 212.77.1.2 255.255.255.255 UGH 0 0 0 janus1
10.196.135.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.196.136.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
212.77.1.1 0.0.0.0 255.255.255.255 UH 0 0 0 janus0
212.77.1.2 0.0.0.0 255.255.255.255 UH 0 0 0 janus1
0.0.0.0 10.196.135.1 0.0.0.0 UG 0 0 0 eth0

## Installed files (paths may vary on your system)

Janus binary /usr/local/sbin/janus

Janus man page /usr/local/man/man1/janus.1

Official Janus page:
https://github.com/evilaliv3/janus

# GPG public keys

X-2:~ X$ gpg --keyserver pgp.mit.edu --recv-key D9A950DE
X-2:~ X$ gpg --fingerprint --list-keys D9A950DE
pub 1024D/D9A950DE 2009-05-10 [expires: 2014-05-09]
Key fingerprint = C1ED 5C8F DB6A 1C74 A807 5695 91EC 9BB8 D9A9 50DE
uid Giovanni Pellerano <giovanni.pellerano@evilaliv3.org>
sub 4096g/50A7F150 2009-05-10 [expires: 2014-05-09]

X-2:~ X$ gpg --keyserver pgp.mit.edu --recv-key C6765430
X-2:~ X$ gpg --fingerprint --list-keys C6765430
pub 1024D/C6765430 2009-08-25 [expires: 2011-08-25]
Key fingerprint = 341F 1A8C E2B4 F4F4 174D 7C21 B842 093D C676 5430
uid vecna <vecna@s0ftpj.org>
uid vecna <vecna@delirandom.net>
sub 3072g/E8157737 2009-08-25 [expires: 2011-08-25]
20 changes: 20 additions & 0 deletions cmake_uninstall.cmake.in
@@ -0,0 +1,20 @@
IF (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")

FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH (file ${files})
IF (EXISTS "$ENV{DESTDIR}${file}")
EXECUTE_PROCESS(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval
)
IF(NOT ${rm_retval} EQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF (NOT ${rm_retval} EQUAL 0)
ELSE (EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF (EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)
45 changes: 45 additions & 0 deletions doc/janus.1
@@ -0,0 +1,45 @@
.TH Janus 1
.PP
.SH NAME
Janus 1.0 usage
.PP
.SH SYNOPSIS
Janus [OPTION]...
.PP
.SH DESCRIPTION
Janus is a portable interface for mitm applications over the routing table.
.PP
It acts like a deamon and offers two simple stream sockets, one for the input and one for the output manipulations.
.PP
Over this sockets, before a packet, it's always appended it's size (16bit), and Janus expects to receive data back with this precise format.
.PP
The code is a portable and optimized rewrite of a first idea implemented in SniffJoke software written by Claudio Agosti.
.PP
The software overrides the actual routing table, creating a fake gateway with the aim to block packets after the kernel (on outgouing traffic) and before the kernel (on incoming traffic)
.PP
The options usefull when Janus is started are:
.PP
.SH JANUS OPTIONS
.PP
.B --net <ip/mask> [default: 0.0.0.0/0.0.0.0]
.PP
.B --listen-ip-addres <ip> [default: 127.0.0.1]
.PP
.B --listen-port-in <port> [default: 30201]
.PP
.B --listen-port-out <port> [default: 10203]
.PP
.B --version
show Janus version
.PP
.B --help
show a command line options resume
.PP
.PP
.SH "AUTHOR"
Giovanni Pellerano <giovanni.pellerano@evilaliv3.org>, Claudio Agosti <vecna@delirandom.net>
.PP
.SH "REPORTING BUGS"
Report bugs to <giovanni.pellerano@evilaliv3.org>.
.SH "COPYRIGHT"
Copyright (GPL) 2011 Giovanni Pellerano & Claudio Agosti
18 changes: 18 additions & 0 deletions modules/FindEvent.cmake
@@ -0,0 +1,18 @@
FIND_PATH(EVENT_INCLUDE_DIR event.h)

SET(EVENT_NAMES ${EVENT_NAMES} event libevent)
FIND_LIBRARY(EVENT_LIBRARY NAMES ${EVENT_NAMES} PATH)

IF(EVENT_INCLUDE_DIR AND EVENT_LIBRARY)
SET(EVENT_FOUND TRUE)
ENDIF(EVENT_INCLUDE_DIR AND EVENT_LIBRARY)

IF(EVENT_FOUND)
IF(NOT Event_FIND_QUIETLY)
MESSAGE(STATUS "Found Event: ${EVENT_LIBRARY}")
ENDIF (NOT Event_FIND_QUIETLY)
ELSE(EVENT_FOUND)
IF(Event_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find event")
ENDIF(Event_FIND_REQUIRED)
ENDIF (EVENT_FOUND)
11 changes: 11 additions & 0 deletions src/CMakeLists.txt
@@ -0,0 +1,11 @@
ADD_EXECUTABLE( janus
packet_queue
janus
main )

INSTALL( TARGETS janus
RUNTIME DESTINATION /usr/local/sbin )

SET( CMAKE_C_FLAGS "-O3 -Wall -g3 -pedantic ${CMAKE_C_FLAGS}" )

TARGET_LINK_LIBRARIES( janus "-levent" )

0 comments on commit 3771a03

Please sign in to comment.