Skip to content

Commit

Permalink
New distribution [0.14.4]
Browse files Browse the repository at this point in the history
* included vendor scripts to distro
* seperate CLI deps in setup.py
* added vendor deps in setup.py
* linted source files (except protocols/ipsuite)
* revised impl of vendor scripts
* updated const enums accordingly
* some other minor changes
  • Loading branch information
JarryShaw committed Sep 1, 2019
1 parent 1b11d2d commit d6d8e98
Show file tree
Hide file tree
Showing 177 changed files with 1,658 additions and 2,458 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

pcapkit-*-tempdir/
pcapkit-temp.html

out
*.js
!out.js
Expand Down
64 changes: 63 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,92 @@
{
"python.pythonPath": ".venv/bin/python",
"cSpell.words": [
"Chksum",
"DEVMODE",
"ECDSA",
"INET",
"NPROCESSORS",
"PROTO",
"RCVBT",
"SIOP",
"Serv",
"aftermathmp",
"aktau",
"bctr",
"bufid",
"ccecho",
"ccnew",
"chkreq",
"cmmd",
"cmmt",
"distro",
"dlink",
"dport",
"dscp",
"dtgram",
"echore",
"emojize",
"eool",
"exeng",
"exlyr",
"expkg",
"exptl",
"extmp",
"fdpext",
"fext",
"fileng",
"fout",
"foutio",
"fpout",
"fproot",
"frnum",
"gaocegege",
"gbhdr",
"hdrs",
"httpv",
"ifile",
"ifnm",
"ilnp",
"inarp",
"ipsuite",
"lrfc",
"mpbuf",
"mpfdp",
"mpfrm",
"mpkit",
"mpmng",
"mpprc",
"mprsm",
"mpsvc",
"newflg",
"nnsec",
"nnsecd",
"nofile",
"nsec",
"ofile",
"ofnm",
"padn",
"plen",
"pocsp",
"prio",
"protos",
"pval",
"pycapfile",
"pyenv",
"pypcap",
"reasm",
"renm",
"sackpmt",
"sched",
"splt",
"srcport",
"strflg",
"subd",
"subn",
"sufs",
"sysconf",
"tbitem",
"tbody"
"tbody",
"vinfo"
]
}
8 changes: 6 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ global-exclude .DS_Store
global-include *.md
global-include *.py

prune .github
prune .venv
prune .vscode

prune archive
prune devel
prune doc
prune release
prune sample
prune src
prune test
prune testbench

include README.md
include LICENSE

prune pcapkit/protocols/*/NotImplemented
# prune pcapkit/vendor
exclude pcapkit/protocols/*/NotImplemented
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const: update-const
dist: dist-pypi dist-upload
release: release-master
pipenv: update-pipenv
update: update-const update-date
# update: update-const update-date
update: update-const

pypi:
DIR=release $(MAKE) dist-prep dist
Expand Down
5 changes: 3 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ emoji = "*"
tbtrim = ">=0.2.1"

[dev-packages]
pypcapkit = {editable = true, path = "."}
pypcapkit = {editable = true,path = "."}
pyshark = "*"
dpkt = "*"
scapy = "*"
pathlib2 = "*"
bs4 = "*"
html5lib = "*"
requests = "*"
requests = {extras = ["socks"],version = "*"}
ipython = "*"
autopep8 = "*"
pylint = "*"
Expand Down
27 changes: 23 additions & 4 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 14 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from distutils.core import setup

# version string
__version__ = '0.14.3'
__version__ = '0.14.4'

