Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
allfro committed Jun 21, 2011
1 parent cd344f7 commit a768f62
Show file tree
Hide file tree
Showing 13 changed files with 8,462 additions and 0 deletions.
621 changes: 621 additions & 0 deletions COPYING

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pylibnet - Python module for the libnet packet injection library
Copyright (C) 2009 Nadeem Douba

To install this module you will need to install the following:
* libnet-1.1.x: to inject your packets.

This comment has been minimized.

Copy link
@saintjoseph1

saintjoseph1 May 1, 2023

are we to use django to install this?


All these prerequisites can be installed using apt-get, port, or fink.
Debian users can install the following packages to meet the pre-
requisite requirements:
* build-essential
* libnet1-dev
* python-dev

For Mac OS/X users, please use the libnet libraries that come from
the Fink distribution. If you try to compile libnet in Mac OS/X you
will run into a bug that causes "pblock not found" errors.

The documentation will be in the next release. Your input is always
valued. The documentation from libnet-1.1.x can be used with the
following principles in mind:

* To create a context use libnet.context(injection_type, device)
+ This will create the libnet_t *l pointer which is used to
build packets and return a libnet.context object.
* All autobuild, write, and resolver functions can be accessed
via the libnet.context object using the following conventions:
+ omit the 'libnet_' prefix when calling any function
+ eliminate the 'libnet_t *l' param in the method call since
this is essentially provided by the libnet.context object
* Remember to inject responsibly

Please let me know if we can improve this wrapper in any way. The
documentation will come in the form of docstrings in the next
release. Also, context queuing and chaining will be supported.

Happy Injecting!
621 changes: 621 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions PKG-INFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Metadata-Version: 1.0
Name: pylibnet
Version: 2.0-beta-rc9
Summary: Python Libnet Extension
Home-page: http://pylibnet.sourceforge.net
Author: Nadeem Douba
Author-email: ndouba@cygnos.com
License: GNU GPL
Description:
Python extension for the Libnet packet injection library.

Platform: UNKNOWN
32 changes: 32 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
pylibnet - Python module for the libnet packet injection library
Copyright (C) 2009 Nadeem Douba

To install this module you will need to install the following:
* libnet-1.1.x: to inject your packets.

All these prerequisites can be installed using apt-get, port, or fink.
Debian users can install the following packages to meet the pre-
requisite requirements:
* build-essential
* libnet1-dev
* python-dev

For Mac OS/X users, please use the libnet libraries that come from
the Fink or MacPorts distribution. If you try to compile libnet in
Mac OS/X you will run into a bug that causes "pblock not found" errors.
Mac OS/X users will have to install the following prerequisites
in MacPorts:
* libnet11
* python25 (this is essential since Mac OS/X Python only runs
in 64-bit mode and the libnet lib is 32-bit only)

After installing python25 use the following command to make the
MacPorts distro of Python active:

sudo python_select python25

Please let me know if we can improve this wrapper in any way. The
documentation is embedded in the library and can be accessed via
the help() function in the Python interpretter or pydoc.

Happy Injecting!
71 changes: 71 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/python

from distutils.core import setup, Extension
import re
import os
import sys

include_dir = None
lib_dir = None

prefixes = ['/usr','/usr/local','/sw','/opt/local']

print 'Searching for libnet...'
for p in prefixes:
if os.path.isfile(p+os.sep+'include'+os.sep+'libnet.h'):
include_dir = p+os.sep+'include'
break

if include_dir is None:
print 'Could not locate the include file "libnet.h"'
sys.exit(-1);

for p in prefixes:
if os.path.isfile(p+os.sep+'lib'+os.sep+'libnet.a'):
lib_dir = p+os.sep+'lib'
break

if lib_dir is None:
print 'Could not locate the static library "libnet.a"'
sys.exit(-1)

version = ''
try:
f = open(include_dir+os.sep+'libnet.h')
for l in f:
if l.find('LIBNET_VERSION') != -1:
version = l
break;
except:
print 'Could not open "libnet.h" to check for version number.'
sys.exit(-1)

version_nums = re.findall('\d+', version)

defines = [
('LIBNET_MAJOR_VERSION', version_nums[0]),
('LIBNET_MINOR_VERSION', version_nums[1]),
('LIBNET_RELEASE', version_nums[2]),
('MAJOR_VERSION', '2'),
('MINOR_VERSION', '0')
]


libnet_module = Extension('libnet',
define_macros = defines,
include_dirs = [include_dir],
libraries = ['net'],
library_dirs = [lib_dir],
sources = ['src/libnetmodule.c'])

setup (name = 'pylibnet',
version = '2.0-beta-rc9',
description = 'Python Libnet Extension',
author = 'Nadeem Douba',
license = 'GNU GPL',
author_email = 'ndouba@cygnos.com',
url = 'http://pylibnet.sourceforge.net',
long_description = '''
Python extension for the Libnet packet injection library.
''',
ext_modules = [libnet_module])
Loading

0 comments on commit a768f62

Please sign in to comment.