-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 10efdc5
Showing
56 changed files
with
10,427 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
bin/pastelyzer* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[submodule "deps/Postmodern"] | ||
path = deps/postmodern | ||
url = https://github.com/jdz/Postmodern.git | ||
[submodule "deps/cl-ppcre"] | ||
path = deps/cl-ppcre | ||
url = https://github.com/jdz/cl-ppcre.git | ||
[submodule "deps/cl-base64"] | ||
path = deps/cl-base64 | ||
url = https://github.com/jdz/cl-base64.git | ||
[submodule "deps/cl-log"] | ||
path = deps/cl-log | ||
url = https://github.com/jdz/cl-log.git | ||
[submodule "deps/cl-speedy-queue"] | ||
path = deps/cl-speedy-queue | ||
url = https://github.com/jdz/cl-speedy-queue.git | ||
[submodule "deps/ip"] | ||
path = deps/ip | ||
url = https://github.com/jdz/ip.git | ||
[submodule "deps/2am"] | ||
path = deps/2am | ||
url = https://gitlab.common-lisp.net/dkochmanski/2am.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Copyright (c) 2018-2019 CERT.LV | ||
|
||
This software is provided 'as-is', without any express or implied | ||
warranty. In no event will the authors be held liable for any damages | ||
arising from the use of this software. | ||
|
||
Permission is granted to anyone to use this software for any purpose, | ||
including commercial applications, and to alter it and redistribute it | ||
freely, subject to the following restrictions: | ||
|
||
1. The origin of this software must not be misrepresented; you must not | ||
claim that you wrote the original software. If you use this software | ||
in a product, an acknowledgment in the product documentation would be | ||
appreciated but is not required. | ||
2. Altered source versions must be plainly marked as such, and must not be | ||
misrepresented as being the original software. | ||
3. This notice may not be removed or altered from any source distribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#+TITLE: Pastelyzer | ||
|
||
* Introduction | ||
|
||
This is ~pastelyzer~: the paste analyzer. There is a | ||
[[file:doc/usage.org][user manual]] in ~doc~ directory. | ||
|
||
The easiest way to run ~pastelyzer~ is by using the provided binary. | ||
|
||
* Runtime dependencies | ||
** Libraries | ||
|
||
The following libraries must be installed on the target system: | ||
|
||
- ~libssl~ | ||
- ~libzmq~ (version 3+) | ||
|
||
*** Ubuntu Bionic (18.04), Eoan (19.10) packages | ||
|
||
- ~libssl1.1~ | ||
- ~libzmq5~ | ||
|
||
** Database | ||
|
||
To run ~pastelyzer~ in standalone mode a PostgreSQL database (at least version | ||
*9.5*) is required. Use the SQL script in | ||
[[file:../support/schema.sql][support/schema.sql]] to initialize the database: | ||
|
||
#+BEGIN_EXAMPLE | ||
$ psql -d pastelyzer < support/schema.sql | ||
#+END_EXAMPLE | ||
|
||
* Compilation | ||
** Set up a working Common Lisp environment | ||
|
||
~pastelyzer~ works with SBCL and ClozureCL: | ||
|
||
- http://sbcl.org/ | ||
- https://ccl.clozure.com/ | ||
|
||
We strongly suggest using SBCL (which is also the implementation used in the | ||
examples below). Most Linux distributions already have an ~sbcl~ package | ||
available. | ||
|
||
** Install system packages | ||
|
||
To follow the instructions below you'll need the following software: | ||
|
||
- C compiler (~gcc~). | ||
- ~curl~ (to download Quicklisp). | ||
- ~git~ (to clone ~pastelyzer~). | ||
- Header files for ~libssl~ and ~libzmq~. | ||
|
||
If you're using Ubuntu, you can install all of the above using the following | ||
command: | ||
|
||
#+BEGIN_EXAMPLE | ||
# apt install build-essential curl git libssl-dev libzmq3-dev sbcl | ||
#+END_EXAMPLE | ||
|
||
** Install Quicklisp | ||
|
||
An abridged version of the official | ||
[[https://www.quicklisp.org/beta/#installation][Quicklisp install | ||
instructions]]: | ||
|
||
#+BEGIN_EXAMPLE | ||
$ curl -O https://beta.quicklisp.org/quicklisp.lisp | ||
$ sha256sum quicklisp.lisp | ||
4a7a5c2aebe0716417047854267397e24a44d0cce096127411e9ce9ccfeb2c17 quicklisp.lisp | ||
$ sbcl --load quicklisp.lisp \ | ||
--eval '(quicklisp-quickstart:install)' \ | ||
--quit | ||
#+END_EXAMPLE | ||
|
||
** Clone the source repository | ||
|
||
#+BEGIN_EXAMPLE | ||
$ git clone --recurse-submodules https://github.com/cert-lv/pastelyzer.git | ||
$ cd pastelyzer | ||
#+END_EXAMPLE | ||
|
||
** Install dependencies | ||
|
||
This has to be done only once (whenever the lisp library dependencies | ||
change). In the ~pastelyzer~ directory run the ~bin/build.sh~ script with | ||
~load-deps~ command: | ||
|
||
#+BEGIN_EXAMPLE | ||
$ bin/build.sh load-deps | ||
#+END_EXAMPLE | ||
|
||
** Run the test suite (optional) | ||
|
||
#+BEGIN_EXAMPLE | ||
$ bin/build.sh test | ||
#+END_EXAMPLE | ||
|
||
** Build an executable | ||
|
||
Run ~bin/build.sh~ script with no parameters in ~pastelyzer~ directory: | ||
|
||
#+BEGIN_EXAMPLE | ||
$ bin/build.sh | ||
#+END_EXAMPLE | ||
|
||
* Copyright and License | ||
|
||
~pastelyzer~ is released under the terms of zlib/libpng license. See | ||
[[file:LICENSE]] file. | ||
|
||
* Acknowledgements | ||
|
||
This work was partially funded by CEF (Connecting Europe Facility) funding | ||
under "Improving Cyber Security Capacities in Latvia" | ||
(INEA/CEF/ICT/A2017/1528784). | ||
|
||
#+ATTR_HTML: :height 100px :align center | ||
[[file:doc/img/en_square_cef_logo.png]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
#!/bin/sh | ||
# | ||
# This script may look ugly, but that's because it is POSIX Shell | ||
# Command Language compliant: | ||
# | ||
# http://pubs.opengroup.org/onlinepubs/9699919799/ | ||
# | ||
# The main issue is the lack of arrays, so the only way to build a | ||
# command-line without issues with whitespace is to use the `set' | ||
# built-in. | ||
|
||
set -e | ||
|
||
SCRIPT="$0" | ||
SCRIPT_NAME=$(basename "$0") | ||
BINDIR=$(dirname "$0") | ||
ROOT=$(readlink -en "${BINDIR}/../") | ||
BUILD_ID="nil" | ||
|
||
usage() { | ||
echo "Usage: $SCRIPT_NAME {operation|implementation}*" | ||
echo | ||
echo " operation: build|test (default: build)" | ||
echo " implementation: sbcl|ccl (default: sbcl)" | ||
} | ||
|
||
calculate_build_id() { | ||
local rel_tag | ||
local n_master | ||
local n_branch | ||
local hash | ||
local release | ||
local build_id | ||
local git="git -C ${ROOT}" | ||
|
||
rel_tag=$($git describe --tags --match="rel-*" --abbrev=0 master 2> /dev/null)\ | ||
|| { | ||
echo "No release tag found, cannot calculate build id." >&2 | ||
return | ||
} | ||
|
||
n_master=$($git rev-list master --not "${rel_tag}" --count) | ||
n_branch=$($git rev-list HEAD --not master --count) | ||
release="${rel_tag#rel-}" | ||
build_id="${release}" | ||
|
||
if [ ! "$n_master" -eq 0 ]; then | ||
build_id="${release}.${n_master}" | ||
fi | ||
|
||
hash=$($git rev-parse --short HEAD) | ||
|
||
if [ $n_branch -eq 0 ]; then | ||
build_id="${build_id}-${hash}" | ||
else | ||
branch=$($git rev-parse --abbrev-ref HEAD) | ||
build_id="${build_id}.${branch}.${n_branch}-${hash}" | ||
fi | ||
|
||
BUILD_ID="\"${build_id}\"" | ||
} | ||
|
||
OPERATION="build" | ||
LISP="sbcl" | ||
|
||
while [ 0 -lt $# ] ; do | ||
case "$1" in | ||
sbcl) | ||
LISP=sbcl | ||
;; | ||
ccl) | ||
LISP=ccl | ||
;; | ||
test) | ||
OPERATION=test | ||
;; | ||
load-deps) | ||
OPERATION=load-deps | ||
;; | ||
--help|-h) | ||
usage | ||
exit 0 | ||
;; | ||
*) | ||
echo "$SCRIPT: Unrecognized option '$1'." | ||
echo "Try '$SCRIPT --help' for more information." | ||
exit 1 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
# Implementation-specific options. | ||
case $LISP in | ||
sbcl) | ||
set -- \ | ||
--dynamic-space-size 2048 \ | ||
--no-sysinit \ | ||
--no-userinit \ | ||
--eval "(sb-ext:disable-debugger)" \ | ||
--eval "(sb-ext:restrict-compiler-policy 'safety 1)" \ | ||
--eval "(sb-ext:restrict-compiler-policy 'debug 1)" | ||
;; | ||
ccl) | ||
set -- --batch --no-init | ||
;; | ||
esac | ||
|
||
# Common options. | ||
set -- "$@" \ | ||
--eval "(push :hunchentoot-no-ssl *features*)" \ | ||
--eval "(require :asdf)" | ||
|
||
# Build options. | ||
case "$OPERATION" in | ||
test) | ||
case $LISP in | ||
sbcl) | ||
set -- "$@" \ | ||
--eval "(proclaim '(optimize (debug 3) (safety 3)))" \ | ||
--eval "(asdf:test-system \"pastelyzer\")" \ | ||
--eval "(sb-ext:exit :code (if 2am::*fail-count* 1 0))" | ||
;; | ||
ccl) | ||
set -- "$@" \ | ||
--eval "(proclaim '(optimize (debug 3) (safety 3)))" \ | ||
--eval "(asdf:test-system \"pastelyzer\")" \ | ||
--eval "(ccl:quit (if 2am::*fail-count* 1 0))" | ||
;; | ||
esac | ||
;; | ||
load-deps) | ||
set -- "$@" \ | ||
--load ~/quicklisp/setup.lisp \ | ||
--eval "(ql:quickload :swank)" \ | ||
--eval "(push '#:swank-indentation swank-loader::*contribs*)" \ | ||
--eval "(swank-loader:init :load-contribs t :setup nil :reload t)" \ | ||
--eval "(ql:quickload \"pastelyzer\")" \ | ||
--quit | ||
;; | ||
*) | ||
calculate_build_id | ||
set -- "$@" \ | ||
--eval "(asdf:load-system :swank)" \ | ||
--eval "(push '#:swank-indentation swank-loader::*contribs*)" \ | ||
--eval "(swank-loader:init :load-contribs t :setup nil :reload t)" \ | ||
--eval "(asdf:load-system \"pastelyzer\")" \ | ||
--eval "(setq pastelyzer::*build-id* ${BUILD_ID})" \ | ||
--eval "(proclaim '(optimize (speed 2) (safety 1)))" \ | ||
--eval "(asdf:make \"pastelyzer\")" | ||
if [ -f "${BINDIR}/pastelyzer" ]; then | ||
mv -f "${BINDIR}/pastelyzer" "${BINDIR}/pastelyzer.old" | ||
fi | ||
;; | ||
esac | ||
|
||
export CL_SOURCE_REGISTRY="${ROOT}/:${ROOT}/deps//:~/quicklisp/dists/quicklisp/software//" | ||
|
||
"$LISP" "$@" |
Submodule cl-speedy-queue
added at
9ae2a5
Submodule postmodern
added at
119d73
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.