diff --git a/Makefile b/Makefile index 8979b8c..5323434 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ DEBUG ?= 0 ASAN ?= 0 STATIC ?= 0 FPGO ?= 0 +STRIP ?= 0 MARCH ?= native MTUNE ?= native @@ -21,19 +22,17 @@ SUBDIR_LIB := libslunkcrypt # --------------------------------------------------------------------------- CFLAGS = -I$(SUBDIR_LIB)/include -Wall -Wno-trigraphs -march=$(MARCH) -mtune=$(MTUNE) +LDFLGS = ifeq ($(DEBUG),1) CONFIG := _g CFLAGS += -Og -g - LDFLGS := else ifeq ($(ASAN),1) CONFIG := _a CFLAGS += -O1 -g -fsanitize=address -fno-omit-frame-pointer - LDFLGS := else CONFIG := CFLAGS += -O3 -DNDEBUG - LDFLGS := -s endif ifneq ($(FPGO),0) @@ -52,6 +51,10 @@ ifeq ($(filter %mingw32 %-windows-gnu,$(MACHINE)),) LDFLGS += -lpthread endif +ifneq ($(STRIP),0) + LDFLGS += -s +endif + ifeq ($(STATIC),1) LDFLGS += -static endif diff --git a/Slunk.props b/Slunk.props new file mode 100644 index 0000000..5f534de --- /dev/null +++ b/Slunk.props @@ -0,0 +1,14 @@ + + + + + false + + + + + + $(XPDeprecationWarning) + + + \ No newline at end of file diff --git a/etc/utils/win32/StdDisclaimer.html b/etc/utils/win32/StdDisclaimer.html new file mode 100644 index 0000000..3122f77 --- /dev/null +++ b/etc/utils/win32/StdDisclaimer.html @@ -0,0 +1,24 @@ + + + + +Disclaimer + + + + +

Disclaimer

+ +

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE  CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ +

Karl M. Syring

+ + diff --git a/etc/utils/win32/UnxUtilsDist.html b/etc/utils/win32/UnxUtilsDist.html new file mode 100644 index 0000000..1669fe9 --- /dev/null +++ b/etc/utils/win32/UnxUtilsDist.html @@ -0,0 +1,660 @@ + + + + + + +Native Win32 ports of some GNU utilities + + + + + + + + +
+ + + + +
GNU utilities for Win32
+


+ This are some ports of common GNU utilities to native + Win32. In this context, native means the executables do only depend on the Microsoft + C-runtime (msvcrt.dll) and not an emulation layer like that provided by Cygwin tools.
+

+

Download:

+
+

by http: UnxUtils.zip
+ latest updates (after 14-04-03):  UnxUpdates.zip

+
+

Source code:

+
+

I have started an Open source project at http://unxutils.sourceforge.net. There is a +   CVS repository of all sources, even if the changes to the + original GNU code are trivial. The repository can be accessed via anonymous CVS with the + command
+
cvs + -d:pserver:anonymous@cvs.UnxUtils.sourceforge.net:/cvsroot/unxutils login

+
+
+

The following program versions are covered:

+
+

bc-1.05
+ bison-1.28
+ bzip2-1.0.2
+ diffutils-2.7
+ fileutils-3.16
+ findutils-4.1
+ flex-2.5.4
+ gawk-3.1.0
+ grep-2.4.2
+ gsar110
+ gzip-1.2.4
+ indent-2.2.9
+ jwhois-2.4.1
+ less-340
+ m4-1.4
+ make-3.78.1
+ patch-2.5
+ recode-3.6
+ rman-3.0.7
+ sed-3.02
+ shellutils-1.9.4
+ tar-1.12
+ textutils-2.1

+ unrar-3.00
+ wget-1.8.2
+ which-2.4

+
+

Standard behavior:

+
    +
  • forward as well as backward slashes in file + paths are accepted.

    +
  • +
+

What is new:

+


+    14-04-03

+
    +
  • New edition

    +
  • +
  • The programs are in use on all continents of + earth, including Antarctica. Still no users on Mars.

    +
  • +
+

 

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Program

+

Notes

+
agrep.exegot it from here: http://www.tgries.de/agrep/
ansi2knr.exe
basename.exe
bison.exe
bzip2.exeJulian Sewards alternative + compressor
bunzip2.exe
bzip2recover.exe
cat.exe
chgrp.exedummy
chmod.exe
chown.exedummy
cksum.exe
cmp.exe
comm.exe
compress.exefor (de)compressing .Z files; this is actually a program + called ncompress and was found on one of  the Linux mirrors
cp.exeworks only on NT, does real hardlinks on NTFS
csplit.exe
cut.exe
date.exe
dd.exe
df.exedummy
diff.exe
diff3.exe
dirname.exe
du.exe
echo.exe
egrep.exe
env.exedummy
expand.exe
expr.exe
factor.exe
fgrep.exe
find.exe
    +
  • Example of command line under Cmd/Command shell:
    + find -name *.txt -exec cat {} ;
  • +
