Proper packaging ... more or less.

This commit is contained in:
Simone Margaritelli 2017-04-17 17:30:25 +02:00
parent 56e202fd98
commit 94196d403b
13 changed files with 229 additions and 25 deletions

6
.gitignore vendored
View file

@ -1,2 +1,6 @@
*.swp
*.pyc
build
dist
*.egg-info
.idea
*.swp

7
MANIFEST.in Normal file
View file

@ -0,0 +1,7 @@
exclude *.pyc .DS_Store .gitignore MANIFEST.in
include setup.py
include distribute_setup.py
include README.md
include LICENSE
recursive-include bin *
recursive-include opensnitch *.py

View file

@ -6,6 +6,16 @@ OpenSnitch is a GNU/Linux port of the Little Snitch application firewall.
![OpenSnitch](screenshot.png?raw=true)
## Install
sudo apt-get install nfqueue-bindings-python
cd opensnitch
sudo python setup.py install
## Run
sudo opensnitch
## License
This project is copyleft of [Simone Margaritelli](http://www.evilsocket.net/) and released under the GPL 3 license.

42
bin/opensnitch Executable file
View file

@ -0,0 +1,42 @@
#!/usr/bin/python
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import os
import sys
import logging
if not os.geteuid() == 0:
sys.exit('OpenSnitch must be run as root.')
logging.basicConfig(format='[%(asctime)s] (%(levelname)s) %(message)s',level=logging.INFO)
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from opensnitch.snitch import Snitch
snitch = Snitch()
try:
logging.info( "OpenSnitch running with pid %d." % os.getpid() )
snitch.start()
except KeyboardInterrupt, e:
pass
logging.info( "Quitting ..." )
snitch.stop()

24
main.py
View file

@ -1,24 +0,0 @@
#!/usr/bin/python
import os
import sys
import logging
if not os.geteuid() == 0:
sys.exit('OpenSnitch must be run as root.')
logging.basicConfig(format='[%(asctime)s] (%(levelname)s) %(message)s',level=logging.INFO)
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from opensnitch.snitch import Snitch
snitch = Snitch()
try:
logging.info( "OpenSnitch running with pid %d." % os.getpid() )
snitch.start()
except KeyboardInterrupt, e:
pass
logging.info( "Quitting ..." )
snitch.stop()

View file

@ -1,3 +1,21 @@
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import glob
import re
import os

View file

@ -1,3 +1,21 @@
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from opensnitch.proc import get_process_name_by_connection
from opensnitch.app import Application
from dpkt import ip

View file

@ -1,3 +1,21 @@
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import logging
from threading import Lock
from scapy.all import *

View file

@ -1,3 +1,21 @@
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import re
import glob
import os

View file

@ -1,3 +1,21 @@
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import nfqueue
import logging
from threading import Lock

View file

@ -1,3 +1,21 @@
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import os
import logging
import nfqueue

View file

@ -1,3 +1,21 @@
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import easygui as g
import nfqueue

39
setup.py Normal file
View file

@ -0,0 +1,39 @@
# This file is part of OpenSnitch.
#
# Copyright(c) 2017 Simone Margaritelli
# evilsocket@gmail.com
# http://www.evilsocket.net
#
# This file may be licensed under the terms of of the
# GNU General Public License Version 2 (the ``GPL'').
#
# Software distributed under the License is distributed
# on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
# express or implied. See the GPL for the specific language
# governing rights and limitations.
#
# You should have received a copy of the GPL along with this
# program. If not, go to http://www.gnu.org/licenses/gpl.html
# or write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from setuptools import setup, find_packages
import os
try:
long_description = open( 'README.md', 'rt' ).read()
except:
long_description = 'OpenSnitch - An application level firewall for GNU/Linux.'
setup( name = 'opensnitch',
version = '0.0.1',
description = long_description,
long_description = long_description,
author = 'Simone Margaritelli',
author_email = 'evilsocket@gmail.com',
url = 'http://www.github.com/evilsocket/opensnitch',
packages = find_packages(),
scripts = [ 'bin/opensnitch' ],
license = 'GPL',
zip_safe = False,
install_requires = [ 'scapy', 'easygui', 'dpkt' ]
)