mirror of https://github.com/sonertari/SSLproxy
Update with sslsplit develop changes
parent
e577747ac8
commit
027b6e3a95
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: set ft=python list et ts=8 sts=4 sw=4:
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
def commentline(prefix, line):
|
||||
if len(line) > 0:
|
||||
return prefix + ' ' + line + '\n'
|
||||
return prefix + '\n'
|
||||
|
||||
def license(outfile, filetype):
|
||||
with open('LICENSE', 'r') as f:
|
||||
# skip title
|
||||
f.readline()
|
||||
f.readline()
|
||||
text = f.read()
|
||||
text = ('SSLsplit - transparent SSL/TLS interception\n'
|
||||
'https://www.roe.ch/SSLsplit\n\n') + text.replace(
|
||||
'and contributors', '<daniel@roe.ch>')
|
||||
lines = text.splitlines()
|
||||
if filetype == 'c':
|
||||
outfile.write('/*-\n')
|
||||
for line in lines:
|
||||
outfile.write(commentline(' *', line))
|
||||
elif filetype == 'script':
|
||||
outfile.write('#-\n')
|
||||
for line in lines:
|
||||
outfile.write(commentline('#', line))
|
||||
elif filetype == 'man':
|
||||
outfile.write('.\\"-\n')
|
||||
for line in lines:
|
||||
outfile.write(commentline('.\\"', line))
|
||||
else:
|
||||
raise RuntimeError()
|
||||
|
||||
def mangle(outfile, infile):
|
||||
have_first = False
|
||||
have_header = False
|
||||
for line in infile:
|
||||
if have_header:
|
||||
outfile.write(line)
|
||||
elif have_first:
|
||||
if (filetype == 'c' and line.startswith(' */')) or \
|
||||
(filetype == 'script' and not line.startswith('#')) or \
|
||||
(filetype == 'man' and not line.startswith('.\\"')):
|
||||
outfile.write(line)
|
||||
have_header = True
|
||||
else:
|
||||
if line.startswith('/*-'):
|
||||
filetype = 'c'
|
||||
elif line.startswith('#-'):
|
||||
filetype = 'script'
|
||||
elif line.startswith('.\\"-'):
|
||||
filetype = 'man'
|
||||
else:
|
||||
outfile.write(line)
|
||||
continue
|
||||
license(outfile, filetype)
|
||||
have_first = True
|
||||
|
||||
for fn in sys.argv[1:]:
|
||||
with open(fn, 'r') as infile:
|
||||
with open(fn + '~', 'w') as outfile:
|
||||
mangle(outfile, infile)
|
||||
os.rename(fn + '~', fn)
|
||||
|
@ -0,0 +1,54 @@
|
||||
# in: PKGNAME
|
||||
# in: FEATURES (optional)
|
||||
# in: BUILD_INFO (optional)
|
||||
|
||||
ifndef PKGNAME
|
||||
$(error PKGNAME not defined)
|
||||
endif
|
||||
|
||||
BASENAME?= basename
|
||||
CUT?= cut
|
||||
GIT?= git
|
||||
GREP?= grep
|
||||
OPENSSL?= openssl
|
||||
SED?= sed
|
||||
|
||||
GITDIR:= $(wildcard .git)
|
||||
VERSION_FILE:= $(wildcard VERSION)
|
||||
NEWS_FILE:= $(firstword $(wildcard NEWS*))
|
||||
|
||||
ifdef GITDIR
|
||||
BUILD_VERSION:= $(shell $(GIT) describe --tags --dirty --always)
|
||||
BUILD_INFO+= V:GIT
|
||||
GITDIR:=
|
||||
else
|
||||
ifdef VERSION_FILE
|
||||
BUILD_VERSION:= $(shell $(CAT) VERSION)
|
||||
BUILD_INFO+= V:FILE
|
||||
else
|
||||
BUILD_VERSION:= $(shell $(BASENAME) $(PWD)|\
|
||||
$(GREP) $(PKGNAME)-|\
|
||||
$(SED) 's/.*$(PKGNAME)-\(.*\)/\1/g')
|
||||
BUILD_INFO+= V:DIR
|
||||
endif
|
||||
ifdef NEWS_FILE
|
||||
NEWS_SHA:= $(shell $(OPENSSL) dgst -sha1 -r $(NEWS_FILE) |\
|
||||
$(CUT) -c -7)
|
||||
BUILD_INFO+= N:$(NEWS_SHA)
|
||||
endif
|
||||
endif # GITDIR
|
||||
|
||||
BUILD_DATE:= $(shell date +%Y-%m-%d)
|
||||
BUILD_CPPFLAGS+=-D"BUILD_PKGNAME=\"$(PKGNAME)\"" \
|
||||
-D"BUILD_VERSION=\"$(BUILD_VERSION)\"" \
|
||||
-D"BUILD_DATE=\"$(BUILD_DATE)\"" \
|
||||
-D"BUILD_INFO=\"$(BUILD_INFO)\"" \
|
||||
-D"BUILD_FEATURES=\"$(FEATURES)\""
|
||||
|
||||
# out: NEWS_FILE
|
||||
# out: NEWS_SHA
|
||||
# out: VERSION_FILE
|
||||
# out: BUILD_VERSION
|
||||
# out: BUILD_DATE
|
||||
# out: BUILD_INFO
|
||||
# out: BUILD_CPPFLAGS
|
Loading…
Reference in New Issue