+
flex.exe
fmt.exe
fold.exe
gawk.exeinput files are opened in text mode
make.exeFrom v3.77 upwards, make searches for a sh.exe on the path. If + it does not find one, it switches to win32 make mode that is it uses intermediate batch + files for command processing.
+ This is fine until your makefile tries to execute something like mkdir, which will invoke + the internal mkdir from cmd.exe or command.com. As the results may not be to your liking, + you may prefer to use the sh.exe provide here.
grep.exe
gsar.exe
gunzip.exe
gzip.exe
head.exe
id.exedummy
install.exe
join.exe
less.exe
ln.exeworks only on NT, does real hardlinks on NTFS
logname.exe
ls.exe
m4.exe
md5sum.exe
mkdir.exe
mkfifo.exedummy
mknod.exedummy
mv.exe
mvdir.exe
nl.exe
od.exe
paste.exe
patch.exe
pathchk.exe
pr.exe
printenv.exe
printf.exe
ptx.exe
recode.exe
rm.exe
rman.exePolyglotMan by Thomas A. Phelps ( source)
rmdir.exe
sdiff.exe
sed.exe
seq.exe
sleep.exe
sort.exe
sh.exerenamed zsh - this is no replacement for the Cygwin bash
shar.exeonly works with -T (text) option
split.exe
stego.exestego -E encode.me -T words.txt
+
Encodes file encode.me as gibberish text using words from the words.txt file to + stdout. If the -T option is omitted, stego looks for a file called "words" in + the current directory. Of course, the -D option will decode the input file; remember to + redistribute words.txt together with the encoded file.
+ The purpose of this program is to disguise binary files as a kind of text file or to drive + your coworkers mad.
su.exedummy
sum.exe
sync.exe
tac.exe
tail.exe
tar.exe
    +
  • only forward slashes are accepted
  • +
  • the -z option (compression) does not work
  • +
  • no remote archives
  • +
  • works only on NT, does real hardlinks on NTFS
  • +
+
tee.exe
test.exe
touch.exe
tr.exe
uname.exe
unexpand.exe
uniq.exe
unrar.exeThis is unrar 3.00 beta 7, which seems to have been + "free". Works good enough.
unshar.exe
uudecode.exe
uuencode.exe
wc.exe
wget.exewget 1.8.2 builds out of the box with MS Visual C
which.exedoes not search the current directory
whoami.exe
xargs.exe
yes.exe
zcat.exe

Additional + programs

pclip.exeput the Windows clipboard text to stdout
gclip.exeget  the Windows clipboard text from stdin
+ Example: run the text from the clipboard through sed and put the result back
+                + pclip | sed "s/string1/string2/g" | gclip
gplay.exeMy minimalist console multimedia player using DirectShow. With
+ gplay filename | URL
+ you should be able to play just everything, as long as Microsoft supports it.
+
+ +

md5 sums

+ +
+ +

Links:

+ +

The gcc compiler for Win32:
+   http://www.mingw.org

+Digital Mars compiler:
+
   http://www.digitalmars.com
+A zsh shell for Win32:
+   ftp://ftp.blarg.net/users/amol/zsh
+The home of vim, has a Win32 version:

+
   http://www.vim.org
+An emacs for NT:

+
   http://www.gnu.org/software/emacs/windows/ntemacs.html
+The CVS version control system:
+
   http://www.cvshome.org
+   http://www.cvsnt.org

+A free IDE for the Win32 gcc:
+  VIDE

+ +

José Fonsecas site with related stuff:
+     http://jrfonseca.dyndns.org/projects/gnu-win32
+HTML man pages for the GNU utilities:
+     http://www.fsf.org/manual/manual.html
+An Un*x shell scripting resource:
+     http://www.shelldorado.com/
+Another source of unixish stuff:
+     http://virtunix.itribe.net

+ +

Useful free NT system utilities:
+     http://www.sysinternals.com

+Some hints on cloning your system with dd:
+     http://www.rajeevnet.com/hacks_hints/os_clone/os_cloning.html

+Programs missing from this distribution, especially a command line registry editor.
+     http://www.dmst.aueb.gr/dds/sw/outwit
+
+The GNU Privacy Guard:
+     http://www.gnupg.org

+zip and unzip from the Infozip distribution:
+     http://www.info-zip.org/pub/infozip

+ +

An Un*x emulation on Win32:
+     http://www.cygwin.com
+Another Un*x emulation on Win32:
+     http://www.research.att.com/sw/tools/uwin/
+Windows Services for UNIX, integrates the Interix subsystem:
+     http://www.microsoft.com/windows/sfu/productinfo/overview/default.asp

