Skip to content

Commit 37cc17a

Browse files
committed
Add repository files
1 parent 9165a04 commit 37cc17a

File tree

8 files changed

+310
-0
lines changed

8 files changed

+310
-0
lines changed

.github/workflows/building.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
3+
###
4+
### Lints all generic and json files in the whole git repository
5+
###
6+
7+
name: building
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
tags:
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: False
20+
matrix:
21+
version:
22+
- '2.7'
23+
- '3.6'
24+
- '3.7'
25+
- '3.8'
26+
target:
27+
- build
28+
- dist
29+
30+
name: "[${{ matrix.version }}] ${{ matrix.target }}"
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@master
34+
35+
- name: Build
36+
run: |
37+
make ${target} VERSION=${version}
38+
env:
39+
target: ${{ matrix.target }}
40+
version: ${{ matrix.version }}

.github/workflows/linting.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
3+
###
4+
### Lints all generic and json files in the whole git repository
5+
###
6+
7+
name: linting
8+
on:
9+
pull_request:
10+
push:
11+
branches:
12+
- master
13+
tags:
14+
15+
jobs:
16+
lint:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: False
20+
matrix:
21+
target:
22+
- pycodestyle
23+
- pydocstyle
24+
- black
25+
26+
name: "[ ${{ matrix.target }} ]"
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@master
30+
31+
- name: Lint
32+
run: |
33+
make ${target}
34+
env:
35+
target: ${{ matrix.target }}

.github/workflows/testing.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
3+
name: testing
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
tags:
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: False
16+
matrix:
17+
version:
18+
- '2.7'
19+
- '3.6'
20+
- '3.7'
21+
- '3.8'
22+
target:
23+
- test
24+
25+
name: "[${{ matrix.version}}] ${{ matrix.target }}"
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@master
29+
30+
- name: Test
31+
run: |
32+
make ${target} VERSION=${version}
33+
env:
34+
target: ${{ matrix.target }}
35+
version: ${{ matrix.version }}