# README
with open('README.md', encoding='utf-8') as file:
Expand All @@ -32,14 +32,23 @@
'dictdumper>=0.7.0.post1', # for formatted output
'chardet', # for bytes decode
'aenum', # for const types
'emoji', # for CLI display
'tbtrim>=0.2.1', # for refined exceptions
],
extras_require={
'all': ['dpkt', 'scapy', 'pyshark'],
'all': [
'emoji',
'dpkt', 'scapy', 'pyshark',
'requests[socks]', 'bs4', 'html5lib',
],
# for CLI display
'cli': ['emoji'],
# for normal users
'DPKT': ['dpkt'],
'Scapy': ['scapy'],
'PyShark': ['pyshark'],
# for developers
'vendor': ['requests[socks]', 'bs4', 'html5lib'],
# version compatibility
':python_version == "3.4"': ['pathlib2>=2.3.2'],
},
# py_modules = ['pcapkit'],
Expand All @@ -63,8 +72,8 @@
'pcapkit.const.ipv6',
'pcapkit.const.ipx',
'pcapkit.const.mh',
'pcapkit.const.misc',
'pcapkit.const.ospf',
'pcapkit.const.reg',
'pcapkit.const.tcp',
'pcapkit.const.vlan',
'pcapkit.corekit',
Expand Down Expand Up @@ -95,8 +104,8 @@
'pcapkit.vendor.ipv6',
'pcapkit.vendor.ipx',
'pcapkit.vendor.mh',
'pcapkit.vendor.misc',
'pcapkit.vendor.ospf',
'pcapkit.vendor.reg',
'pcapkit.vendor.tcp',
'pcapkit.vendor.vlan',
],
Expand Down
11 changes: 6 additions & 5 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# pylint: disable=wrong-import-position, unused-import, unused-wildcard-import, bad-continuation
"""stream pcap file extractor
`pcapkit` is an independent open source library, using only
Expand Down Expand Up @@ -53,17 +54,17 @@
dump utilities for `pcapkit` implementation
"""
# pylint: disable=wrong-import-position, unused-import, unused-wildcard-import
import os
import warnings

import tbtrim

from pcapkit.utilities.exceptions import DEVMODE, BaseError
from pcapkit.utilities.warnings import DevModeWarning

# set up sys.excepthook
if DEVMODE:
warnings.showwarning('development mode enabled', RuntimeWarning,
warnings.showwarning('development mode enabled', DevModeWarning,
filename=__file__, lineno=0,
line=f"PCAPKIT_DEVMODE={os.environ['PCAPKIT_DEVMODE']}")
else:
Expand All @@ -72,7 +73,7 @@
exception=BaseError, strict=False)

# All Reference
import pcapkit.__all__ as all # pylint: disable=redefined-builtin
import pcapkit.all

# Interface
from pcapkit.interface import *
Expand Down Expand Up @@ -111,13 +112,13 @@
'TREE', 'JSON', 'PLIST', 'PCAP', # Format Macros
'LINK', 'INET', 'TRANS', 'APP', 'RAW', # Layer Macros
'DPKT', 'Scapy', 'PyShark', 'MPServer', 'MPPipeline', 'PCAPKit',
# Engine Macros # pylint: disable=bad-continuation
# Engine Macros
'NoPayload', # No Payload
'Raw', # Raw Packet
'ARP', 'Ethernet', 'L2TP', 'OSPF', 'RARP', 'VLAN', # Link Layer
'AH', 'IP', 'IPsec', 'IPv4', 'IPv6', 'IPX', # Internet Layer
'HIP', 'HOPOPT', 'IPv6_Frag', 'IPv6_Opts', 'IPv6_Route', 'MH',
# IPv6 Extension Header # pylint: disable=bad-continuation
# IPv6 Extension Header
'TCP', 'UDP', # Transport Layer
'FTP', 'HTTP', # Application Layer
]
2 changes: 1 addition & 1 deletion src/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


def get_parser():
parser = argparse.ArgumentParser(prog='pcapkit',
parser = argparse.ArgumentParser(prog='pcapkit-cli',
description='PCAP file extractor and formatted dumper')
parser.add_argument('-V', '--version', action='version', version=__version__)
parser.add_argument('fin', metavar='input-file-name',
Expand Down
11 changes: 10 additions & 1 deletion src/__all__.py → src/all.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
# pylint: disable=unused-import, unused-wildcard-import, bad-continuation
"""index for the library
`pcapkit` has defined various and numerous functions and
Expand All @@ -7,6 +8,8 @@
contains all things from `pcapkit`.
"""
import pcapkit.const as const
import pcapkit.vendor as vendor
from pcapkit.corekit import *
from pcapkit.dumpkit import *
from pcapkit.foundation import *
Expand All @@ -15,9 +18,15 @@
from pcapkit.protocols import *
from pcapkit.reassembly import *
from pcapkit.toolkit import *
from pcapkit.utilities import *
from pcapkit.utilities import * # pylint: disable=redefined-builtin

__all__ = [
# pcapkit.const
'const',

# pcapkit.vendor
'vendor',

# pcapkit.corekit
'Info', # Info Class
'ProtoChain', # ProtoChain
Expand Down
Loading

0 comments on commit d6d8e98

Please sign in to comment.