+ +
+ +

Read my standard disclaimer: (really?)
+Last change on 15-04-03 by Karl M. Syring (bug reports +are welcome)
+Original location of this page: http://www.weihenstephan.de/~syring/win32/UnxUtils.html

+ + + + + + + diff --git a/etc/utils/win32/cecho.exe b/etc/utils/win32/cecho.exe new file mode 100644 index 0000000..1fb1624 Binary files /dev/null and b/etc/utils/win32/cecho.exe differ diff --git a/etc/utils/win32/head.exe b/etc/utils/win32/head.exe new file mode 100644 index 0000000..7f5ef87 Binary files /dev/null and b/etc/utils/win32/head.exe differ diff --git a/etc/utils/win32/rand.exe b/etc/utils/win32/rand.exe new file mode 100644 index 0000000..1f696cf Binary files /dev/null and b/etc/utils/win32/rand.exe differ diff --git a/frontend/SlunkCrypt.vcxproj b/frontend/SlunkCrypt.vcxproj index 78498d7..169e326 100644 --- a/frontend/SlunkCrypt.vcxproj +++ b/frontend/SlunkCrypt.vcxproj @@ -104,57 +104,63 @@ + + + + + + true - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ slunkcrypt false - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ slunkcrypt false - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ slunkcrypt true - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ slunkcrypt false - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ slunkcrypt false - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ slunkcrypt diff --git a/libslunkcrypt/libSlunkCrypt.vcxproj b/libslunkcrypt/libSlunkCrypt.vcxproj index 0f8089e..ceac03e 100644 --- a/libslunkcrypt/libSlunkCrypt.vcxproj +++ b/libslunkcrypt/libSlunkCrypt.vcxproj @@ -90,57 +90,63 @@ + + + + + + true - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ libslunkcrypt-1 false - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ libslunkcrypt-1 false - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ slunkcrypt-$(PlatformShortName)-1 true - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ libslunkcrypt-1 false - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ libslunkcrypt-1 false - $(SolutionDir)bin\$(Platform)\$(Configuration)\ - $(SolutionDir)obj\$(Platform)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)bin\$(PlatformShortName)\$(Configuration)\ + $(SolutionDir)obj\$(PlatformShortName)\$(Configuration)\$(ProjectName)\ slunkcrypt-$(PlatformShortName)-1 diff --git a/mk-profiled.cmd b/mk-profiled.cmd new file mode 100644 index 0000000..6b20718 --- /dev/null +++ b/mk-profiled.cmd @@ -0,0 +1,53 @@ +@echo off +setlocal enabledelayedexpansion + +set ECHO="%~dp0.\etc\utils\win32\cecho.exe" +if "%MSVC_PATH%"=="" ( + set "MSVC_PATH=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC" +) + +if not exist "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" ( + %ECHO% red "\nMSVC not found. Please check MSVC_PATH and try again^!\n" + pause + goto:eof +) + +for %%p in (x86,x64) do ( + call "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" %%p + set "TEMP_NAME=!RANDOM!-!RANDOM!" + %ECHO% white "\n------------------------------------------------------------------------------" + %ECHO% white "Clean [%%p]" + %ECHO% white "------------------------------------------------------------------------------\n" + MSBuild.exe /property:Configuration=Release /property:Platform=%%p /target:Clean /verbosity:normal "%~dp0\Slunk.sln" + if not "!ERRORLEVEL!"=="0" goto:BuildFailed + %ECHO% white "\n------------------------------------------------------------------------------" + %ECHO% white "Instrument [%%p]" + %ECHO% white "------------------------------------------------------------------------------\n" + MSBuild.exe /property:Configuration=Release /property:Platform=%%p /property:WholeProgramOptimization=PGInstrument /property:LinkTimeCodeGeneration=PGInstrument /target:Rebuild /verbosity:normal "%~dp0\Slunk.sln" + if not "!ERRORLEVEL!"=="0" goto:BuildFailed + %ECHO% white "\n------------------------------------------------------------------------------" + %ECHO% white "Profiling [%%p]" + %ECHO% white "------------------------------------------------------------------------------\n" + "%~dp0.\etc\utils\win32\rand.exe" | "%~dp0.\etc\utils\win32\head.exe" -c 104857600 > "%TMP%\!TEMP_NAME!.dat" + if not "%ERRORLEVEL%"=="0" goto:BuildFailed + "%~dp0.\bin\%%p\Release\slunkcrypt.exe" --self-test + if not "!ERRORLEVEL!"=="0" goto:BuildFailed + "%~dp0.\bin\%%p\Release\slunkcrypt.exe" --encrypt "q4cmK7FEK7@v" "%TMP%\!TEMP_NAME!.dat" "%TMP%\!TEMP_NAME!.enc" + if not "!ERRORLEVEL!"=="0" goto:BuildFailed + "%~dp0.\bin\%%p\Release\slunkcrypt.exe" --decrypt "q4cmK7FEK7@v" "%TMP%\!TEMP_NAME!.enc" "%TMP%\!TEMP_NAME!.out" + if not "!ERRORLEVEL!"=="0" goto:BuildFailed + del /F "%TMP%\!TEMP_NAME!.dat" "%TMP%\!TEMP_NAME!.enc" "%TMP%\!TEMP_NAME!.out" + %ECHO% white "\n------------------------------------------------------------------------------" + %ECHO% white "Re-compile [%%p]" + %ECHO% white "------------------------------------------------------------------------------\n" + MSBuild.exe /property:Configuration=Release /property:Platform=%%p /property:WholeProgramOptimization=PGOptimize /property:LinkTimeCodeGeneration=PGOptimization /target:Build /verbosity:normal "%~dp0\Slunk.sln" + if not "!ERRORLEVEL!"=="0" goto:BuildFailed +) + +%ECHO% green "\nBuild completed successfully.\n" +pause +goto:eof + +:BuildFailed +%ECHO% red "\nBuild has failed ^!^!^!\n" +pause diff --git a/mk-profiled.sh b/mk-profiled.sh index d2b140e..dca22d5 100755 --- a/mk-profiled.sh +++ b/mk-profiled.sh @@ -1,27 +1,44 @@ #!/bin/bash set -e -readonly PLATFORM="$(uname -a)" +PLATFORM="$(uname -a)" unset SUFFIX if [[ "${PLATFORM}" == MINGW* || "${PLATFORM}" == CYGWIN* ]]; then SUFFIX=".exe" fi -echo -e "\n------------------------------------------------------------------------------" -echo -e "Instrument" -echo -e "------------------------------------------------------------------------------\n" +[ -e /dev/urandom ] && RANDOM_SOURCE="/dev/urandom" || RANDOM_SOURCE="/dev/random" +TMP_NAME="$(tr -dc 'a-zA-Z0-9' < ${RANDOM_SOURCE} | fold -w 12 | head -n 1)" +PGO_PATH="$(tr -dc 'a-zA-Z0-9' < ${RANDOM_SOURCE} | fold -w 12 | head -n 1)" +trap "printf \"\033[1;31m\nBuild has failed !!!\033[0m\n\n\"" ERR +trap "rm -rf /tmp/${TMP_NAME}.dat /tmp/${TMP_NAME}.enc /tmp/${TMP_NAME}.out /tmp/${PGO_PATH}" EXIT + +printf "\033[1;36m\n------------------------------------------------------------------------------\033[0m\n" +printf "\033[1;36mClean\n" +printf "\033[1;36m------------------------------------------------------------------------------\033[0m\n\n" make clean -make FPGO=generate -B "$@" -echo -e "\n------------------------------------------------------------------------------" -echo -e "Profiling" -echo -e "------------------------------------------------------------------------------\n" +printf "\033[1;36m\n------------------------------------------------------------------------------\033[0m\n" +printf "\033[1;36mInstrument\n" +printf "\033[1;36m------------------------------------------------------------------------------\033[0m\n\n" -./frontend/bin/slunkcrypt${SUFFIX} -t +make FPGO="generate=/tmp/${PGO_PATH}" -B "$@" -echo -e "\n------------------------------------------------------------------------------" -echo -e "Re-compile" -echo -e "------------------------------------------------------------------------------\n" +printf "\033[1;36m\n------------------------------------------------------------------------------\033[0m\n" +printf "\033[1;36mProfiling\n" +printf "\033[1;36m------------------------------------------------------------------------------\033[0m\n\n" -make FPGO=use -B "$@" +dd bs=1024 count=102400 status=none < ${RANDOM_SOURCE} > /tmp/${TMP_NAME}.dat + +./frontend/bin/slunkcrypt${SUFFIX} --self-test +./frontend/bin/slunkcrypt${SUFFIX} --encrypt 'q4cmK7FEK7@v' /tmp/${TMP_NAME}.dat /tmp/${TMP_NAME}.enc +./frontend/bin/slunkcrypt${SUFFIX} --decrypt 'q4cmK7FEK7@v' /tmp/${TMP_NAME}.enc /tmp/${TMP_NAME}.out + +printf "\033[1;36m\n------------------------------------------------------------------------------\033[0m\n" +printf "\033[1;36mRe-compile\n" +printf "\033[1;36m------------------------------------------------------------------------------\033[0m\n\n" + +make FPGO="use=/tmp/${PGO_PATH}" STRIP=1 -B "$@" + +printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"