.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
netcat.egg-info/
2+
netcat.egg-info/
3+
build/
4+
dist/
5+
tests/output/*
6+
!.keepme

Makefile

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
ifneq (,)
2+
.error This Makefile requires GNU Make.
3+
endif
4+
5+
# -------------------------------------------------------------------------------------------------
6+
# Default configuration
7+
# -------------------------------------------------------------------------------------------------
8+
.PHONY: help lint test pycodestyle pydocstyle black dist sdist bdist build checkbuild deploy autoformat clean
9+
10+
11+
VERSION = 2.7
12+
BINPATH = bin/
13+
BINNAME = netcat
14+
15+
16+
# -------------------------------------------------------------------------------------------------
17+
# Default Target
18+
# -------------------------------------------------------------------------------------------------
19+
help:
20+
@echo "lint Lint source code"
21+
@echo "test Test source code"
22+
@echo "autoformat Autoformat code according to Python black"
23+
@echo "install Install (requires sudo or root)"
24+
@echo "uninstall Uninstall (requires sudo or root)"
25+
@echo "build Build Python package"
26+
@echo "dist Create source and binary distribution"
27+
@echo "sdist Create source distribution"
28+
@echo "bdist Create binary distribution"
29+
@echo "clean Build"
30+
31+
32+
# -------------------------------------------------------------------------------------------------
33+
# Lint Targets
34+
# -------------------------------------------------------------------------------------------------
35+
36+
lint: pycodestyle pydocstyle black
37+
38+
pycodestyle:
39+
docker run --rm -v $(PWD):/data cytopia/pycodestyle --show-source --show-pep8 $(BINPATH)$(BINNAME)
40+
41+
pydocstyle:
42+
docker run --rm -v $(PWD):/data cytopia/pydocstyle $(BINPATH)$(BINNAME)
43+
44+
black:
45+
docker run --rm -v ${PWD}:/data cytopia/black -l 100 --check --diff $(BINPATH)$(BINNAME)
46+
47+
48+
# -------------------------------------------------------------------------------------------------
49+
# Test Targets
50+
# -------------------------------------------------------------------------------------------------
51+
52+
test:
53+
@echo "noop"
54+
55+
56+
# -------------------------------------------------------------------------------------------------
57+
# Build Targets
58+
# -------------------------------------------------------------------------------------------------
59+
60+
dist: sdist bdist
61+
62+
sdist:
63+
docker run \
64+
--rm \
65+
$$(tty -s && echo "-it" || echo) \
66+
-v $(PWD):/data \
67+
-w /data \
68+
-u $$(id -u):$$(id -g) \
69+
python:$(VERSION)-alpine \
70+
python setup.py sdist
71+
72+
bdist:
73+
docker run \
74+
--rm \
75+
$$(tty -s && echo "-it" || echo) \
76+
-v $(PWD):/data \
77+
-w /data \
78+
-u $$(id -u):$$(id -g) \
79+
python:$(VERSION)-alpine \
80+
python setup.py bdist_wheel --universal
81+
82+
build:
83+
docker run \
84+
--rm \
85+
$$(tty -s && echo "-it" || echo) \
86+
-v $(PWD):/data \
87+
-w /data \
88+
-u $$(id -u):$$(id -g) \
89+
python:$(VERSION)-alpine \
90+
python setup.py build
91+
92+
checkbuild:
93+
docker run \
94+
--rm \
95+
$$(tty -s && echo "-it" || echo) \
96+
-v $(PWD):/data \
97+
-w /data \
98+
python:$(VERSION)-alpine \
99+
sh -c "pip install twine \
100+
&& twine check dist/*"
101+
102+
103+
# -------------------------------------------------------------------------------------------------
104+
# Publish Targets
105+
# -------------------------------------------------------------------------------------------------
106+
107+
deploy:
108+
docker run \
109+
--rm \
110+
$$(tty -s && echo "-it" || echo) \
111+
-v $(PWD):/data \
112+
-w /data \
113+
python:$(VERSION)-alpine \
114+
sh -c "pip install twine \
115+
&& twine upload dist/*"
116+
117+
118+
# -------------------------------------------------------------------------------------------------
119+
# Misc Targets
120+
# -------------------------------------------------------------------------------------------------
121+
122+
autoformat:
123+
docker run \
124+
--rm \
125+
$$(tty -s && echo "-it" || echo) \
126+
-v $(PWD):/data \
127+
-w /data \
128+
cytopia/black -l 100 $(BINPATH)$(BINNAME)
129+
clean:
130+
-rm -rf $(BINNAME).egg-info/
131+
-rm -rf dist/
132+
-rm -rf build/

requirements.txt

Whitespace-only changes.

setup.cfg

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[metadata]
2+
description-file = README.md
3+
4+
[bdist_wheel]
5+
universal=1
6+
7+
[pycodestyle]
8+
max-line-length = 100
9+
10+
[flake8]
11+
max-line-length = 100

setup.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""Pip configuration."""
2+
from setuptools import setup
3+
4+
with open("README.md", "r") as fh:
5+
long_description = fh.read()
6+
7+
setup(
8+
name="netcat",
9+
version="0.0.1-alpha",
10+
description="Netcat with cmd exec, connect, listen and (local/remote) port-forwarding modes.",
11+
license="MIT",
12+
long_description=long_description,
13+
long_description_content_type="text/markdown",
14+
author="cytopia",
15+
author_email="[email protected]",
16+
url="https://github.com/cytopia/netcat",
17+
install_requires=[],
18+
scripts=[
19+
"bin/netcat"
20+
],
21+
classifiers=[
22+
# https://pypi.org/classifiers/
23+
#
24+
# How mature is this project
25+
"Development Status :: 3 - Alpha",
26+
# Indicate who your project is intended for
27+
"Intended Audience :: Developers",
28+
"Intended Audience :: Information Technology",
29+
"Intended Audience :: Science/Research",
30+
"Intended Audience :: System Administrators",
31+
# Project topics
32+
"Topic :: Communications :: Chat",
33+
"Topic :: Communications :: File Sharing",
34+
"Topic :: Internet",
35+
"Topic :: Security",
36+
"Topic :: System :: Shells",
37+
"Topic :: System :: Systems Administration",
38+
"Topic :: Utilities",
39+
# License
40+
"License :: OSI Approved :: MIT License",
41+
# Specify the Python versions you support here. In particular, ensure
42+
# that you indicate whether you support Python 2, Python 3 or both.
43+
"Programming Language :: Python",
44+
"Programming Language :: Python :: 2",
45+
"Programming Language :: Python :: 3",
46+
# How does it run
47+
"Environment :: Console",
48+
# Where does it rnu
49+
"Operating System :: OS Independent",
50+
],
51+
)

0 commit comments

Comments
 (0)