From 8c3919fefacce81ff1ca1a157e6b924234ea6ac3 Mon Sep 17 00:00:00 2001 From: DarkFeather Date: Wed, 25 Nov 2020 11:54:06 -0600 Subject: [PATCH] Fixing dependency; upkeep --- CryptoWorkbench.csharp | 4 ++-- Makefile | 43 +++++++++++++++++++++++------------------- PKGBUILD | 6 +++--- bash.cryptoworkbench | 7 ------- captivecrypto | 9 +++++++++ captivecrypto.bash | 9 --------- cryptoworkbench | 7 +++++++ 7 files changed, 45 insertions(+), 40 deletions(-) delete mode 100644 bash.cryptoworkbench create mode 100644 captivecrypto delete mode 100644 captivecrypto.bash create mode 100644 cryptoworkbench diff --git a/CryptoWorkbench.csharp b/CryptoWorkbench.csharp index b2ee84d..7885924 100644 --- a/CryptoWorkbench.csharp +++ b/CryptoWorkbench.csharp @@ -247,9 +247,9 @@ namespace AniNIX.Crypto { case "regex": try { if (line.Length == 3) { - Console.Write(ExecuteCommand.Run(String.Format("bash /usr/local/src/CryptoWorkbench/regex-lookup.bash \"{0}\" \"{1}\"",line[1].Replace("\\","\\\\").Replace("$","\\$"),line[2].Replace("\\","\\\\").Replace("$","\\$")))); + Console.Write(ExecuteCommand.Run(String.Format("bash /opt/aninix/CryptoWorkbench/regex-lookup.bash \"{0}\" \"{1}\"",line[1].Replace("\\","\\\\").Replace("$","\\$"),line[2].Replace("\\","\\\\").Replace("$","\\$")))); } else if (line.Length == 2) { - Console.Write(ExecuteCommand.Run(String.Format("bash /usr/local/src/CryptoWorkbench/regex-lookup.bash \"{0}\"",line[1].Replace("\\","\\\\").Replace("$","\\$")))); + Console.Write(ExecuteCommand.Run(String.Format("bash /opt/aninix/CryptoWorkbench/regex-lookup.bash \"{0}\"",line[1].Replace("\\","\\\\").Replace("$","\\$")))); Console.WriteLine(); } else { Console.Error.WriteLine("Need at least one search term."); diff --git a/Makefile b/Makefile index f15194c..27eae1d 100644 --- a/Makefile +++ b/Makefile @@ -1,27 +1,32 @@ +execDir=/usr/local/bin +optDir=/opt/aninix/CryptoWorkbench + compile: /usr/bin/mcs CryptoWorkbench.csharp /opt/aninix/Uniglot/ - /usr/bin/mcs -out:cryptoworkbench.exe /opt/aninix/Uniglot/CSharp/*.csharp *.csharp 2>&1 + /usr/bin/mcs -out:shell.exe /opt/aninix/Uniglot/CSharp/*.csharp *.csharp 2>&1 test: /usr/bin/mono compile # TODO This needs to be a pytest battery across the input. - echo quit | /usr/bin/mono cryptoworkbench.exe ./sample.txt + echo quit | /usr/bin/mono shell.exe ./sample.txt clean: for i in `cat .gitignore`; do rm -Rf $$i; done -install: compile /bin/bash bash.cryptoworkbench - mkdir -p ${pkgdir}/opt ${pkgdir}/usr/local/bin/ - mv cryptoworkbench.exe ${pkgdir}/opt - cp bash.cryptoworkbench ${pkgdir}/usr/local/bin/cryptoworkbench - cp captivecrypto.bash ${pkgdir}/usr/local/bin/captivecrypto - make checkperm +install: compile /bin/bash cryptoworkbench captivecrypto + mkdir -p ${pkgdir}${optDir} + mkdir -p ${pkgdir}${execDir} + install -m 555 -o 0 -g 0 shell.exe ${pkgdir}${optDir} + install -m 555 -o 0 -g 0 regex-lookup.bash ${pkgdir}${optDir} + install -m 755 -o 0 -g 0 cryptoworkbench ${pkgdir}${execDir} + install -m 755 -o 0 -g 0 captivecrypto ${pkgdir}${execDir} checkperm: - chmod 0555 ${pkgdir}/opt/cryptoworkbench.exe ${pkgdir}/usr/local/bin/cryptoworkbench ${pkgdir}/usr/local/bin/captivecrypto - chown root:root ${pkgdir}/usr/local/bin/captivecrypto ${pkgdir}/opt/cryptoworkbench.exe + chmod 0555 ${pkgdir}${optDir}shell.exe + chmod 0755 ${pkgdir}${execDir}cryptoworkbench ${pkgdir}${execDir}captivecrypto + chown root:root ${pkgdir}${execDir}cryptoworkbench ${pkgdir}${execDir}captivecrypto ${pkgdir}${optDir}shell.exe -sshuser: install ForceCommand.txt pwgen - grep captivecrypto /etc/shells || echo '/usr/local/bin/captivecrypto' /etc/shells - if ! id crypto &>/dev/null; then useradd -k -d /home/crypto -s /usr/local/bin/captivecrypto crypto; fi +sshuser: install ForceCommand.txt pwgen /usr/sbin/ssh /usr/sbin/sshd + grep captivecrypto /etc/shells || echo '${execDir}captivecrypto' /etc/shells + if ! id crypto &>/dev/null; then useradd -k -d /home/crypto -s ${execDir}captivecrypto crypto; fi echo "crypto:$(pwgen 24 1)" | chpasswd; cat ./ForceCommand.txt >> /etc/ssh/sshd_config echo crypto | passwd --stdin crypto @@ -32,10 +37,10 @@ tmux: /usr/bin/tmux echo "bind-key -T prefix x new-window cryptoworkbench" >> /etc/tmux.conf echo 'bind-key -T prefix X confirm-before -p "kill-pane #P? (y/n)" kill-pane' >> /etc/tmux.conf -diff: captivecrypto.bash - diff captivecrypto.bash /usr/local/bin/captivecrypto - diff ./bash.cryptoworkbench /usr/local/bin/cryptoworkbench +diff: ${execDir}captivecrypto ${execDir}cryptoworkbench + diff ./captivecrypto ${execDir}captivecrypto + diff ./cryptoworkbench ${execDir}cryptoworkbench -reverse: - cat /usr/local/bin/captivecrypto > ./captivecrypto.bash - cat /usr/local/bin/cryptoworkbench > ./bash.cryptoworkbench +reverse: ${execDir}captivecrypto ${execDir}cryptoworkbench + cat ${execDir}captivecrypto > ./captivecrypto + cat ${execDir}cryptoworkbench > ./cryptoworkbench diff --git a/PKGBUILD b/PKGBUILD index 8aa02ed..d25a947 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,8 +1,8 @@ # Maintainer: Shikoba Kage pkgname=cryptoworkbench -pkgver=0.1.c1ed369 +pkgver=0.2.4b6f343 pkgver() { - printf "0.1.""$(git rev-parse --short HEAD)" + printf "0.2.""$(git rev-parse --short HEAD)" } pkgrel=1 epoch= @@ -11,7 +11,7 @@ arch=("x86_64") url="https://aninix.net/foundation/CryptoWorkbench" license=('custom') groups=() -depends=('mono>=5.0.0' 'curl' 'grep' 'bash>=4.4' 'git>=2.13' 'uniglot') +depends=('mono>=5.0.0' 'curl' 'grep' 'bash>=4.4' 'git>=2.13' 'Uniglot') makedepends=('make>=4.2') checkdepends=() optdepends=() diff --git a/bash.cryptoworkbench b/bash.cryptoworkbench deleted file mode 100644 index a0e1bbb..0000000 --- a/bash.cryptoworkbench +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -if [ "$1" != "" ]; then - time mono /opt/cryptoworkbench.exe "$1"; -else - time mono /opt/cryptoworkbench.exe -fi -read diff --git a/captivecrypto b/captivecrypto new file mode 100644 index 0000000..c5a6b2b --- /dev/null +++ b/captivecrypto @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ $(pgrep -afc CryptoWorkbench) -gt 10 ]; then + echo All slots used -- you\'ll have to wait. + sleep 5 + exit; +fi + +exec bash -c "time mono /opt/aninix/CryptoWorkbench/shell.exe --blind; read" diff --git a/captivecrypto.bash b/captivecrypto.bash deleted file mode 100644 index fe7c597..0000000 --- a/captivecrypto.bash +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -if [ $(pgrep -afc cryptoworkbench.exe) -gt 10 ]; then - echo All slots used -- you\'ll have to wait. - sleep 5 - exit; -fi - -exec bash -c "time mono /opt/cryptoworkbench.exe --blind; read" diff --git a/cryptoworkbench b/cryptoworkbench new file mode 100644 index 0000000..e0e5f2d --- /dev/null +++ b/cryptoworkbench @@ -0,0 +1,7 @@ +#!/bin/bash +if [ -n "$1" ]; then + time mono /opt/aninix/CryptoWorkbench/shell.exe "$1"; +else + time mono /opt/aninix/CryptoWorkbench/shell.exe; +fi +read